{"id":16538753,"url":"https://github.com/spyoungtech/ahk-ast","last_synced_at":"2026-05-28T13:31:41.844Z","repository":{"id":37268241,"uuid":"453251502","full_name":"spyoungtech/ahk-ast","owner":"spyoungtech","description":"Create abstract syntax trees from AHK code","archived":false,"fork":false,"pushed_at":"2022-06-20T22:31:36.000Z","size":53,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T00:44:46.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/spyoungtech.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":"2022-01-28T23:55:13.000Z","updated_at":"2022-01-28T23:55:38.000Z","dependencies_parsed_at":"2022-08-29T06:21:37.119Z","dependency_job_id":null,"html_url":"https://github.com/spyoungtech/ahk-ast","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spyoungtech/ahk-ast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fahk-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fahk-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fahk-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fahk-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spyoungtech","download_url":"https://codeload.github.com/spyoungtech/ahk-ast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spyoungtech%2Fahk-ast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33611248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"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":[],"created_at":"2024-10-11T18:46:42.255Z","updated_at":"2026-05-28T13:31:41.813Z","avatar_url":"https://github.com/spyoungtech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ahk-ast\n\n![example workflow](https://github.com/spyoungtech/ahk-ast/actions/workflows/unittests.yaml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/spyoungtech/ahk-ast/badge.svg?branch=main)](https://coveralls.io/github/spyoungtech/ahk-ast?branch=main)\n\n\n\nThis is an attempt at implementing a parser for AutoHotkey using a LALR(1) parser generator (provided by `sly`).\nUltimately, the ability to parse AHK syntax programmatically will help in the production of other tools, such as\nlinters, code formatters, compilers, and more.\n\n\nGoals:\n\n- Define a formal grammar for [AutoHotkey V2](https://lexikos.github.io/v2/docs/v2-changes.htm)\n- Ability to tokenize AutoHotkey code\n- Ability to generate an abstract syntax tree (AST) from AutoHotkey V2 code\n\n\nExtended goals:\n\n- Ability to reproduce source code from AST models (\"round-tripping\")\n- Ability to modify AST nodes and reproduce source code\n- Ability to preserve comments in round-trip editing.\n\n\n\nHowever, it's unclear how successful this endeavor will be, or if it can be successful at all. If a LALR grammar cannot\nbe established, then this project will likely remain incomplete.\n\n# Usage\n\n\n## Tokenizing\n\n```bash\npython -m ahk_ast.tokenizer myfile.ahk\n```\n\n## Parsing\n\n```python\nimport ahk_ast\nahk_source = \"\"\"\\\na := 1\nb := a + 1\n\nMsgBox b\n\"\"\"\n\nahk_ast.parse(ahk_source)\n# Program(\n#     statements=(\n#         Assignment(location=Identifier(name=\"a\"), value=Integer(value=1)),\n#         Assignment(\n#             location=Identifier(name=\"b\"), value=BinOp(op=\"+\", left=Identifier(name=\"a\"), right=Integer(value=1))\n#         ),\n#         FunctionCall(name=\"MsgBox\", arguments=(Identifier(name=\"b\"),)),\n#     )\n# )\n\n```\n\n# Status\n\nThis project is in its very early phases. Almost none of the language syntax is fully implemented into the parser.\nThe tokenizer has most the tokens that exist for AHK, but is still very much subject to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspyoungtech%2Fahk-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspyoungtech%2Fahk-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspyoungtech%2Fahk-ast/lists"}