Created a tokenizer and the supporting code, currently processes text that is not a string literal.

This commit is contained in:
2025-01-07 23:52:03 -06:00
parent 2c85077031
commit 7e70c6fd19
10 changed files with 351 additions and 12 deletions
+19 -1
View File
@@ -1,10 +1,13 @@
#include <stdio.h>
#include "../includes/futil.h"
#include "../includes/tokenizer.h"
int main(int argc, char** argv) {
char* file;
size_t count;
//gcc -o test src/main.c src/futil.c src/dictionary.c src/tokenizer.c src/token.c src/array.c -g
if (argc <= 1) {
printf("Usage: assm <file.asm>\n");
@@ -17,5 +20,20 @@ int main(int argc, char** argv) {
return 1;
}
printf(file);
Dictionary* variables = DictionaryCreate();
Array* tokens = Tokenize(file, &variables);
if (tokens->Size == 0) {
printf("No tokens\n");
return 0;
}
else printf("Found %d tokens.", tokens->Size);
for(int i = 0; i < tokens->Size; i++) {
Token* token = tokens->Items[i];
printf(TokenStringify(token, false));
}
}