diff options
| author | hachem <im@hachem.wtf> | 2026-08-30 02:15:04 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-30 02:15:04 +0200 |
| commit | 8fd64902c7752a9607974b093cd1946bc5ff79d6 (patch) | |
| tree | 36d0274b2b45bae3d1201da0f5c045161873ddcd /src/main.c | |
| parent | d235876f94f84dca15520a20bb476b916b927afb (diff) | |
add: start basic work on the lexer
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -2,6 +2,7 @@ #include "io/file.h" #include "cli/args.h" +#include "lexer/lexer.h" int main(int argc, char** argv) { @@ -17,7 +18,15 @@ int main(int argc, char** argv) if (!read_file(args.input_path, &source)) return 1; - printf("read %zu bytes from %s\n", source.size, args.input_path); + struct Lexer lexer = create_lexer(source.data); + + for (;;) + { + struct Token token = scan_token(&lexer); + printf("%4u %-14s %.*s\n", token.line, token_type_name(token.type), (int)token.length, token.start); + if (token.type == TOKEN_EOF) + break; + } free_file(&source); return 0; |
