{"id":51609586,"url":"https://github.com/albertocavalcante/groovy-parser-go","last_synced_at":"2026-07-12T06:02:27.036Z","repository":{"id":369316629,"uuid":"1158378827","full_name":"albertocavalcante/groovy-parser-go","owner":"albertocavalcante","description":"Lossless Groovy parser in pure Go -- IDE-quality CST with error recovery (no CGO, no tree-sitter)","archived":false,"fork":false,"pushed_at":"2026-05-22T19:31:56.000Z","size":626,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-04T17:22:09.010Z","etag":null,"topics":["cst","go","gradle","groovy","parser","syntax-tree"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/albertocavalcante.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-15T09:11:46.000Z","updated_at":"2026-05-22T19:32:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/albertocavalcante/groovy-parser-go","commit_stats":null,"previous_names":["albertocavalcante/groovy-parser-go"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/albertocavalcante/groovy-parser-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertocavalcante%2Fgroovy-parser-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertocavalcante%2Fgroovy-parser-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertocavalcante%2Fgroovy-parser-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertocavalcante%2Fgroovy-parser-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertocavalcante","download_url":"https://codeload.github.com/albertocavalcante/groovy-parser-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertocavalcante%2Fgroovy-parser-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35383520,"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-07-12T02:00:06.386Z","response_time":87,"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":["cst","go","gradle","groovy","parser","syntax-tree"],"created_at":"2026-07-12T06:02:23.180Z","updated_at":"2026-07-12T06:02:27.029Z","avatar_url":"https://github.com/albertocavalcante.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# groovy-parser-go\n\n[![CI](https://github.com/albertocavalcante/groovy-parser-go/actions/workflows/ci.yml/badge.svg)](https://github.com/albertocavalcante/groovy-parser-go/actions/workflows/ci.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=albertocavalcante_groovy-parser-go\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=albertocavalcante_groovy-parser-go)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=albertocavalcante_groovy-parser-go\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=albertocavalcante_groovy-parser-go)\n[![Go Reference](https://pkg.go.dev/badge/github.com/albertocavalcante/groovy-parser-go.svg)](https://pkg.go.dev/github.com/albertocavalcante/groovy-parser-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/albertocavalcante/groovy-parser-go)](https://goreportcard.com/report/github.com/albertocavalcante/groovy-parser-go)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/albertocavalcante/groovy-parser-go)](go.mod)\n\nA Groovy syntax parser written in pure Go. No CGO, no tree-sitter, no external C dependencies.\n\nThe goal is an IDE-quality parser that produces a complete, lossless concrete syntax tree (CST) for any input — including incomplete or invalid Groovy code. It should handle partial files, mid-typing states, and syntax errors gracefully, always returning a usable tree rather than bailing on the first error.\n\n## Motivation\n\nExisting options for parsing Groovy outside the JVM are limited:\n\n- **tree-sitter-groovy** requires CGO bindings, complicating builds and cross-compilation.\n- **ANTLR4** can target Go, but the official Groovy grammar is tightly coupled to Java through embedded semantic predicates and custom lexer logic.\n- **No standalone pure-Go Groovy parser exists.**\n\nThis project aims to fill that gap with a parser that can be used in Go-native tooling — linters, formatters, language servers, static analysis, Gradle file processing — without pulling in C toolchains or JVM dependencies.\n\n## Current Status\n\n**Active development.** The lexer, CST, and parser foundations are implemented with error recovery, fuzz testing, and lossless round-trip verification.\n\n## Design Documents\n\nThe [`docs/design/`](docs/design/) directory contains research and design documents that informed the architecture:\n\n- [01-antlr-experiment.md](docs/design/01-antlr-experiment.md) — ANTLR4 experiment plan for building a reference oracle\n- [02-handwritten-parser-plan.md](docs/design/02-handwritten-parser-plan.md) — Full architecture plan for the hand-written Pratt/recursive descent parser\n- [03-parsing-approaches-deep-dive.md](docs/design/03-parsing-approaches-deep-dive.md) — Comprehensive comparison of nine parsing techniques for Groovy + Go\n\n## Implementation Plan\n\nThe [`plan/`](plan/) directory contains the detailed, phased implementation plan:\n\n| Phase | Title | Focus |\n|---|---|---|\n| [000](plan/000-overview.md) | Master Plan | TDD strategy, dependency graph, DSL strategy, quality gates |\n| [001](plan/001-project-setup.md) | Project Setup | Go module, CI, snapshot test framework, source positions |\n| [002](plan/002-lexer-foundation.md) | Lexer Foundation | Tokens, trivia, keywords, numbers, operators, single-quoted strings |\n| [003](plan/003-cst-tree-builder.md) | CST \u0026 Tree Builder | Green/red tree nodes, builder API, walking, pretty-print |\n| [004](plan/004-parser-expressions.md) | Expressions | Pratt parser, all binary/unary/ternary ops, method calls, indexing |\n| [005](plan/005-parser-statements.md) | Statements | Control flow, blocks, variable declarations, error recovery |\n| [006](plan/006-strings-interpolation.md) | Strings \u0026 Interpolation | All 6 string types, GString `${}`, lexer mode stack |\n| [007](plan/007-closures-collections.md) | Closures \u0026 Collections | Closures, trailing closures, lists, maps, ranges |\n| [008](plan/008-declarations-types.md) | Declarations | Classes, traits, enums, methods, generics, annotations |\n| [009](plan/009-advanced-expressions.md) | Advanced Expressions | Command expressions, slashy strings, safe nav, spread |\n| [010](plan/010-error-recovery.md) | Error Recovery | Fuzz testing, mid-typing scenarios, synchronization sets |\n| [011](plan/011-corpus-testing.md) | Corpus Testing | Gradle, Jenkins, Spock, Groovy test suite validation |\n| [012](plan/012-api-extensibility.md) | API \u0026 Performance | Public API, visitor/walker, CLI tool, benchmarks |\n\nDevelopment follows strict TDD — every grammar construct is test-first with snapshot testing, round-trip verification, and error recovery cases.\n\n## Design Principles\n\n- **Always produce a tree.** The parser never panics or bails. Invalid input produces error nodes in the tree, not crashes.\n- **Lossless.** Every byte of input is represented in the CST. Round-tripping `tree.Text()` reproduces the original source exactly — same whitespace, same comments, same blank lines.\n- **Trivia-preserving.** Whitespace, comments (line, block, Groovydoc), newlines, and shebangs are captured as trivia attached to tokens using the Roslyn leading/trailing trivia model. This enables OpenRewrite-style lossless code transformations: modify a single node and everything around it stays exactly as it was.\n- **Pure Go, zero dependencies.** No CGO, no build tags, no external C/C++ dependencies, no third-party Go modules. The only import paths are `github.com/albertocavalcante/groovy-parser-go/...` and the Go standard library. `go build` and done.\n- **Go 1.25 baseline.** The module targets Go 1.25 as the minimum version, giving access to generics, fuzz testing, range-over-func iterators, and the `slices`/`maps` packages — without chasing nightly or unstable releases.\n- **Syntax only.** No type resolution, no classpath scanning, no semantic analysis. Just the syntax tree.\n\n## Development\n\nRequires [Go 1.25+](https://go.dev/dl/) and [just](https://github.com/casey/just).\n\n```bash\n# One-time setup (installs git hooks, syncs tools)\njust setup\n\n# Run tests (via gotestsum)\njust test\n\n# Run linter (via golangci-lint from tools.go.mod)\njust lint\n\n# Full CI gate (format + vet + lint + test)\njust check\n\n# See all available recipes\njust\n```\n\nDev tools (`gotestsum`, `golangci-lint`) are managed in `tools.go.mod` — a separate module\nfile that keeps them out of the main dependency tree. No global tool installs needed; Go\ndownloads them automatically.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertocavalcante%2Fgroovy-parser-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertocavalcante%2Fgroovy-parser-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertocavalcante%2Fgroovy-parser-go/lists"}