summaryrefslogtreecommitdiff
path: root/src/core/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/parser.h')
-rw-r--r--src/core/parser.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/parser.h b/src/core/parser.h
new file mode 100644
index 0000000..d514341
--- /dev/null
+++ b/src/core/parser.h
@@ -0,0 +1,30 @@
+#ifndef SAND_PARSER_H
+#define SAND_PARSER_H
+
+#include "allocator.h"
+#include "tokenizer.h"
+#include "state.h"
+
+typedef enum {
+ SAND_AST_BINARY_OP,
+ SAND_AST_NUMBER,
+} SandAstKind;
+
+typedef struct {
+ SandToken op;
+ struct _SandAst *left;
+ struct _SandAst *right;
+} SandAstBinaryOp;
+
+typedef struct {
+ SandToken value;
+} SandAstNumber;
+
+typedef struct _SandAst {
+ SandAstKind kind;
+ SandLocation location;
+} SandAst;
+
+SandAst *sand_parse(SandState *, SandAllocator *, const char *source, size_t source_length, const char *filename);
+
+#endif