Updated compiler

This commit is contained in:
2022-11-26 06:58:38 +00:00
parent 4cf5c6a5bf
commit d199209772
4 changed files with 115 additions and 76 deletions

View File

@@ -19,6 +19,9 @@ TARGETS+=../source/ast_node.c
#parser
TARGETS+=../source/parser.c
#compiler
TARGETS+=../source/compiler.c
TESTS = $(wildcard test_*.c)
OBJ = $(addprefix $(ODIR)/,$(TARGETS:../source/%.c=%.o)) $(addprefix $(ODIR)/,$(TESTS:.c=.o))

View File

@@ -76,7 +76,7 @@ int main() {
//cleanup
FREE_ARRAY(unsigned char, bytecode, size);
freeNode(node);
freeASTNode(node);
freeParser(&parser);
freeCompiler(&compiler);
}
@@ -97,14 +97,14 @@ int main() {
ASTNode* node = scanParser(&parser);
while (node != NULL) {
if (node->type == AST_NODEERROR) {
if (node->type == AST_NODE_ERROR) {
fprintf(stderr, ERROR "ERROR: Error node found" RESET);
return -1;
}
//write
writeCompiler(&compiler, node);
freeNode(node);
freeASTNode(node);
node = scanParser(&parser);
}