Giter Site home page Giter Site logo

holbertonschool-monty's Introduction

Design sans titre (1)

Monty Language Interpreter

This is an interpreter for the Monty programming language.

Details

  • Each Monty bytecode command is implemented as a separate function.
  • The main function reads a Monty bytecode from a file and execute it accordingly.
Requirements
Language C
OS Ubuntu 20.04 LTS
Compiler gcc
Style guidelines Betty style
Editors vi, vim, emacs

Files ๐Ÿ“‚

  • monty.h: Header file containing function prototypes, data structures, and necessary includes.
  • main_monty.c: Main file with the main function for Monty interpreter execution.
  • run_instructions.c: Executes Monty bytecode instructions based on parameters.
  • push_op.c: Implements the push command
  • pall_op.c: Implements the pall command
  • pint_op.c: Implements the pint command
  • pop_op.c: Implements the pop command
  • nop_op.c: Implements the nop command
  • swap_op.c: Implements the swap command
  • add_op.c: Implements the add command
  • sub_op.c: Implements the sub command
  • mod_op.c: Implements the mod command
  • div_op.c: Implements the div command
  • mul_op.c: Implements the mul command

Compilation

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

Execution

Run the interpreter with a Monty bytecode file as an argument:

./monty bytecodes/file.m

Example of use

~/holbertonschool-monty# cat bytecodes/00.m
push 1
push 2
push 3
pall
~/holbertonschool-monty# ./monty bytecodes/00.m
3
2
1

Monty Bytecode Commands ๐Ÿ

=========================================

Command Description
push Pushes an integer onto the stack.
pall Prints all the values on the stack, starting from the top.
pint Prints the value at the top of the stack.
pop Removes the top element of the stack.
nop Does nothing.
swap Swaps the top two elements of the stack.
sub subtracts top element of the stack from the second top element of the stack
mul multiplies second top element of the stack with top element of the stack
mod Adds the top two elements of the stack.
div computes remainder of division, second top by top stack element.

Authors

  • Chloe Correia
  • Clement Mascret

holbertonschool-monty's People

Contributors

chloe0524 avatar

Stargazers

 avatar Nidigashan Kanagendran avatar  avatar  avatar  avatar Teddy.D avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.