{"id":17802378,"url":"https://github.com/azrdev/coco_to_antlr","last_synced_at":"2025-04-02T05:15:52.616Z","repository":{"id":72699681,"uuid":"130212446","full_name":"azrdev/coco_to_antlr","owner":"azrdev","description":"Converter from Coco/R to ANTLR4 grammar","archived":false,"fork":false,"pushed_at":"2018-04-19T12:32:55.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-07T19:41:27.385Z","etag":null,"topics":["antlr","antlr-grammar","antlr4","antlr4-grammar","coco","coco-r","cocor"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/azrdev.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-04-19T12:30:30.000Z","updated_at":"2018-04-19T12:33:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"6892a221-92e2-45b7-814b-685e95c7549c","html_url":"https://github.com/azrdev/coco_to_antlr","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/azrdev%2Fcoco_to_antlr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco_to_antlr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco_to_antlr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco_to_antlr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azrdev","download_url":"https://codeload.github.com/azrdev/coco_to_antlr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246758369,"owners_count":20828919,"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":["antlr","antlr-grammar","antlr4","antlr4-grammar","coco","coco-r","cocor"],"created_at":"2024-10-27T12:41:58.138Z","updated_at":"2025-04-02T05:15:52.589Z","avatar_url":"https://github.com/azrdev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coco_to_antlr\n\nConvert your [Coco/R](http://ssw.jku.at/Coco/) attributed grammar\nto an [ANTLR4](https://www.antlr.org/) one.\nThis tool automates most of the conversion (depending on the complexity of your\nembedded instrumentation code):\n\n- rewrite production rules to ANTLR parser productions\n- rewrite Token definitions to ANTLR lexer rules\n- rewrite `PRAGMAS` and `COMMENT` definitions to ANTLR lexer rules on `-\u003e channel(HIDDEN)`\n- rewrite CharSet definitions to `fragment` lexer rules\n- copy embedded instrumentation code \u0026 (partially) adapt to different API\n    - for C++, rewrite reference attributes to `@returns[]`\n    - replace references to current/lookahead token `t`, `la` by `$ctx` (NOTE: these usually still need manual rewrite)\n    - correctly reference arguments of the current scope (i.e. `@returns[int no]` needs to be assigned like `$no =`)\n\n# TODO\nSee also the various TODO/FIXME comments in the source code, this list is only an excerpt from these\n\n- `ANY` in Coco production rules has no equivalent in ANTLR\n- character set definitions using set union \u0026 difference are not correctly rewritten\n- `IF(...)` conflict resolvers work differently in ANTLR and have to be manually checked (are preserved as comments)\n- *comments* are not preserved since version 67a4266 (when support for rule return attribute rewriting was implemented). Best way to preserve comments currently is to use version 784f8fd and the current master and merge the results (`git rebase` is your friend).\n- name collisions of generated rule \u0026 attribute names with language keywords and/or ANTLR syntax are not checked (e.g. a rule `char` or instrumentation code using a reference to a rule `text` which collides with [`$text`](https://github.com/antlr/antlr4/blob/master/doc/actions.md#parser-rule-attributes), see \u003chttps://github.com/antlr/antlr4/issues/2266\u003e).\n- `NESTED` comment definitions are not translated (though they should be possible with recursive lexer rules)\n- using an external lexer (i.e. only listing token names, not defining them) is not supported\n- string/character escapes are partly converted, need manual checking\n- Tokens with `CONTEXT` specification are not supported\n\n- Test with instrumentation language other than C++ (see e.g. \u003chttps://github.com/antlr/antlr4/issues/2265\u003e)\n- Test on windows, linux only so far\n- Rewrite Token \u0026 CharSet definitions with AST \u0026 Visitor, too, like productions already do\n- Optimize code generation from AST (i.e. remove unneeded braces, especially for quantifiers around a single subrule, like `('TOKEN')?`)\n- Parsing of (C++) attributes in rule definition and invocation is quite fragile\n- `$` in instrumentation code fails ANTLR\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazrdev%2Fcoco_to_antlr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazrdev%2Fcoco_to_antlr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazrdev%2Fcoco_to_antlr/lists"}