{"id":16714226,"url":"https://github.com/flier/gocombine","last_synced_at":"2025-03-15T07:11:48.311Z","repository":{"id":140003972,"uuid":"470555341","full_name":"flier/gocombine","owner":"flier","description":"gocombine is an experimental implementation of parser combinators for Golang[Generic]","archived":false,"fork":false,"pushed_at":"2022-04-15T09:31:03.000Z","size":323,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T22:09:42.995Z","etag":null,"topics":["go-generics","ll1-parser","parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2022-03-16T11:32:35.000Z","updated_at":"2022-03-27T14:04:15.000Z","dependencies_parsed_at":"2023-05-01T03:49:21.827Z","dependency_job_id":null,"html_url":"https://github.com/flier/gocombine","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/flier%2Fgocombine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fgocombine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fgocombine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fgocombine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flier","download_url":"https://codeload.github.com/flier/gocombine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695589,"owners_count":20332629,"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":["go-generics","ll1-parser","parser"],"created_at":"2024-10-12T20:49:55.907Z","updated_at":"2025-03-15T07:11:48.287Z","avatar_url":"https://github.com/flier.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gocombine [![Continuous integration](https://github.com/flier/gocombine/actions/workflows/ci.yml/badge.svg)](https://github.com/flier/gocombine/actions/workflows/ci.yml) [![Go Reference](https://pkg.go.dev/badge/github.com/flier/gocombine/gocombine.svg)](https://pkg.go.dev/github.com/flier/gocombine) [![Apache](https://img.shields.io/badge/license-Apache-blue.svg)](https://github.com/flier/gohs/blob/master/LICENSE-APACHE) [![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/flier/gohs/blob/master/LICENSE-MIT)\n\n\nAn experimental implementation of parser combinators for `Golang[Generic]`, inspired by the Haskell library [Parsec][] and the Rust [combine][]. As in Parsec the parsers are [LL(1)][] by default but they can opt-in to arbitrary lookahead using the attempt combinator.\n\n## Examples\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/flier/gocombine/pkg/parser/char\"\n\t\"github.com/flier/gocombine/pkg/parser/combinator\"\n\t\"github.com/flier/gocombine/pkg/parser/repeat\"\n\t\"github.com/flier/gocombine/pkg/parser/to\"\n)\n\nfunc main() {\n\tparser := combinator.Map(\n\t\trepeat.SepBy(to.String(repeat.Many1(char.Letter())), char.Space()),\n\t\tfunc(words []string) string {\n\t\t\treturn words[len(words)-1]\n\t\t})\n\n\tresult, _, err := parser.Parse([]rune(\"Pick up that word!\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(result)\n}\n```\n\nLarger examples can be found in the [examples](examples) and [benches](benches) folders.\n\n## About\n\nA parser combinator is, broadly speaking, a function which takes several parsers as arguments and returns a new parser, created by combining those parsers. For instance, the [Many][] parser takes one parser, `parser`, as input and returns a new parser which applies `parser` zero or more times. Thanks to the modularity that parser combinators gives it is possible to define parsers for a wide range of tasks without needing to implement the low level plumbing while still having the full power of Rust when you need it.\n\nThe library adheres to [semantic versioning][].\n\nIf you end up trying it I welcome any feedback from your experience with it. I am usually reachable within a day by opening an issue, sending an email or posting a message on Gitter.\n\n## License\n\nThis project is licensed under either of Apache License ([LICENSE-APACHE](LICENSE-APACHE)) or MIT license ([LICENSE-MIT](LICENSE-MIT)) at your option.\n\n[combine]:https://github.com/Marwes/combine\n[LL(1)]:https://en.wikipedia.org/wiki/LL_parser\n[Many]:https://pkg.go.dev/github.com/flier/gocombine/pkg/repeat#Many\n[Parsec]:https://hackage.haskell.org/package/parsec\n[semantic versioning]:https://semver.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Fgocombine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflier%2Fgocombine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Fgocombine/lists"}