Parsing exprs, enum_decls, Introduce intern table, symbol table

This commit is contained in:
Krzosa Karol
2022-04-29 11:22:10 +02:00
parent d462892e14
commit 9cbbb4d616
20 changed files with 1831 additions and 335 deletions

46
parser.h Normal file
View File

@@ -0,0 +1,46 @@
#pragma once
typedef struct Type Type;
typedef struct Parser_Error Parser_Error;
typedef enum Symbol_Kind{
SK_None,
SK_Type,
}Symbol_Kind;
typedef struct Symbol{
Symbol_Kind kind;
Intern_String string;
struct{
Type *type;
};
}Symbol;
struct Parser_Error{
Parser_Error *next;
String message;
Token *token;
};
typedef struct Parser{
Arena main_arena;
Arena intern_table_arena;
Arena symbol_table_arena;
Symbol *symbols;
S64 symbols_count;
Intern_String *interns;
S64 interns_count;
U8 *first_keyword;
U8 *last_keyword;
Parser_Error *first_error;
Parser_Error *last_error;
Tokens tokens;
}Parser;
function Intern_String intern_string(Parser *p, String string);
function void type_insert(Parser *p, Type *type, Intern_String string);