{"id":21938416,"url":"https://github.com/l-applin/rept","last_synced_at":"2025-10-14T22:37:18.386Z","repository":{"id":117901334,"uuid":"134657395","full_name":"L-Applin/rept","owner":"L-Applin","description":"Repeat langage Interpreter","archived":false,"fork":false,"pushed_at":"2018-05-29T12:48:59.000Z","size":142,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-25T08:45:44.241Z","etag":null,"topics":["backus-naur-form","grammar-parser","interpreter","ply"],"latest_commit_sha":null,"homepage":"","language":"Python","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/L-Applin.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-24T03:41:05.000Z","updated_at":"2018-05-29T12:49:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"0886a1cb-b917-4503-ae80-633bb808aa6e","html_url":"https://github.com/L-Applin/rept","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/L-Applin/rept","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L-Applin%2Frept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L-Applin%2Frept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L-Applin%2Frept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L-Applin%2Frept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/L-Applin","download_url":"https://codeload.github.com/L-Applin/rept/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L-Applin%2Frept/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021780,"owners_count":26087056,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["backus-naur-form","grammar-parser","interpreter","ply"],"created_at":"2024-11-29T01:30:53.377Z","updated_at":"2025-10-14T22:37:18.337Z","avatar_url":"https://github.com/L-Applin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PYTHON Interpreter for \"REPEAT\" langage\n\nNote : this is a personal project that I'm doing for fun and learning. Don't expect any commitement from my part or regular updates or anything of such. If you would like more information about the project, contact me personnaly.\n\n## Description\n\n*Repeat* is a pseudo-programing languge invented by [Alain Tapp][alain tapp] for our \n[Introduction à l'informatique théorique][info theo] (Introduction to Theoretical computer science) at [University of Montreal][udem]. As a challenge I decided I would try to implement an interpreter of the langage using Python.\n\n### The langage\n*Repeat* is a very simple, very contrived and very limited \"programming langage\". I made some very slight modification to the syntax Mr Tapp used in his class but everything else is exactly the same. First, the langage has an infinite amount of registers that it can use to store an integer (the integer can be as large as it needs). Second, it has a few operations that can be made on those register : \n\n1. Increment the value stored in a register : `inc r0`\n2. Move the value from one register to another : `r1 \u003c- r2`. It is also possible to directly put a value inside a register : `r0 \u003c- 1024`\n3. Repeat a block of commands by the amount of a register : `repeat r4 \u003clist of commands to repeat\u003e`\n4. It also has the ability to define *non-recursive* macro to make the code more readable :\n``` text\nDEFINE-MACRO macro_id \u003clist of identifiers\u003e \n    \u003cblock of commands for the macro\u003e\nend\n\nr0 \u003c- macro_id \u003clist of registers to use for the macro\u003e\n    \u003cthat line will execute all commands writen within the macro block with the specified registers\u003e\n\n```\nThat's it.\n\n\n### Grammar\nHere is the grammar I came up with for the *Repeat* langage\n\n``` grammar\nGRAMMAR                                            ACTIONS \u0026 INFO\n---------------------------------------------      ------------------------------------------------------\n\u003cprog\u003e      ::=    \u003cexpr\u003e | \u003cexpr\u003e \u003cprog\u003e          A program is a list of expressions\n\u003cexpr\u003e      ::=    \u003ccmd\u003e | \u003cmac\u003e                   An expr is either a command or a macro definition\n\u003ccmd\u003e       ::=    \u003cincr\u003e                          There are four different types of commands\n                    | \u003cmv\u003e\n                    | \u003crpt\u003e\n                    | \u003cmac\u003e\n\n\u003cincr\u003e      ::=    INC REG                         reg[REG.val] = reg[REG.val] + 1\n\u003cmv\u003e        ::=    REG MOVE (REG | INT)            reg[REG\u003c1\u003e.val] = reg[REG\u003c2\u003e.val]\n\u003crpt\u003e       ::=    REPEAT REG \u003cbody\u003e               repeats all commands in body for REG.val times\n\n\u003cbody\u003e      ::=    \u003cinnerbody\u003e END                 \n\u003cinnerbody\u003e ::=    \u003ccmd\u003e | \u003ccmd\u003e \u003cinnerbody\u003e       \n\n\u003cmac\u003e       ::=    REG MOVE ID \u003creglist\u003e           execute all commands within matchin f macro definition\n\u003cmacdef\u003e    ::=    DEF ID \u003creglist\u003e \u003cbody\u003e         define all actions to be done upon calling macro\n\u003creglist\u003e   ::=    REG | REG \u003creglist\u003e             \n\n```\n\n### Parsing\nFor parsing the .repeat file, I choose to go with the pyhton library [PLY][ply]. This is a robust a classic library to work easily with BNF Grammar syntax. [Documentation][ply doc] for the library can be found by following the link.\n\n### TODO:\nMacros\n\n[info theo]: https://sites.google.com/site/dirotappift2105/\n[alain tapp]: http://diro.umontreal.ca/repertoire-departement/vue/tapp-alain/\n[udem]: http://www.umontreal.ca/\n[ply]: http://www.dabeaz.com/ply/\n[ply doc]: http://www.dabeaz.com/ply/ply.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl-applin%2Frept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl-applin%2Frept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl-applin%2Frept/lists"}