diff options
| author | Mel <mel@rnrd.eu> | 2025-03-14 22:48:06 +0100 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2025-03-14 22:48:06 +0100 |
| commit | 0a3bcb4ab7c5884e9ad6bb47b05c9a8231395c93 (patch) | |
| tree | 1a40d808d1a877f32d101c9913727de3090d5e48 /boot/catboot.c | |
| parent | 742cc47bfbe67806f80bf4e821476b5efff9a9f6 (diff) | |
| download | catskill-0a3bcb4ab7c5884e9ad6bb47b05c9a8231395c93.tar.zst catskill-0a3bcb4ab7c5884e9ad6bb47b05c9a8231395c93.zip | |
Bootstrapping lexer
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/catboot.c')
| -rw-r--r-- | boot/catboot.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/boot/catboot.c b/boot/catboot.c index 56aaeb6..e47d4b9 100644 --- a/boot/catboot.c +++ b/boot/catboot.c @@ -21,6 +21,7 @@ #include <sys/stat.h> #include "common.c" +#include "lex.c" const ascii* read_file(const ascii* path) @@ -47,9 +48,18 @@ main(const int32 argc, const ascii* argv[]) return EXIT_FAILURE; } const ascii* file_path = argv[1]; - const ascii* source = read_file(file_path); - printf("%s", source); + const ascii* source_buffer = read_file(file_path); + struct String source = string_from_static_c_string(source_buffer); + + struct Lexer lexer; + lexer_new(&lexer, source); + + struct Token token; + do { + token = lexer_next(&lexer); + printf("%s ", token_kind_to_string(token.kind)); + } while (token.kind != TOKEN_END_OF_FILE); return EXIT_SUCCESS; } |
