aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-30 02:15:04 +0200
committerhachem <im@hachem.wtf>2026-08-30 02:15:04 +0200
commit8fd64902c7752a9607974b093cd1946bc5ff79d6 (patch)
tree36d0274b2b45bae3d1201da0f5c045161873ddcd /src/main.c
parentd235876f94f84dca15520a20bb476b916b927afb (diff)
add: start basic work on the lexer
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 1d97acb..9a9dae4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;