The Monty Bytecode Interpreter is a program written in C programming language that reads and executes Monty bytecode files. Monty is a simple programming language that uses a stack data structure.
- Reads Monty bytecode files and executes the specified instructions.
- Supports various stack manipulation and arithmetic operations.
- Provides clear error messages for incorrect input or unexpected behavior.
- A C compiler (e.g., GCC)
- Clone the repository:
git clone https://github.com/khairatAA/monty
- Compile the source code:
gcc -Wall -Werror -Wextra -pedantic -std=c89 *.c -o monty
Run the Monty interpreter with the following command:
./monty bytecode_file
Replace bytecode_file
with the path to your Monty bytecode file.
The interpreter supports the following opcodes:
Opcodes | File |
---|---|
0. push | push.c |
1. pint | pint.c |
2. pop | pop.c |
3. swap | swap.c |
4. add | add.c |
5. nop | nop.c |
6. sub | sub.c |
7. div | div.c |
8. mul | mul.c |
9. mod | mod.c |
10. comments | hash.c |
11. pchar | pchar.c |
12. pstr | pstr.c |
13. rotl | rotl.c |
14. rotr | rotr.c |
15. stack, queue | SOON |
16. Brainfuck | 1000-school.bf |
17. Add two digits | 1001-add.bf |
18. push | push.c |
Here's an example Monty bytecode file that adds two numbers:
push 5
push 10
add
pall
When executed, the above bytecode will output: 15
This project was done by:
- Khairat Adesina khairatadesina01@gmail.com
- Joshua Oseghale aigbokhaebholojoshua@gmail.com Github: JentleJoe