From 8ead876d90000c25e617cccbea37964e7431d717 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 18 Jun 2022 14:38:53 +0200 Subject: [PATCH] Before adding Any type --- compiler.h | 22 ++++++++++++---------- main.cpp | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/compiler.h b/compiler.h index 48237e5..b4aac45 100644 --- a/compiler.h +++ b/compiler.h @@ -186,11 +186,12 @@ struct Parse_Ctx:Lexer{ Map type_map; Ast_Module *builtins; + // Array files; Array modules; + Array ordered_decls; + Ast_Scope *currently_parsed_scope; Ast_File *currently_parsed_file; - Array ordered_decls; - Array c_backend_decls; S64 indent; String_Builder gen; @@ -235,14 +236,15 @@ lex_init(Allocator *token_string_arena, Allocator *map_allocator, Lexer *l){ function void parse_init(Parse_Ctx *ctx, Allocator *perm_allocator, Allocator *heap_allocator){ - pctx = ctx; - ctx->perm = perm_allocator; - ctx->heap = heap_allocator; - ctx->gen = {ctx->heap}; - ctx->ordered_decls = {ctx->heap}; - ctx->type_map = {ctx->heap}; - ctx->modules = {ctx->heap}; - bigint_allocator = ctx->perm; + pctx = ctx; + ctx->perm = perm_allocator; + ctx->heap = heap_allocator; + ctx->gen = {ctx->heap}; + ctx->ordered_decls = {ctx->heap}; + ctx->type_map = {ctx->heap}; + ctx->modules = {ctx->heap}; + // ctx->files = {ctx->heap}; + bigint_allocator = ctx->perm; arena_init(&ctx->stage_arena, "Compiler stage arena"_s); lex_init(ctx->perm, ctx->heap, ctx); diff --git a/main.cpp b/main.cpp index 498107c..f812643 100644 --- a/main.cpp +++ b/main.cpp @@ -42,10 +42,8 @@ want to export all the symbols, we can namespace them optionally. @todo [ ] - #test construct that would gather all tests and run them on start of program or something -[ ] - Error message when file not found [ ] - Foreign import that would link library [ ] - Builtin dynamic arrays -[ ] - Better error messages when type difference [ ] - Kilobyte, Megabyte, Gigabyte [ ] - Cast from array to pointer? [ ] - Mixing loads and imports leads to code duplication, is that what we want??? @@ -100,6 +98,8 @@ want to export all the symbols, we can namespace them optionally. [-] - Constants embeded in structs should be able to refer to other constants in that namespace without prefix [-] - Order independent constants in structs [-] - Fix recursive lambdas in structs +[x] - Error message when file not found +[x] - Better error messages when type difference [-] - Fixing access to functions/structs, in C we cant have functons inside of structs / functions so we need to rewrite the tree [x] - Emitting #line [x] - Making sure debugger works