{"id":21133385,"url":"https://github.com/purpleclay/chomp","last_synced_at":"2026-02-03T08:13:39.229Z","repository":{"id":214716338,"uuid":"737038858","full_name":"purpleclay/chomp","owner":"purpleclay","description":"A parser combinator library for Go that makes parsing text intuitive and maintainable","archived":false,"fork":false,"pushed_at":"2026-01-31T07:24:22.000Z","size":170,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-31T20:52:51.415Z","etag":null,"topics":["chomp","go","parser","parser-combinators","runes","strings"],"latest_commit_sha":null,"homepage":"","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/purpleclay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","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":"2023-12-29T16:11:19.000Z","updated_at":"2026-01-31T07:24:25.000Z","dependencies_parsed_at":"2024-07-13T05:43:53.479Z","dependency_job_id":"c17dd77f-fca7-4391-9665-c0165f2e636e","html_url":"https://github.com/purpleclay/chomp","commit_stats":null,"previous_names":["purpleclay/chomp"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/purpleclay/chomp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purpleclay%2Fchomp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purpleclay%2Fchomp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purpleclay%2Fchomp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purpleclay%2Fchomp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purpleclay","download_url":"https://codeload.github.com/purpleclay/chomp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purpleclay%2Fchomp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29038031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T06:39:36.383Z","status":"ssl_error","status_checked_at":"2026-02-03T06:39:32.787Z","response_time":96,"last_error":"SSL_read: 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":["chomp","go","parser","parser-combinators","runes","strings"],"created_at":"2024-11-20T06:08:14.087Z","updated_at":"2026-02-03T08:13:39.223Z","avatar_url":"https://github.com/purpleclay.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chomp\n\n![Nix](https://img.shields.io/badge/Nix-5277C3?logo=nixos\u0026logoColor=white)\n![Go](https://img.shields.io/badge/Go-00ADD8?logo=go\u0026logoColor=white)\n[![MIT](https://img.shields.io/badge/MIT-gray?logo=github\u0026logoColor=white)](LICENSE)\n\nA parser combinator library for Go that makes parsing text intuitive and maintainable. Stop wrestling with regex and start writing parsers that read like natural grammar.\n\n\u003e Inspired by [nom](https://github.com/rust-bakery/nom) 💜.\n\n## Why Chomp?\n\nParser combinators offer significant advantages over regular expressions:\n\n| | Chomp | Regex |\n|---|-------|-------|\n| **Readability** | Reads like grammar rules | Often \"write-only\" patterns |\n| **Composability** | Build complex parsers from simple, reusable pieces | Monolithic patterns that resist reuse |\n| **Error Messages** | Clear context on what failed and where | Generic \"no match\" or cryptic positions |\n| **Maintainability** | Easy to modify and extend | Small changes can break everything |\n| **Nested Structures** | Natural support for recursion | Struggles or impossible |\n| **Type Safety** | Compile-time guarantees | Runtime string manipulation |\n\n## Installation\n\n```sh\ngo get github.com/purpleclay/chomp\n```\n\n## How It Works\n\nAt the heart of `chomp` is the **combinator** - a function that attempts to parse text and returns a tuple `(rem, ext, err)`:\n\n```\n                       input\n                         │\n                         ▼\n              ┌─────────────────────┐\n              │     Combinator      │\n              └─────────────────────┘\n                         │\n          ┌──────────────┼──────────────┐\n          ▼              ▼              ▼\n    ┌───────────┐  ┌───────────┐  ┌───────────┐\n    │    rem    │  │    ext    │  │    err    │\n    └───────────┘  └───────────┘  └───────────┘\n      remaining      extracted    error (if any)\n        text           text\n```\n\n```go\n// Parse a simple tag\nrem, ext, _ := chomp.Tag(\"Hello\")(\"Hello, World!\")\n// ext: \"Hello\"\n// rem: \", World!\"\n```\n\nCombinators can be composed together to build sophisticated parsers:\n\n```go\n// Parse a key-value pair like \"name=alice\"\nfunc KeyValue() chomp.Combinator[[]string] {\n    return chomp.SepPair(\n        chomp.While(chomp.IsLetter),  // key: letters\n        chomp.Tag(\"=\"),               // separator (discarded)\n        chomp.While(chomp.IsLetter),  // value: letters\n    )\n}\n\nrem, kv, _ := KeyValue()(\"name=alice\u0026age=30\")\n// kv: [\"name\", \"alice\"]\n// rem: \"\u0026age=30\"\n```\n\n## Examples\n\nReal-world parser examples:\n\n- [GPG Private Key Parser](examples/gpg/main.go) - Parse GPG key metadata\n- [Git Diff Parser](examples/git-diff/main.go) - Parse unified diff output\n\n## Documentation\n\n- [Combinator Reference](docs/combinators.md) - All available combinators\n- [Benchmarks](docs/benchmarks.md) - Performance benchmarks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurpleclay%2Fchomp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurpleclay%2Fchomp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurpleclay%2Fchomp/lists"}