GithubHelp home page GithubHelp logo

matsadura / monty Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 115 KB

A collaborative project between Radouane ABOUNOUAS & Zidane ZAOUI focused on creating an interpreter for the Monty Language.

C 94.58% Brainfuck 5.42%

monty's Introduction

Monty Project

This project involves creating an interpreter for Monty ByteCodes files, which are scripts written in the Monty scripting language. The interpreter operates on a unique stack with specific instructions to manipulate it.

Learning Objectives

By completing this project, we gained knowledge and understanding of the following concepts:

General

  • LIFO and FIFO: The meaning of Last In, First Out (LIFO) and First In, First Out (FIFO) principles.
  • Stacks and Queues: What a stack and a queue are and when to use each data structure.
  • Implementations: Common implementations of stacks and queues.
  • Use Cases: The most common use cases of stacks and queues.
  • Global Variables: The proper way to use global variables.

Programming Skills

  • C Programming: Implementing functionalities in the C programming language.
  • Header Files: Organizing the code with header files, including prototypes for functions.
  • Coding Style: Following the Betty style guidelines for clean and readable code.
  • Memory Management: Utilizing malloc and free for dynamic memory allocation.
  • GitHub Usage: Managing the code in a GitHub repository, ensuring compliance with project rules.

Project Structure

The project consists of multiple tasks, each involving the implementation of specific Monty ByteCode opcodes. The tasks are as follows:

  1. push, pall: Implement the push opcode to push elements onto the stack and the pall opcode to print all values on the stack.

  2. pint: Implement the pint opcode to print the value at the top of the stack.

  3. pop: Implement the pop opcode to remove the top element of the stack.

  4. swap: Implement the swap opcode to swap the top two elements of the stack.

  5. add: Implement the add opcode to add the top two elements of the stack.

  6. nop: Implement the nop opcode that does nothing.

  7. sub: Implement the sub opcode to subtract the top element from the second top element of the stack.

  8. div: Implement the div opcode to divide the second top element by the top element of the stack.

  9. mul: Implement the mul opcode to multiply the second top element with the top element of the stack.

  10. mod: Implement the mod opcode to compute the remainder of the division of the second top element by the top element of the stack.

  11. comments: Implement the capability to treat lines starting with # as comments.

  12. pchar: Implement the pchar opcode to print the character at the top of the stack.

  13. pstr: Implement the pstr opcode to print the string starting at the top of the stack.

  14. rotl: Implement the rotl opcode to rotate the stack to the top.

  15. rotr: Implement the rotr opcode to rotate the stack to the bottom.

  16. stack, queue: Implement the stack and queue opcodes to set the format of the data to either LIFO (stack) or FIFO (queue).

Compilation & Execution

  • Compile the code using the following command:

    $ gcc -Wall -Werror -Wextra -pedantic -std=c89 *.c -o monty
    
  • Execute the program with Monty ByteCode files:

    $ ./monty file
    

Authors

This project is a collaboration between : Radouane ABOUNOUAS & Zidane ZAOUI

More Projects

Printf Implementation

ALX Time Saver

Simple Shell

ALX Planning Tracker

monty's People

Contributors

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