From b14a89efd3359aa5a0169b74333694ea653ceee2 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 16 Jul 2021 16:56:07 -0400 Subject: [PATCH] minor cleanup and update of TODO list --- cerise/TODO.md | 16 ++++++++-------- cerise/src/ast.c | 1 + cerise/src/sym.c | 7 +++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cerise/TODO.md b/cerise/TODO.md index ec0cbf3..d793b78 100644 --- a/cerise/TODO.md +++ b/cerise/TODO.md @@ -1,19 +1,18 @@ # Doing -* Fix array access in structs +* Implement symbol file generation and import # Up Next -* Implement symbol file generation and import -* Implement module scoped identifiers -* Implement an SSA backend -* Implement pointers - * Ownership semantics: Ownership you can count on - * Concurrency: Biased reference counting +* Linearize the AST expression nodes +* Split the AST into basic blocks ala CFG representation +* Convert the CFG representation to SSA form # Backlog -* Cleanup the lexer +* Implement pointers + * Ownership semantics: Ownership you can count on + * Concurrency: Biased reference counting * Implement record extension * Implement logical operators: and, or, not * Implement string types @@ -21,6 +20,7 @@ * Track uninitialized variables/globals * Nested procedure definitions * check that module name matches filename +* Cleanup the lexer (and cruft in the rest of the code base) # Order of Operations for Implementing Memory Management diff --git a/cerise/src/ast.c b/cerise/src/ast.c index 51760aa..14defd4 100644 --- a/cerise/src/ast.c +++ b/cerise/src/ast.c @@ -32,6 +32,7 @@ typedef struct { double f; char* s; } val; + long long tag; } AstValue; bool ast_isconst(AstNode* node) diff --git a/cerise/src/sym.c b/cerise/src/sym.c index 687f406..df1bedd 100644 --- a/cerise/src/sym.c +++ b/cerise/src/sym.c @@ -4,6 +4,9 @@ /* TODO: module names should be shadowable but are not */ +/* Symbol Table Management + *****************************************************************************/ + static int sym_matches(Parser* p, int class, size_t module, char* name, Symbol* sym) { int mod_match = (sym->module == module); @@ -181,7 +184,7 @@ void symbol_export(Parser* p, char* path) (void)path; for (size_t i = 0; i < p->ntypes; i++) { - printf("t %d %c\n", i, TypeIdents[p->types[i]->form]); + printf("t %ld %c\n", i, TypeIdents[p->types[i]->form]); } for (size_t i = 0; i < p->nsyms; i++) @@ -190,7 +193,7 @@ void symbol_export(Parser* p, char* path) if (!sym->export) continue; printf("%c %s ", SymTypes[sym->class], sym->name); fflush(stdout); - printf("%d\n", typeid(p, sym->type)); + printf("%ld\n", typeid(p, sym->type)); } } -- 2.49.0