diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a29be26 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +monty diff --git a/bytecodes/00.m b/bytecodes/00.m index bfe8e10..8f9715e 100644 --- a/bytecodes/00.m +++ b/bytecodes/00.m @@ -1,8 +1,4 @@ push 1 -push 2 +nop push 3 -push 8 pall -push 98 -push -12 -pallat diff --git a/bytecodes/04.m b/bytecodes/000.m similarity index 81% rename from bytecodes/04.m rename to bytecodes/000.m index 06c56ed..1e3d6b4 100644 --- a/bytecodes/04.m +++ b/bytecodes/000.m @@ -7,5 +7,3 @@ push 5 push 6 pall -push 99 -pint diff --git a/bytecodes/03.m b/bytecodes/001.m similarity index 67% rename from bytecodes/03.m rename to bytecodes/001.m index e29558a..ea0f8fb 100644 --- a/bytecodes/03.m +++ b/bytecodes/001.m @@ -1,3 +1,5 @@ +push 0 Push 0 onto the stack +push 1 Push 1 onto the stack push 2 push 3 @@ -9,4 +11,3 @@ push 5 push 6 -pall diff --git a/bytecodes/01.m b/bytecodes/06.m similarity index 100% rename from bytecodes/01.m rename to bytecodes/06.m diff --git a/bytecodes/09.m b/bytecodes/09.m index 057d601..aa1c979 100644 --- a/bytecodes/09.m +++ b/bytecodes/09.m @@ -1,4 +1,6 @@ push 1 +push 2 +push 3 pall swap pall diff --git a/bytecodes/19.m b/bytecodes/11.m similarity index 50% rename from bytecodes/19.m rename to bytecodes/11.m index adfb45a..63a8882 100644 --- a/bytecodes/19.m +++ b/bytecodes/11.m @@ -1,6 +1,6 @@ push 1 +push 20 push 2 -push 10 -push 3 -sub +pall +swap pall diff --git a/bytecodes/111.m b/bytecodes/111.m new file mode 100644 index 0000000..51ad32e --- /dev/null +++ b/bytecodes/111.m @@ -0,0 +1,3 @@ +nop +push 3 +pall diff --git a/bytecodes/2.m b/bytecodes/2.m new file mode 100644 index 0000000..f68f4d1 --- /dev/null +++ b/bytecodes/2.m @@ -0,0 +1,3 @@ +push -2147483648 +push 2147483647 +pall diff --git a/bytecodes/20.m b/bytecodes/20.m index 110a97d..9daeafb 100644 --- a/bytecodes/20.m +++ b/bytecodes/20.m @@ -1,5 +1 @@ -push 0 -push 10 -push 2 -mul -pall +test diff --git a/bytecodes/21.m b/bytecodes/21.m deleted file mode 100644 index 1c1746f..0000000 --- a/bytecodes/21.m +++ /dev/null @@ -1,3 +0,0 @@ -#push 2 -push 7 -pall diff --git a/bytecodes/31.m b/bytecodes/31.m deleted file mode 100644 index 8e37373..0000000 --- a/bytecodes/31.m +++ /dev/null @@ -1,14 +0,0 @@ -push 1 -push 2 -push 3 -push 4 -push 0 -push 110 -push 0 -push 108 -push 111 -push 111 -push 104 -push 99 -push 83 -pstr diff --git a/bytecodes/47.m b/bytecodes/47.m deleted file mode 100644 index b1f1d86..0000000 --- a/bytecodes/47.m +++ /dev/null @@ -1,16 +0,0 @@ -queue -push 1 -push 2 -push 3 -pall -stack -push 4 -push 5 -push 6 -pall -add -pall -queue -push 11111 -add -pall diff --git a/bytecodes/35.m b/bytecodes/rotr.m similarity index 58% rename from bytecodes/35.m rename to bytecodes/rotr.m index cc7723a..d084d06 100644 --- a/bytecodes/35.m +++ b/bytecodes/rotr.m @@ -3,11 +3,6 @@ push 3 push 4 push 5 -push 6 -push 7 -push 8 -push 9 -push 0 pall rotr pall diff --git a/main.c b/main.c index f2d6b02..f027406 100644 --- a/main.c +++ b/main.c @@ -59,16 +59,12 @@ void run_code(char *buf) line = 1; delim = "\n\t\v\r\a ;:"; token = strtok(buf, delim); - while (token) { if (is_push) { push(&stack, line, token); - line++; is_push = 0; - token = strtok(NULL, delim); - continue; } else if (strcmp(token, "push") == 0) { diff --git a/monty b/monty index 018e7e3..17dbd65 100755 Binary files a/monty and b/monty differ diff --git a/more_operations.c b/more_operations.c index a0b03a4..9f30d3a 100644 --- a/more_operations.c +++ b/more_operations.c @@ -50,9 +50,9 @@ void _add(stack_t **stack, unsigned int line_number) * @stack: stack * @line_number: line number */ -void nop(stack_t **stack __attribute__((unused)), unsigned int line_number __attribute__((unused))) +void nop(stack_t **stack __attribute__((unused)), unsigned int line_number) { - return; + (void)line_number; } /**