{"id":22624639,"url":"https://github.com/barrettotte/pogo2ts","last_synced_at":"2026-05-03T04:37:08.181Z","repository":{"id":114090956,"uuid":"286841595","full_name":"barrettotte/Pogo2Ts","owner":"barrettotte","description":"Use Antlr grammars to generate TypeScript models from POGOs (Plain Old Groovy Objects).","archived":false,"fork":false,"pushed_at":"2021-11-05T20:02:21.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T13:13:18.929Z","etag":null,"topics":["antlr4","antlr4-csharp","code-generation","groovy","typescript"],"latest_commit_sha":null,"homepage":"","language":"ANTLR","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barrettotte.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":"2020-08-11T20:28:16.000Z","updated_at":"2021-11-05T20:02:24.000Z","dependencies_parsed_at":"2023-06-12T14:00:20.948Z","dependency_job_id":null,"html_url":"https://github.com/barrettotte/Pogo2Ts","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/barrettotte%2FPogo2Ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPogo2Ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPogo2Ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPogo2Ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barrettotte","download_url":"https://codeload.github.com/barrettotte/Pogo2Ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131335,"owners_count":20728303,"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":["antlr4","antlr4-csharp","code-generation","groovy","typescript"],"created_at":"2024-12-09T00:17:08.744Z","updated_at":"2026-05-03T04:37:03.163Z","avatar_url":"https://github.com/barrettotte.png","language":"ANTLR","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pogo2Ts\n\nUse Antlr grammars to generate TypeScript models from POGOs (Plain Old Groovy Objects).\nWith this side project I wanted to learn a little bit more about Antlr grammars and code generation.\n\nThis is kind of just a toy and would need a pretty good amount of work to be considered usable.\nI just wanted have some fun with this and get a simple case working.\n\n## General Idea\n\n- Lex and parse POGOs using Antlr4\n- Walk through each generated AST\n- Generate TypeScript source for each POGO\n\n## Groovy Grammars\n\nThere are official Antlr4 grammars located in https://github.com/apache/groovy/blob/master/src/antlr/ .\nHowever, I found out the Parrot parser for Groovy uses a fork of Antlr4 (https://issues.apache.org/jira/browse/GROOVY-9232).\nThis means that the official Antlr4 grammars don't work out of the box with the official Antlr4 jar.\n\nAfter a lot of screwing around with trying to build the fork from https://github.com/tunnelvisionlabs/antlr4 ,\nI decided I would just modify the existing Antlr4 Java8 grammars at https://github.com/antlr/grammars-v4/tree/master/java/java8 since Groovy is just a superset of Java. \n\nSince I'm really just trying to convert POGOs, I will be skipping over the following items:\n\n- Closures\n- Metaprogramming\n- All the cool Groovy string literal stuff - (interpolation, GStrings, etc)\n- Probably much more...\n\nMy EBNF/Antlr is not strong enough to tackle these yet. If coerced enough I'd probably dive back in.\n\n## Setup (Windows)\n\n- Download Antlr4 jar - https://www.antlr.org/download/antlr-4.8-complete.jar\n- Add Antlr4 jar to CLASSPATH system variable\n  - System Properties \u003e Environment Variables \u003e CLASSPATH  (create if it doesn't exist)\n  - Example: CLASSPATH = `C:\\Antlr4\\antlr-4.8-complete.jar`\n- Create `C:\\Antlr4\\antlr4.bat` with the content `java org.antlr.v4.Tool %*` and add to PATH\n- Generate lexer and parser using `generate.bat`\n- Run program with `dotnet run \u003cdirectory_path\u003e`\n\n## Usage\n\n- Run example files - `dotnet run ../model/groovy ../model/ts com.github.barrettotte.model`\n\n\n## References\n\n- Antlr Mega Tutorial - https://tomassetti.me/antlr-mega-tutorial/\n- The Definitive ANTLR4 Reference - https://pragprog.com/book/tpantlr2/the-definitive-antlr-4-reference\n- Apache Groovy - https://github.com/apache/groovy\n- Antlr4 Grammars - https://github.com/antlr/grammars-v4\n- Groovy Grammar Resources\n  - Groovy Language Documentation - https://docs.groovy-lang.org/latest/html/documentation/\n  - Groovy Syntax - https://groovy-lang.org/syntax.html\n  - Groovy Style Guide - https://groovy-lang.org/style-guide.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Fpogo2ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarrettotte%2Fpogo2ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Fpogo2ts/lists"}