diff options
Diffstat (limited to 'src/parse.h')
-rw-r--r-- | src/parse.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/parse.h b/src/parse.h new file mode 100644 index 0000000..861ad1c --- /dev/null +++ b/src/parse.h @@ -0,0 +1,48 @@ +#ifndef _PARSE_H_ +#define _PARSE_H_ + +#include <stddef.h> +#include <stdbool.h> +#include "expression.h" + +typedef struct ParseExpression +{ + ExpressionType type; + union + { + int int_value; + char *str_value; + } value; + size_t num_children; + struct ParseExpression **children; + struct ParseExpression *parent; +} ParseExpression; + +typedef struct +{ + char *name; + ParseExpression *expression; +} ParseFunction; + +typedef struct +{ + size_t num_functions; + ParseFunction **functions; +} AbstractSyntaxTree; + +typedef struct +{ + AbstractSyntaxTree tree; + + size_t buffer_size; + char *buffer; + + ParseExpression *expression; + + int lines; + bool success; +} ParseState; + +AbstractSyntaxTree parse_file(const char *filename); + +#endif |