{"id":21041416,"url":"https://github.com/dozmus/antlr4-macro","last_synced_at":"2026-02-17T12:36:10.671Z","repository":{"id":79482595,"uuid":"64698019","full_name":"dozmus/antlr4-macro","owner":"dozmus","description":"Macro pre-processor definitions for ANTLR4 written using ANTLR4 :-)","archived":false,"fork":false,"pushed_at":"2018-07-15T17:13:25.000Z","size":287,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T05:40:39.129Z","etag":null,"topics":["antlr","antlr4","grammar","macro","preprocessor"],"latest_commit_sha":null,"homepage":"","language":"ANTLR","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dozmus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-08-01T20:08:40.000Z","updated_at":"2024-03-24T14:51:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"97f8327f-d7a5-4b01-aa2e-ab81df1e8ff5","html_url":"https://github.com/dozmus/antlr4-macro","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dozmus/antlr4-macro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozmus%2Fantlr4-macro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozmus%2Fantlr4-macro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozmus%2Fantlr4-macro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozmus%2Fantlr4-macro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dozmus","download_url":"https://codeload.github.com/dozmus/antlr4-macro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dozmus%2Fantlr4-macro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29543908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T12:21:34.159Z","status":"ssl_error","status_checked_at":"2026-02-17T12:21:02.057Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["antlr","antlr4","grammar","macro","preprocessor"],"created_at":"2024-11-19T13:52:08.190Z","updated_at":"2026-02-17T12:36:05.604Z","avatar_url":"https://github.com/dozmus.png","language":"ANTLR","funding_links":[],"categories":[],"sub_categories":[],"readme":"antlr4-macro\n============\n\nA macro pre-processor for ANTLR4.\n\n## Usage\nYou should add pre-build event(s) in your IDE of choice to run the\nantlr4-macro artifact, and thus output standard ANTLR4 grammar files.  \n\nYou can specify either target file, i.e. `-i my-grammar.mg4` or the\nentire working directory, i.e. `-i .`.  \nYou may also enable recursive traversal using `-r`.  \nWhen traversing the directory, only files with extension `mg4` will be\nprocessed.  \n\nMore usage information available at `java -jar antlr4-macro.jar -help`\n\n## What is it?\nC-like macros for your ANTLR4 grammar code.  \ne.g. `#MY_MACRO: 'my macro';` and `#MACRO2(A, B): A ' ' B;`.\n\nNote: The scope of a macro rule is the entire file it is in.\n\n## In-built macro rules\n| Name | Arguments | Output (ANTLR4 grammar code) |\n|---|---|---|\n| `lower` | Anything | Its entire argument in lowercase. |\n| `upper` | Anything | Its entire argument in uppercase. |\n| `list` | Anything | `Anything (',' Anything)*` |\n| `list` | Anything, Delimiter | `Anything (Delimeter Anything)*` |\n\nNote: You can redefine an in-built macro, however you cannot redefine your own macros.\nThis will result in the `RedefinedMacroRuleException` being thrown.\n\n## Example\nInput:\n```\ngrammar HelloWorld;\n\n// my macro definitions\n#HELLO: 'Hello';\n#WORLD: 'World';\n\n// parser rules\nhelloWorldList1: list(HELLOWORLD1);\nhelloWorldList2: list(HELLOWORLD2, ' ');\n\n// lexer rules\nHELLOWORLD1: #HELLO #WORLD;\nHELLOWORLD2: lower('Hello') upper('World');\n```\n\nRough output:\n```\ngrammar HelloWorld;\n\n// parser rules\nhelloWorldList1: HELLOWORLD1 (',' HELLOWORLD1)*;\nhelloWorldList2: HELLOWORLD2 (' ' HELLOWORLD2)*;\n\n// lexer rules\nHELLOWORLD1: 'Hello' 'World';\nHELLOWORLD2: 'hello' 'WORLD';\n```\n\n## License\nThis project is licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdozmus%2Fantlr4-macro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdozmus%2Fantlr4-macro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdozmus%2Fantlr4-macro/lists"}