Restructuring

This commit is contained in:
Krzosa Karol
2022-09-29 13:02:32 +02:00
parent cbf6ca8480
commit 65924967aa
5 changed files with 62 additions and 223 deletions

View File

@@ -4,8 +4,6 @@ struct Ast_File_Namespace;
struct Ast_File;
struct Ast_Module;
struct Ast_Type;
function Ast_Module *ast_module(Token *pos, Intern_String filename);
function void insert_builtin_types_into_scope(Ast_Scope *p);
enum Token_Kind{
TK_End,
@@ -155,30 +153,6 @@ struct Lexer{
// Parser::ast_arena - arena for asts
// Lexer::interns::string_allocator - arena for interns
//
Intern_String keyword_struct;
Intern_String keyword_union;
Intern_String keyword_return;
Intern_String keyword_if;
Intern_String keyword_else;
Intern_String keyword_true;
Intern_String keyword_false;
Intern_String keyword_for;
Intern_String keyword_pass;
Intern_String keyword_default;
Intern_String keyword_switch;
Intern_String keyword_break;
Intern_String keyword_elif;
Intern_String keyword_assert;
Intern_String keyword_enum;
Intern_String intern_sizeof;
Intern_String intern_alignof;
Intern_String intern_lengthof;
Intern_String intern_void;
Intern_String intern_foreign;
Intern_String intern_it;
Intern_String intern_strict;
Intern_String intern_flag;
struct Parse_Ctx:Lexer{
Allocator *perm; // Stores: AST, tokens, interns
@@ -212,9 +186,9 @@ struct Parse_Ctx:Lexer{
String_Builder gen;
String_Builder helper_builder;
};
thread_local Parse_Ctx *pctx;
global B32 emit_line_directives;
function void init_type();
function void lex_init(Allocator *token_string_arena, Allocator *map_allocator, Lexer *l);
function String compile_to_c_code();
function String compile_to_c_code();
function Ast_Module *ast_module(Token *pos, Intern_String filename);
function void insert_builtin_types_into_scope(Ast_Scope *p);