Add Core compiler interface

This commit is contained in:
Krzosa Karol
2022-12-31 14:47:47 +01:00
parent 673db72e29
commit 23db7cc5c4
13 changed files with 607 additions and 2373 deletions

View File

@@ -1,11 +1,5 @@
struct Operator_Info{
Intern_String op;
String name;
Token_Kind op_kind;
bool valid_binary_expr;
bool valid_unary_expr;
};
/*#import meta
@@ -40,7 +34,7 @@ print(" return 0;\n}")
*/
Operator_Info op_info_table[] = {
Ast_Operator_Info op_info_table[] = {
{{}, "MUL"_s, TK_Mul, 1, 0},
{{}, "DIV"_s, TK_Div, 1, 0},
{{}, "MOD"_s, TK_Mod, 1, 0},
@@ -62,7 +56,7 @@ Operator_Info op_info_table[] = {
{{}, "NEG"_s, TK_Neg, 0, 1},
{{}, "NOT"_s, TK_Not, 0, 1},
};
CORE_Static Operator_Info *
CORE_Static Ast_Operator_Info *
get_operator_info(Token_Kind op){
switch(op){
case TK_Mul: return op_info_table + 0;
@@ -89,7 +83,7 @@ get_operator_info(Token_Kind op){
}
return 0;
}
CORE_Static Operator_Info *
CORE_Static Ast_Operator_Info *
get_operator_info(Intern_String op){
if(0){}
else if(op_info_table[0].op.str == op.str) return op_info_table + 0;