{"id":16744832,"url":"https://github.com/marteinn/lua-interpreter-in-python","last_synced_at":"2025-04-10T13:42:12.147Z","repository":{"id":67213615,"uuid":"207380318","full_name":"marteinn/Lua-Interpreter-In-Python","owner":"marteinn","description":"A Lua interpreter written in python.","archived":false,"fork":false,"pushed_at":"2019-09-26T19:26:16.000Z","size":119,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T12:21:37.480Z","etag":null,"topics":["lua","mypy","python"],"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/marteinn.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":"2019-09-09T18:44:56.000Z","updated_at":"2024-11-19T15:09:04.000Z","dependencies_parsed_at":"2023-02-21T07:45:54.758Z","dependency_job_id":null,"html_url":"https://github.com/marteinn/Lua-Interpreter-In-Python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-Interpreter-In-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-Interpreter-In-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-Interpreter-In-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-Interpreter-In-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marteinn","download_url":"https://codeload.github.com/marteinn/Lua-Interpreter-In-Python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248226152,"owners_count":21068142,"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":["lua","mypy","python"],"created_at":"2024-10-13T01:44:14.249Z","updated_at":"2025-04-10T13:42:12.140Z","avatar_url":"https://github.com/marteinn.png","language":"Python","readme":"# Lua interpreter in Python\n\nThis is my second take on writing a Lua-To-Python compiler, it includes:\n\n- [x] Lexer\n- [x] Parser\n- [x] A internal AST representation\n- [x] Repl\n- [x] Interpeter\n\n\n## Running repl\n\n- `python repl.py`\n\n\n## TODO\n- [x] Introduce `;` as a separator\n- [x] Named functions\n- [x] Not defined variables should return `nil`\n- [x] Modulo operator\n- [x] `and` operator\n- [x] `or` operator\n- [ ] `elseif` statement\n- [x] Variables with numbers in name\n- [ ] Iterator for Table using `pairs`/`ipairs`\n- [ ] `_G` for globals access\n- [ ] `for` loop\n- [ ] `while` loop\n- [ ] `repeat` loop\n- [ ] Short circuit / tenary operator\n- [ ] Dot property syntax in Table for string keys\n- [ ] Numbers beginning with `.` (Ex `.5`)\n- [ ] Handle global vs local variables in lua style\n- [ ] Function calls with single params should not require parens\n- [ ] Metatable support for tables\n\n\n## Supports\n- Single and multiline comments\n- Variable assignments\n- Numbers\n- Strings\n- Tables\n- Addition, multiplication and division\n- If statements\n- Comparison operators (`==`, `\u003e=`, `\u003e`, `\u003c`, `\u003c≠`, `~=`)\n- String concat `..`\n- `return`\n- `function` declarations (both named and anymous with closures)\n- `not` logical operator\n- Negative values\n- Table indexing\n- Table count with `#`\n- Non existing identifiers return nil\n- Modulo operator\n\n\n## References\n- A lot of the work here is based on the book [Writing A Compiler In Go](https://compilerbook.com/)\n- [My first take](https://github.com/marteinn/Lua-To-Python)\n- [A Python Interpreter Written in Python](https://www.aosabook.org/en/500L/a-python-interpreter-written-in-python.html)\n- [Let’s Build A Simple Interpreter. Part 7: Abstract Syntax Trees](https://ruslanspivak.com/lsbasi-part7/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarteinn%2Flua-interpreter-in-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarteinn%2Flua-interpreter-in-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarteinn%2Flua-interpreter-in-python/lists"}