{"id":16744834,"url":"https://github.com/marteinn/lua-to-python","last_synced_at":"2025-07-23T00:33:04.119Z","repository":{"id":39880800,"uuid":"201061382","full_name":"marteinn/Lua-To-Python","owner":"marteinn","description":"Lua to python compiler","archived":false,"fork":false,"pushed_at":"2022-05-23T16:56:34.000Z","size":84,"stargazers_count":22,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T14:03:12.552Z","etag":null,"topics":["ast","lua","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}},"created_at":"2019-08-07T13:58:13.000Z","updated_at":"2024-10-09T23:54:45.000Z","dependencies_parsed_at":"2022-09-21T04:51:55.527Z","dependency_job_id":null,"html_url":"https://github.com/marteinn/Lua-To-Python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marteinn/Lua-To-Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-To-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-To-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-To-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-To-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marteinn","download_url":"https://codeload.github.com/marteinn/Lua-To-Python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marteinn%2FLua-To-Python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266596753,"owners_count":23953893,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["ast","lua","python"],"created_at":"2024-10-13T01:44:14.544Z","updated_at":"2025-07-23T00:33:04.096Z","avatar_url":"https://github.com/marteinn.png","language":"Python","readme":"# Lua to Python\n\nThis is a project where I attempt to convert Lua to Python, by transforming Lua into Python AST and then running it.\n\n\n## Current status\n- Variable assignments, basic datatypes and comparisons, if statements, while loops and functions are working.\n\n\n## Getting started\n\n- `pip install -r requirements.txt`\n\n```\nUsage: compile.py [OPTIONS] SOURCE_FILE\n\nOptions:\n  --strip_comments INTEGER  Remove comments from tokens\n  --tokens INTEGER          Show tokens generated by lexer\n  --ast INTEGER             Show the internal AST (later transformed to Python\n                            AST\n  --py_ast INTEGER          Show Python AST\n  --py_code INTEGER         Show generated Python code\n  --help                    Show this message and exit.\n```\n\nExample: `./compile.py --strip-comments=1 examples/functions.lua`\n\n\n## Roadmap\n- [x] Single line comments\n- [x] Multiline comments\n- [x] Numbers\n- [x] Strings\n- [x] Nil types\n- [x] Variable assignments\n- [x] Addition\n- [x] Multiplication\n- [x] If statements\n- [x] Nested if statements\n- [x] `~=`  operator\n- [x] `==`  operator\n- [x] `while` keyword\n- [x] Concat strings with `..`\n- [x] Subtract values\n- [x] `\u003e=` operator\n- [x] `\u003c=` operator\n- [x] Boolean types\n- [x] `function` declarations\n- [x] `return`\n- [x] `not` logical operator\n- [x] `bool` expression in comparison\n- [x] `%` operator\n- [x] `/` operator\n- [x] `or` logical operator\n- [x] `and` logical operator\n- [x] Assign function return to variable\n- [x] Double number support\n- [x] Negative values\n- [x] Anonymous functions\n- [x] Variables with numbers in name\n- [x] Table datatype\n- [x] Support for accessing Table properties\n- [x] Support for lteral notation (`['@!#']`) in Table\n- [x] List as argument to Table constructor\n- [x] `#` operator for retrieving Table/String length\n- [x] Iterator for Table using `pairs`/`ipairs`\n- [x] `_G` for globals access\n- [x] `for` keyword\n- [x] Add multiple assignment support (`x, y, z = 1, 2, 3`)\n- [x] Add multiple assignment support in for loop target+iterator\n- [x] Add multiline line support to anonymous functions\n- [ ] `repeat` keyword\n- [ ] Short circuit / tenary operator\n- [ ] `local` variables\n- [ ] Numbers beginning with `.` (ex `.123`)\n- [ ] Undefined variables should return nil\n- [ ] Dot property syntax in Table for string keys\n- [ ] Function calls with single params should not require parens\n- [ ] Metatable support for tables\n- [ ] BUG: Function cannot call itself\n- [ ] BUG: Function declaration in nested Table\n- [ ] BUG: Nested attribute retrival with `[\"random\"][\"random2\"]`\n- [ ] BUG: Decimal type key in Table\n- [ ] BUG: Table construct in function (ex: `pairs({a=1, b=2, c=3})`\n\n\n## References\n- https://drew.ltd/blog/posts/2020-7-18.html - Many thanks for Drew and his excellent articles on how to build a programming language\n- https://greentreesnakes.readthedocs.io/en/latest/\n- https://github.com/python/cpython/blob/master/Lib/ast.py\n- https://learnxinyminutes.com/docs/lua/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarteinn%2Flua-to-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarteinn%2Flua-to-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarteinn%2Flua-to-python/lists"}