diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 14:18:15 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 14:18:15 +0100 |
commit | ecc06c082036aa93f6810ec21e73610c55f5a57b (patch) | |
tree | aff479c3bc5b39ead9f65dffb01d399b341fa4ba /src/parse.h | |
download | uwu-lang-ecc06c082036aa93f6810ec21e73610c55f5a57b.tar.xz |
Initial commit
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 |