Codegen basic arrays with size attached

This commit is contained in:
Krzosa Karol
2022-06-07 17:38:15 +02:00
parent ec89defb5d
commit 9cdc5ee6c9
7 changed files with 118 additions and 42 deletions

View File

@@ -58,23 +58,23 @@ Bool is_numeric(U8 c){
}
void entry(){
String string_to_lex = LIT("Identifier 2425525 Not_Number");
Token token_array[32];
Slice token_array = (Slice){32, (Token [32]){}};
S64 token_count = 0;
Token t;
for(S64 i = 0;(i<string_to_lex.len);(i+=1)){
for(S64 i = 0;(i<string_to_lex.len);i+=1){
if(is_numeric((string_to_lex.str[i]))){
(t.kind=0);
(t.str=(&(string_to_lex.str[i])));
(t.len=i);
t.kind=0;
t.str=(&(string_to_lex.str[i]));
t.len=i;
for(;is_numeric((string_to_lex.str[i]));){
(i+=1);
i+=1;
}
(t.len=(i-t.len));
((token_array[(token_count++)])=t);
t.len=(i-t.len);
(((Token *)token_array.data)[(token_count++)])=t;
}
}
for(S64 i = 0;(i<token_count);(i++)){
Token *tk = (&(token_array[i]));
Token *tk = (&(((Token *)token_array.data)[i]));
printf("%.*s", ((S32 )tk->len), tk->str);
}
}