The main function will now write out the output of the parser.
This commit is contained in:
+18
-11
@@ -1,3 +1,4 @@
|
||||
#include <bits/types/FILE.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -21,22 +22,28 @@ int main(int argc, char* args[]) {
|
||||
|
||||
List* list = GenerateTokenList(source_code);
|
||||
|
||||
for(int i = 0; i < list->size; i++) {
|
||||
Token* t = (Token*) list->content[i];
|
||||
// for(int i = 0; i < list->size; i++) {
|
||||
// Token* t = (Token*) list->content[i];
|
||||
|
||||
if (t->type == LineEnd) {
|
||||
if (i - 1 >= 0 && ((Token*) list->content[i - 1])->type != LineEnd)
|
||||
printf("\n");
|
||||
// if (t->type == LineEnd) {
|
||||
// if (i - 1 >= 0 && ((Token*) list->content[i - 1])->type != LineEnd)
|
||||
// printf("\n");
|
||||
|
||||
continue;
|
||||
}
|
||||
// continue;
|
||||
// }
|
||||
|
||||
printf("[T: %i][C: %i] '%s' ", t->type, t->token_class, t->lexeme);
|
||||
if (t->type == LABEL) printf("* ");
|
||||
}
|
||||
// printf("[T: %i][C: %i] '%s' ", t->type, t->token_class, t->lexeme);
|
||||
// if (t->type == LABEL) printf("* ");
|
||||
// }
|
||||
|
||||
unsigned char* image = ParseTokens(list);
|
||||
Disassemble(image);
|
||||
//Disassemble(image);
|
||||
|
||||
FILE* program = fopen("program.bin", "w+b");
|
||||
|
||||
fwrite(image, 1, image[2] + image[3], program);
|
||||
|
||||
fclose(program);
|
||||
|
||||
free(source_code);
|
||||
}
|
||||
Reference in New Issue
Block a user