aboutsummaryrefslogtreecommitdiff
path: root/src/vm/runner/runner.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/runner/runner.c')
-rw-r--r--src/vm/runner/runner.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/vm/runner/runner.c b/src/vm/runner/runner.c
index 9836ad0..742ec16 100644
--- a/src/vm/runner/runner.c
+++ b/src/vm/runner/runner.c
@@ -4,8 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <utils/memory/memory.h>
-#include <utils/types.h>
const BuiltinFunction BUILTIN_FUNCTIONS[] = {
print,
@@ -26,6 +24,20 @@ bool runner(SourceCode *sourceCode) {
return false;
}
+bool runnerWithPrint(SourceCode *sourceCode) {
+ Instructions instructions = codeGeneratorWithPrint(sourceCode);
+ if (instructions.size != ERROR_SIZE) {
+ printf("----generated code:\n");
+ printInstructions(instructions);
+ printf("----running:\n");
+ bool ranSuccess = _runner(instructions);
+ deleteInstructions(instructions);
+ return ranSuccess;
+ }
+ fprintf(stderr,"error in code generator\n");
+ return false;
+}
+
bool _runner(Instructions instructions) {
size_t stack_size = 0;
void **stack = a404m_malloc(stack_size * sizeof(void *));