summaryrefslogtreecommitdiff
path: root/src/interpreter.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/interpreter.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/interpreter.c b/src/interpreter.c
index 2f9ae76..7255a4c 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -52,6 +52,20 @@ static void recurse_program(Program* program, Tape* tape) {
next:
program_next(program, &s);
+ // printf("[");
+ // for(uint32_t i = 0; i < tape->len; i++) {
+ // printf("0x%02x ", tape->data[i]);
+ // }
+ // printf("\b]\n ");
+ // for(uint32_t i = 0; i < tape->len; i++) {
+ // if (i == tape->index) {
+ // printf(" ^ ");
+ // } else {
+ // printf(" ");
+ // }
+ // }
+ // printf(" \ + tape->indexn");
+
switch (s) {
case MoveLeft:
tape_left(tape);
@@ -85,7 +99,7 @@ next:
case Allocate: {
uint8_t len = tape_get(tape);
Tape* new = malloc(sizeof(Tape));
- tape_init(len, tape);
+ tape_init(len, new);
void* ptr = (void*) tape_ptr(tape);
memcpy(ptr, &new, sizeof(Tape*));
break;