aboutsummaryrefslogtreecommitdiff
path: root/include/ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ast.h')
-rw-r--r--include/ast.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/include/ast.h b/include/ast.h
index 529b3c8..fb0f275 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -10,12 +10,18 @@ typedef struct FunctionDecl FunctionDecl;
typedef struct FunctionCall FunctionCall;
typedef struct LhsExpr LhsExpr;
typedef struct Import Import;
+typedef struct String String;
+typedef struct Variable Variable;
+typedef struct Number Number;
typedef union {
FunctionDecl *func_decl;
FunctionCall *func_call;
LhsExpr *lhs_expr;
Import *import;
+ String *string;
+ Number *number;
+ Variable *variable;
} AstValue;
typedef enum {
@@ -23,7 +29,10 @@ typedef enum {
AST_FUNCTION_DECL,
AST_FUNCTION_CALL,
AST_LHS,
- AST_IMPORT
+ AST_IMPORT,
+ AST_STRING,
+ AST_NUMBER,
+ AST_VARIABLE
} AstType;
typedef struct {
@@ -38,6 +47,7 @@ struct FunctionDecl {
struct FunctionCall {
BufferView name;
+ Buffer args;
};
struct LhsExpr {
@@ -50,15 +60,30 @@ struct Import {
BufferView path;
};
+struct String {
+ BufferView str;
+};
+
+struct Number {
+ union {
+ i64 integer;
+ f64 floating;
+ } value;
+ bool is_integer;
+};
+
+struct Variable {
+ BufferView name;
+};
+
Ast ast_none();
CHECK_RESULT int funcdecl_init(FunctionDecl *self, ScopedAllocator *allocator);
CHECK_RESULT int funcdecl_add_to_body(FunctionDecl *self, Ast ast);
-
-void funccall_init(FunctionCall *self, BufferView name);
-
+CHECK_RESULT int funccall_init(FunctionCall *self, BufferView name, ScopedAllocator *allocator);
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);
#endif