starting work on tokenizer for assembly language

This commit is contained in:
SpookyDervish
2025-12-21 05:47:15 +11:00
parent 03ea7bd418
commit b1ff26bcbb
6 changed files with 123 additions and 10 deletions

View File

@@ -1,19 +1,28 @@
#include "vmbl.h"
#include "asm/tokenize.h"
#include <stdio.h>
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]));
VMBL_Instruction program[] = {
MAKE_INST_PUSH(123),
MAKE_INST_PUSH(0),
MAKE_INST_PUSH(124),
MAKE_INST_PUSH(2),
MAKE_INST_DIV,
MAKE_INST_HALT
};
int main() {
VMBL_State vmblState = {};
//VMBL_State vmblState = {};
VMBL_LoadExecutable(&vmblState, program, sizeof(program));
VMBL_StartVM(&vmblState);
//VMBL_LoadExecutable(&vmblState, program, sizeof(program));
//VMBL_StartVM(&vmblState);
Tokenizer tokenizer = {
"push 1224\npush 2\ndiv\nhalt"
};
Token token = getCurrentToken(&tokenizer);
printf("%s\n", tokenTypeAsCStr(token.type));
return 0;
}