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

8
lex.h
View File

@@ -1,4 +1,7 @@
#pragma once
typedef struct Intern_String{
String s;
}Intern_String;
typedef enum Token_Kind{
meta("End of stream")TK_End,
@@ -59,6 +62,7 @@ typedef enum Token_Kind{
TK_Identifier,
TK_StringLit,
TK_U8Lit,
TK_Character,
TK_Error,
TK_Float,
TK_Int,
@@ -77,6 +81,7 @@ typedef struct Token{
union {
S64 int_val;
String error_val;
Intern_String intern_val;
};
String file;
@@ -88,6 +93,7 @@ typedef struct Tokens{
Token *tokens;
S64 len;
S64 cap;
S64 iter;
}Tokens;
typedef struct Lex_Stream{
@@ -105,6 +111,8 @@ global String token_kind_string[] = {
[TK_Error] = lit("Error"),
[TK_Comment] = lit("Comment"),
[TK_Identifier] = lit("Identifier"),
[TK_Keyword] = lit("Keyword"),
[TK_Character] = lit("Character"),
[TK_StringLit] = lit("StringLiteral"),
[TK_U8Lit] = lit("U8Literal"),
[TK_Float] = lit("Float"),