'end' of queue | |pall |print every member of the structure| | pint | prints the member value at the top of stack | | swap | swaps the order of the 1st and 2nd elements in stack | | add | add top two member values | | sub | subtract the top element from the 2nd top element | | div | divide the 2nd element by the top element | | mul | multiply the top two elements of the stack | | mod | the remainder when the 2nd element is divided by the top element | | comment | there is the ability to parse comments found in bytecode ->'#'| | pchar | print character at the top of the stack | | pstr | print the character at the top of the stack| | rotl | moves element at the top to the bottom of the stack | | rotr | the bottom of the stack becomes the top | | queue, stack | toggles the doubly link list implementation style | | nop | opcode should do nothing |
Examples:
$ cat opcodetestfile.m
push 1
push 2
push 3
pall
$ ./montyfile opcodetestfile.m
3
2
1
$
$ cat opcodetestfile.m
push 1
push 2
push 3
pall
rotl
pall
$ ./montyfile opcodetestfile.m
3
2
1
2
1
3
Exits with status EXIT_FAILURE
All files were compiled on Ubuntu 14.04 LTS.
All programs and functions were compiled with gcc 4.8.4
using flags -Wall -Werror -Wextra and -pedantic
.
All files have been written in the Betty Style.
Stanhope Arthur