Language actually gets properly stepped through using debugger!

This commit is contained in:
Krzosa Karol
2022-06-07 17:53:04 +02:00
parent 9cdc5ee6c9
commit c69d2b7fe2
3 changed files with 36 additions and 0 deletions

View File

@@ -35,7 +35,10 @@ int main(){
entry();
}
#line 0 "program.kl"
#line 1
#line 3
typedef struct Token{
U8 kind;
U8 *str;
@@ -44,37 +47,61 @@ typedef struct Token{
Number = 0,
};*/
}Token;
#line 12
String kind_name(U8 kind){
#line 15
if((kind==0)){
#line 14
return LIT("<Number>");
}
else{
#line 16
return LIT("<Unknown>");
}
}
#line 18
Bool is_numeric(U8 c){
#line 19
Bool result = ((c>=48)&&(c<=57));
#line 20
return result;
}
#line 22
void entry(){
#line 23
String string_to_lex = LIT("Identifier 2425525 Not_Number");
#line 24
Slice token_array = (Slice){32, (Token [32]){}};
#line 25
S64 token_count = 0;
#line 27
Token t;
#line 28
for(S64 i = 0;(i<string_to_lex.len);i+=1){
#line 29
if(is_numeric((string_to_lex.str[i]))){
#line 30
t.kind=0;
#line 31
t.str=(&(string_to_lex.str[i]));
#line 32
t.len=i;
#line 33
for(;is_numeric((string_to_lex.str[i]));){
#line 34
i+=1;
}
#line 35
t.len=(i-t.len);
#line 36
(((Token *)token_array.data)[(token_count++)])=t;
}
}
#line 38
for(S64 i = 0;(i<token_count);(i++)){
#line 39
Token *tk = (&(((Token *)token_array.data)[i]));
#line 40
printf("%.*s", ((S32 )tk->len), tk->str);
}
}