Skip to content

illker/monty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

The Monty language

0x19. C - Stacks, Queues - LIFO, FIFO

Cover of Monty

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.

Description

This project is a about:

  • 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

Monty byte code files

Files containing Monty byte codes usually have the .m extension. Most of the industry uses this standard but it is not required by the specification of the language. There is not more than one instruction per line. There can be any number of spaces before or after the opcode and its argument

~/monty$ cat -e bytecodes/000.m
push 0$
push 1$
push 2$
  push 3$
                   pall    $
push 4$
    push 5    $
      push    6        $
pall$
~/monty$

Usage

Compilation & Output

Your code will be compiled this way

$ gcc -Wall -Werror -Wextra -pedantic *.c -o monty

Usage: monty file

Example Example of Use monty

~/monty$ cat bytecodes/09.m 
push 1
push 2
push 3
pall
swap
pall
~/monty$ ./monty bytecodes/09.m 
3
2
1
2
3
1
~/monty$ 

Monty Bytecode Commands

push <int> : The opcode push pushes an element to the stack.

flowcharts

Main flowchart

Authors

authors

About

Project Stacks, Queues - LIFO, FIFO πŸ”πŸ—οΈπŸ”‹ Monty byte code files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors