In this project we are tasked to create an interpreter for Monty ByteCode files. These files will have commands per line to manipulate the data structure given.
What you should learn from this project:
- What do LIFO and FIFO mean.
- What is a stack, and when to use it.
- What is a queue, and when to use it.
- What are the common implementations of stacks and queues.
- What are the most common use cases of stacks and queues.
- What is the proper way to use global variables.
- How to work with git submodules.
- Contains the main function that takes in the file and runs the parser.
- Header file.
- Functions that parses the file from main, then parses the lines. While parsing, data is stored into structs to be passed onto other functions.
- Contains functions that checks arguments from lines of the file. Checks for if push function is in the file line.
- Our get operations function that matches the aruguments with what opcode function we need to run.
- Contains push, pall, free_stack, and nop.
- Contains pint, pop, swap, pchar, and pstr.
- Contains rotl, rotr, qpush.
- Contains add, sub, div, mul, mod.
- Contains stack and queue
- Implement the push and pall opcodes.
- The opcode push pushes an element to the stack.
- The opcode pall prints all the values on the stack, starting from the top of the stack.
- Implement the pint opcode.
- The opcode pint prints the value at the top of the stack, followed by a new line.
- Implement the pop opcode.
- The opcode pop removes the top element of the stack.
- Implement the swap opcode
- The opcode swap swaps the top two elements of the stack.
- Implement the add opcode.
- The opcode add adds the top two elements of the stack.
- Implement the nop opcode.
- The opcode nop doesn’t do anything.
- opcodes: sub, div, mul, mod, comments, pchar, pstr, rotl, rotr, stack, queue.