diff options
Diffstat (limited to 'include/ast.h')
-rw-r--r-- | include/ast.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/ast.h b/include/ast.h index fb0f275..05bb6ee 100644 --- a/include/ast.h +++ b/include/ast.h @@ -5,6 +5,7 @@ #include "std/buffer.h" #include "std/misc.h" #include "std/scoped_allocator.h" +#include "binop_type.h" typedef struct FunctionDecl FunctionDecl; typedef struct FunctionCall FunctionCall; @@ -13,6 +14,7 @@ typedef struct Import Import; typedef struct String String; typedef struct Variable Variable; typedef struct Number Number; +typedef struct Binop Binop; typedef union { FunctionDecl *func_decl; @@ -22,6 +24,7 @@ typedef union { String *string; Number *number; Variable *variable; + Binop *binop; } AstValue; typedef enum { @@ -32,7 +35,8 @@ typedef enum { AST_IMPORT, AST_STRING, AST_NUMBER, - AST_VARIABLE + AST_VARIABLE, + AST_BINOP } AstType; typedef struct { @@ -52,6 +56,7 @@ struct FunctionCall { struct LhsExpr { int isConst; + BufferView type_name; BufferView var_name; Ast rhs_expr; }; @@ -76,6 +81,12 @@ struct Variable { BufferView name; }; +struct Binop { + Ast lhs; + Ast rhs; + BinopType type; +}; + Ast ast_none(); CHECK_RESULT int funcdecl_init(FunctionDecl *self, ScopedAllocator *allocator); @@ -85,5 +96,6 @@ void lhsexpr_init(LhsExpr *self, int isConst, BufferView var_name); void import_init(Import *self, BufferView path); CHECK_RESULT int string_init(String *self, BufferView str); void number_init(Number *self, i64 value, bool is_integer); +void binop_init(Binop *self); #endif |