diff --git a/ccodegen.cpp b/ccodegen.cpp index c5c4511..f1f21ec 100644 --- a/ccodegen.cpp +++ b/ccodegen.cpp @@ -221,7 +221,6 @@ gen_ast(Ast *ast){ CASE(PACKAGE, Package){ For(node->ordered) { - genln(""); genln(""); gen_ast(it); } diff --git a/main.cpp b/main.cpp index e64761e..18dc627 100644 --- a/main.cpp +++ b/main.cpp @@ -176,7 +176,7 @@ int main(){ String result = {}; -#if 0 +#if 1 result = compile_file("globals.kl"_s); printf("%s", result.str); result = compile_file("enums.kl"_s); diff --git a/new_parse.cpp b/new_parse.cpp index 88c75ed..4be9c4c 100644 --- a/new_parse.cpp +++ b/new_parse.cpp @@ -333,11 +333,12 @@ binding_power(Binding binding, Token_Kind kind){ else invalid_codepath; Prefix: switch(kind){ + case TK_OpenBracket: + return {-2, 22}; case TK_Increment: case TK_Decrement: case TK_Pointer: case TK_Dereference: - case TK_OpenBracket: case TK_Keyword: case TK_OpenParen: case TK_Sub: diff --git a/order2.kl b/order2.kl index 23446d1..47196cc 100644 --- a/order2.kl +++ b/order2.kl @@ -56,7 +56,7 @@ test_assignments :: () i >>= 2 i <<= 2 - i = i > 2 + boolean := i > 2 CONST :: 23 == 23 CONST_FLOAT :: 23.52 diff --git a/program.c b/program.c index 33b9c46..e84448b 100644 --- a/program.c +++ b/program.c @@ -31,8 +31,6 @@ int main(){ } - - typedef struct Token{ U8 kind; U8 *str; @@ -41,7 +39,6 @@ typedef struct Token{ Number = 0, };*/ }Token; - String kind_name(U8 kind){ if((kind==0)){ return LIT(""); @@ -50,12 +47,10 @@ String kind_name(U8 kind){ return LIT(""); } } - Bool is_numeric(U8 c){ Bool result = ((c>=48)&&(c<=57)); return result; } - void entry(){ String string_to_lex = LIT("Identifier 2425525 Not_Number"); Token token_array[32]; diff --git a/typecheck.cpp b/typecheck.cpp index a3c1f7c..638067d 100644 --- a/typecheck.cpp +++ b/typecheck.cpp @@ -349,12 +349,6 @@ resolve_typespec(Ast_Expr *ast, B32 ast_can_be_null){ return resolved.type_val; } -function void resolve_stmt(Ast *ast, Ast_Resolved_Type *ret); -function void -resolve_stmt_block(Ast_Block *block, Ast_Resolved_Type *ret){ - -} - // @note: Ret is return value of function passed down the stack // to check if type matches function void @@ -395,25 +389,24 @@ resolve_stmt(Ast *ast, Ast_Resolved_Type *ret){ } } - Scope(){ + S64 scope = scope_open(); resolve_expr(node->init, ret); resolve_expr(node->cond, ret); resolve_expr(node->iter, ret); For(node->block->stmts) resolve_stmt(it, ret); - } + scope_close(scope); BREAK(); } CASE(IF, If){ For(node->ifs){ resolve_stmt(it->init, ret); - Scope(){ + S64 scope = scope_open(); resolve_expr(it->expr); // @todo: typechecking - resolve_stmt_block(it->block, ret); For_It(it->block->stmts, jt) resolve_stmt(jt, ret); - } + scope_close(scope); } BREAK(); } diff --git a/typecheck.h b/typecheck.h index e977480..12fbbf0 100644 --- a/typecheck.h +++ b/typecheck.h @@ -72,8 +72,6 @@ scope_close(S64 local_sym_count){ pctx->local_syms.len = local_sym_count; } -#define Scope() for(S64 scope_index = scope_open(); scope_index; (scope_close(scope_index), scope_index=0)) - function void sym_associate(Ast *ast, Sym *sym){ assert(ast);