Generating meta data

This commit is contained in:
Krzosa Karol
2022-09-29 19:14:42 +02:00
parent 256eaf8640
commit 3601e83032
5 changed files with 248 additions and 78 deletions

View File

@@ -32,29 +32,45 @@ lex_init(Allocator *token_string_arena, Allocator *map_allocator, Lexer *l){
intern_flag = l->intern("flag"_s);
intern_it = l->intern("it"_s);
op_add = l->intern("+"_s);
op_mul = l->intern("*"_s);
op_div = l->intern("/"_s);
op_sub = l->intern("-"_s);
op_and = l->intern("&&"_s);
op_bitand = l->intern("&"_s);
op_or = l->intern("||"_s);
op_bitor = l->intern("|"_s);
op_xor = l->intern("^"_s);
op_equals = l->intern("=="_s);
op_not_equals = l->intern("!="_s);
op_lesser_then_or_equal = l->intern("<="_s);
op_greater_then_or_equal = l->intern(">="_s);
op_lesser_then = l->intern("<"_s);
op_greater_then = l->intern(">"_s);
op_left_shift = l->intern("<<"_s);
op_right_shift = l->intern(">>"_s);
op_not = l->intern("!"_s);
op_neg = l->intern("~"_s);
op_decrement = l->intern("--"_s);
op_increment = l->intern("++"_s);
l->first_op = op_add;
l->last_op = op_increment;
/*#
import meta
for i in meta.token_simple_expr:
if i[1] != "SPECIAL":
print("op_" + meta.pascal_to_snake(i[0]) + f' = l->intern("{i[1]}"_s);')
first = "op_" + meta.pascal_to_snake(meta.token_simple_expr[0][0])
last = "op_" + meta.pascal_to_snake(meta.token_simple_expr[-1][0])
print(f"l->first_op = {first}")
print(f"l->last_op = {last}")
*/
op_mul = l->intern("*"_s);
op_div = l->intern("/"_s);
op_mod = l->intern("%"_s);
op_left_shift = l->intern("<<"_s);
op_right_shift = l->intern(">>"_s);
op_add = l->intern("+"_s);
op_sub = l->intern("-"_s);
op_equals = l->intern("=="_s);
op_lesser_then_or_equal = l->intern("<="_s);
op_greater_then_or_equal = l->intern(">="_s);
op_lesser_then = l->intern("<"_s);
op_greater_then = l->intern(">"_s);
op_not_equals = l->intern("!="_s);
op_bit_and = l->intern("&"_s);
op_bit_or = l->intern("|"_s);
op_bit_xor = l->intern("^"_s);
op_and = l->intern("&&"_s);
op_or = l->intern("||"_s);
op_neg = l->intern("~"_s);
op_not = l->intern("!"_s);
op_decrement = l->intern("--"_s);
op_increment = l->intern("++"_s);
op_post_decrement = l->intern("--"_s);
op_post_increment = l->intern("++"_s);
l->first_op = op_mul
l->last_op = op_post_increment
/*END*/
}
function void