aboutsummaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/ast.c b/src/ast.c
index 1db114a..c28b314 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -1,4 +1,8 @@
#include "../include/ast.h"
+#include "../include/std/log.h"
+#include <assert.h>
+
+static void ast_resolve(Ast *self);
Ast ast_none() {
Ast ast;
@@ -51,6 +55,26 @@ int scope_init(Scope *self, ScopedAllocator *allocator) {
}
void scope_resolve(Scope *self) {
- /* TODO: Implement. Also use longjmp to jump back to compiler on error */
- (void)self;
-} \ No newline at end of file
+ Ast *ast;
+ Ast *ast_end;
+ ast = buffer_start(&self->ast_objects);
+ ast_end = buffer_end(&self->ast_objects);
+ for(; ast != ast_end; ++ast) {
+ ast_resolve(ast);
+ }
+}
+
+static void lhs_resolve(LhsExpr *self) {
+ amal_log_debug("Lhs resolve var name: %.*s", self->var_name.size, self->var_name.data);
+}
+
+void ast_resolve(Ast *self) {
+ switch(self->type) {
+ case AST_LHS:
+ lhs_resolve(self->value.lhs_expr);
+ break;
+ default:
+ assert(bool_false && "ast_resolve not implemented for type");
+ break;
+ }
+}