This project will interpret a monty bytecode file using C, and execute specific functionalities based on the bytecodes passed into the .m file.
Monty 0.98 is a scripting language that is first compiled into Monty byte codes (Just like Python). It relies on a unique stack, with specific instructions to manipulate it. The goal of this project is to create an interpreter for Monty ByteCodes files.
Files are compiled using gcc -Wall -Werror -Wextra -pedantic *.c -o monty
- test.m
./monty test.m
* struct stack_s - doubly linked list representation of a stack (or queue)
* @n: integer
* @prev: points to the previous element of the stack (or queue)
* @next: points to the next element of the stack (or queue)
*
* Description: doubly linked list node structure
* for stack, queues, LIFO, FIFO Holberton project
*/
typedef struct stack_s
{
int n;
struct stack_s *prev;
struct stack_s *next;
} stack_t;
* struct instruction_s - opcoode and its function
* @opcode: the opcode
* @f: function to handle the opcode
*
* Description: opcode and its function
* for stack, queues, LIFO, FIFO Holberton project
*/
typedef struct instruction_s
{
char *opcode;
void (*f)(stack_t **stack, unsigned int line_number);
} instruction_t;
push <int>
- pushes an integer onto the stackpall
- prints all data inside stackpint
- prints data at top of stackpop
- deletes a node on stackpchar
- prints char at top of stackpstr
- prints string at top of stackadd
- add two integers at top of stacksub
- subtracts two integers at top of stackdiv
- divides two integers at top of stackmul
- multiplies two integers at top of stackmod
- returns remainder of divisions between two integers at top of stack
- Jared Heck
- Kevin Pak