commit fd51bdc72f09644fdae4c3c3345798db6b18e1e1
parent bf9564c771eff730ef30017e842f63b549b112c7
Author: keyle <keyle@capsule.org>
Date: Sat, 9 May 2026 18:13:16 +1000
wip
Diffstat:
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/common.h b/src/common.h
@@ -58,3 +58,9 @@ typedef struct Token {
int line;
int col;
} Token;
+
+typedef struct Lexer {
+ Token* tokens;
+ int count;
+ int cap;
+} Lexer;
diff --git a/src/lexer.c b/src/lexer.c
@@ -1,6 +1,8 @@
+#include <stdio.h>
+#include <stdlib.h>
#include "lexer.h"
Token* lex(const char* code, const char* path, const char* filename) {
- Token* t = {};
- return t;
+ Token* tokens = calloc(250, sizeof(Token));
+ return tokens;
}
diff --git a/src/lexer.h b/src/lexer.h
@@ -2,4 +2,4 @@
#include "common.h"
-Token* lex(const char* code, const char* path, const char* filename);
+Lexer* lex(const char* code, const char* path, const char* filename);