Skip to content

The Monty Bytecode Interpreter reads and executes Monty bytecode files. Monty is a simple programming language that uses a stack data structure.

Notifications You must be signed in to change notification settings

khairatAA/monty

Repository files navigation

C - Stacks, Queues - LIFO, FIFO

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.

Table of Contents

Features

  • 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.

Getting Started

Prerequisites

  • A C compiler (e.g., GCC)

Installation

  1. Clone the repository:
git clone https://github.com/khairatAA/monty
  1. Compile the source code:
gcc -Wall -Werror -Wextra -pedantic -std=c89 *.c -o monty

Usage

Run the Monty interpreter with the following command:

./monty bytecode_file

Replace bytecode_file with the path to your Monty bytecode file.

Supported Opcodes

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

Examples

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

Contributors

This project was done by:

About

The Monty Bytecode Interpreter reads and executes Monty bytecode files. Monty is a simple programming language that uses a stack data structure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published