From: Michael D. Lowis Date: Wed, 12 May 2021 13:02:04 +0000 (-0400) Subject: minor cleanup X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b6e778c9810a55e81248ea34210519de2faec982;p=proto%2Fobnc.git minor cleanup --- diff --git a/cerise/src/grammar.c b/cerise/src/grammar.c index 2bbdf9b..bb1b57f 100644 --- a/cerise/src/grammar.c +++ b/cerise/src/grammar.c @@ -6,7 +6,6 @@ /* TODO * Implement logical operators: and, or, not - * Implement arrays and array access * Implement module scoped identifiers * Implement strings types * Implement records and record access @@ -357,28 +356,6 @@ RULE(statement_seq) { do { -// if (matches(p, IDENT)) -// { -// Item right = { 0 }; -// char* text = expect_text(p, IDENT); -// if (accept(p, '=')) -// { -// Symbol* sym = symbol_get(p, SYM_VAR, text); -// init_item(item, sym); -// item->imm.s = sym->name; -// -// expression(p, &right); -// check_types(p, item, &right); -// codegen_store(p, item, &right); -// } -// else -// { -// /* TODO: add function calls and other complex stuff */ -// error(p, "expected assignment"); -// } -// expect(p, ';'); -// } -// else if (matches(p, IF)) { expect(p, IF); @@ -430,7 +407,6 @@ RULE(var_decl) int nsyms = 0; Symbol* first = NULL; Symbol* sym = NULL; -// Symbol* type = NULL; char* name = NULL; bool export = false; @@ -449,9 +425,6 @@ RULE(var_decl) expect(p, ':'); type(p, &base_type); -// name = expect_text(p, IDENT); -// type = symbol_get(p, SYM_TYPE, name); - /* apply the type to the newly created symbols */ for (int i = 0; i < nsyms; i++) { diff --git a/cerise/src/type_checks.c b/cerise/src/type_checks.c index b7285d6..0038a39 100644 --- a/cerise/src/type_checks.c +++ b/cerise/src/type_checks.c @@ -86,6 +86,6 @@ void check_types(Parser* p, Item* a, Item* b) // } else { - error(p, "type mismatch"); + error(p, "unimplemented type check!"); } } diff --git a/cerise/tests/Module.m b/cerise/tests/Module.m index 7e69119..035f2c2 100644 --- a/cerise/tests/Module.m +++ b/cerise/tests/Module.m @@ -35,6 +35,7 @@ procedure Foo*(e : Int, z : Int) : Int # end begin +# e = q; c = 1; z = 2; return z;