Files
corelang/program.kl
2022-06-07 09:56:19 +02:00

32 lines
567 B
Plaintext

#foreign do_something :: (val: U32)
Token :: struct
str: *U8
len: S64
is_numeric :: (c: U8): Bool
result := c >= '0 && c <= '9
return result
entry :: ()
string_to_lex := "Identifier 2425525 Not_Number"
token_array: [32]Token
token_count: U32
do_something(32)
t: Token
for i := 0, i < string_to_lex.len, i+=1
if is_numeric(string_to_lex.str[i])
t.str = &string_to_lex.str[i]
t.len = i
for is_numeric(string_to_lex.str[i])
i+=1
t.len = i - t.len
token_array[token_count++] = t
token_count+=1