{"id":19079433,"url":"https://github.com/hackersa3edy/monty","last_synced_at":"2025-10-08T17:48:05.060Z","repository":{"id":209950127,"uuid":"719567599","full_name":"hackerSa3edy/monty","owner":"hackerSa3edy","description":"Monty Project | Month 3 | Sprint 2: This project is an interpreter for Monty ByteCodes files, written in C. It implements the concepts of a stack (LIFO - Last In, First Out) and a queue (FIFO - First In, First Out). The interpreter supports various commands such as push, pall, pint, pop, swap, add, nop, sub, div, mul, and more.","archived":false,"fork":false,"pushed_at":"2024-08-20T06:23:54.000Z","size":147,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-02T18:49:44.137Z","etag":null,"topics":["alx","alx-software-engineering","bytecode","c","c-language","c-programming","fifo","interpreter","lifo","monty","monty-bytecodes","queue","stack","valgrind"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackerSa3edy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-16T12:52:53.000Z","updated_at":"2024-08-20T06:37:11.000Z","dependencies_parsed_at":"2023-11-30T00:43:18.520Z","dependency_job_id":null,"html_url":"https://github.com/hackerSa3edy/monty","commit_stats":null,"previous_names":["hackersa3edy/monty"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackerSa3edy%2Fmonty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackerSa3edy%2Fmonty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackerSa3edy%2Fmonty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackerSa3edy%2Fmonty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackerSa3edy","download_url":"https://codeload.github.com/hackerSa3edy/monty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240131770,"owners_count":19752725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alx","alx-software-engineering","bytecode","c","c-language","c-programming","fifo","interpreter","lifo","monty","monty-bytecodes","queue","stack","valgrind"],"created_at":"2024-11-09T02:14:40.449Z","updated_at":"2025-10-08T17:48:00.025Z","avatar_url":"https://github.com/hackerSa3edy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project: 0x19. C - Stacks, Queues - LIFO, FIFO\n\nThis project is an interpreter for Monty ByteCodes files. It implements a stack (Last In, First Out) and a queue (First In, First Out) in C.\n\n## Learning Objectives\n\n- What do LIFO and FIFO mean\n- What is a stack, and when to use it\n- What is a queue, and when to use it\n- What are the common implementations of stacks and queues\n- What are the most common use cases of stacks and queues\n- What is the proper way to use global variables\n\n## Tasks\n\nEach task corresponds to a specific opcode implementation:\n\n| Task          | File                                   |\n| ------------- | -------------------------------------- |\n| 0. push, pall | [push.c](./push.c), [pall.c](./pall.c) |\n| 1. pint       | [pint.c](./pint.c)                     |\n| 2. pop        | [pop.c](./pop.c)                       |\n| 3. swap       | [swap.c](./swap.c)                     |\n| 4. add        | [add.c](./add.c)                       |\n| 5. nop        | [nop.c](./nop.c)                       |\n| 6. sub        | [sub.c](./sub.c)                       |\n| 7. div        | [div.c](./div.c)                       |\n| 8. mul        | [mul.c](./mul.c)                       |\n\n## Getting Started\n\nTo get a local copy up and running, follow these steps:\n\n1. Clone the repository:\n\n   ```sh\n   git clone https://github.com/hackerSa3edy/monty.git\n   ```\n\n2. Navigate to the project directory:\n\n   ```sh\n   cd monty\n   ```\n\n3. Compile the project:\n\n   ```sh\n   gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o monty\n   ```\n\n## Usage\n\nTo run the Monty interpreter, compile all .c files in the repository and run the output file with a .m file as an argument:\n\n```bash\ngcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o monty\n./monty bytecodes/00.m\n```\n\nThe .m files in the [bytecodes/](./bytecodes/) directory are test files in the Monty bytecodes format.\nTo run the interpreter, use the following command:\n\n```sh\n./monty \u003cfile.m\u003e\n```\n\nWhere `\u003cfile.m\u003e` is the path to a Monty bytecodes file.\n\n## Monty ByteCodes Files\n\nMonty bytecodes files contain a list of commands to be executed by the interpreter. Each command must be on its own line. Lines can be empty or contain a comment (lines starting with `#` are treated as comments).\n\n### Commands\n\nThe interpreter supports the following commands:\n\n- `push \u003cn\u003e`: Pushes an integer `\u003cn\u003e` onto the top of the stack.\n- `pall`: Prints all values on the stack.\n- `pint`: Prints the value at the top of the stack.\n- `pop`: Removes the top element of the stack.\n- `swap`: Swaps the top two elements of the stack.\n- `add`: Adds the top two elements of the stack.\n- `nop`: Does nothing.\n- `sub`: Subtracts the top element of the stack from the second top element.\n- `div`: Divides the second top element of the stack by the top element.\n- `mul`: Multiplies the top two elements of the stack.\n- `mod`: Computes the remainder of the division of the second top element by the top element.\n- `pchar`: Prints the char at the top of the stack.\n- `pstr`: Prints the string starting at the top of the stack.\n\n## Author\n\n- [Abdelrahman Mohamed](https://x.com/hackersa3edy)\n- Project Link: [https://github.com/hackerSa3edy/monty.git](https://github.com/hackerSa3edy/monty.git)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackersa3edy%2Fmonty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackersa3edy%2Fmonty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackersa3edy%2Fmonty/lists"}