{"id":20683165,"url":"https://github.com/chimehq/gramophone","last_synced_at":"2025-04-22T12:21:33.289Z","repository":{"id":50378732,"uuid":"424024952","full_name":"ChimeHQ/Gramophone","owner":"ChimeHQ","description":"Swift library for working with Extended Backus–Naur Form (EBNF) notation and grammars.","archived":false,"fork":false,"pushed_at":"2025-04-21T20:10:57.000Z","size":133,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T20:43:44.441Z","etag":null,"topics":["ebnf","grammar","parser","parsing","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/ChimeHQ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["mattmassicotte"]}},"created_at":"2021-11-02T23:02:13.000Z","updated_at":"2025-04-21T20:11:00.000Z","dependencies_parsed_at":"2025-01-30T13:19:23.607Z","dependency_job_id":"239e93f7-7dc6-4c41-969c-d3cf27c679cf","html_url":"https://github.com/ChimeHQ/Gramophone","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/ChimeHQ%2FGramophone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGramophone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGramophone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChimeHQ%2FGramophone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChimeHQ","download_url":"https://codeload.github.com/ChimeHQ/Gramophone/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237851,"owners_count":21397403,"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":["ebnf","grammar","parser","parsing","swift"],"created_at":"2024-11-16T22:15:37.749Z","updated_at":"2025-04-22T12:21:33.279Z","avatar_url":"https://github.com/ChimeHQ.png","language":"Swift","funding_links":["https://github.com/sponsors/mattmassicotte"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![Build Status][build status badge]][build status]\n[![Platforms][platforms badge]][platforms]\n[![Matrix][matrix badge]][matrix]\n\n\u003c/div\u003e\n\n# Gramophone\n\nSwift library for working with [Extended Backus–Naur Form][ebnf] (EBNF) notation and the resulting grammars.\n\nFeatures:\n- Accepts a variety of BNF syntaxes\n- Computes FIRST and FOLLOW sets\n\n\u003e [!WARNING]\n\u003e This library is still a work-in-progress. It definitely still has some issues.\n\n## Integration\n\n### Swift Package Manager\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/ChimeHQ/Gramophone\")\n]\n```\n\n## Supported Syntax\n\n```\nsingle_quote_terminal = 'value';\nangled_quote_terminal = `value´;\ndouble_quote_terminal = \"value\";\nunicode_scalar = U+0000;\nbnf_nonterminal = \u003cvalue\u003e;\n\nconcatenation = a, b, c;\nimplicit_concatenation = a b c;\nalternation = a | b | c;\noptional = [a, b];\ntailing_optional = a?;\nrepetition = {a};\ntailing_plus_repetition = a+;\ntailing_star_repetition = a*;\ngrouping = (a, b, c);\nexception = a - b;\n\narrow_assigment → a;\ncolon_colon_equals_assigment ::= a;\n```\n\nThere's also a bunch of additional notation used by the W3C's [XQuery specification](https://www.w3.org/TR/xquery-31/#EBNFNotation), which may be work looking into.\n\n## Usage\n\n```swift\nlet grammar = try parser.parseGrammar(\"test = 'a' | 'b';\")\n\nlet firstMap = grammar.computeFirstMap()\nlet followMap = grammar.computeFollowMap()\n```\n\n## Contributing and Collaboration\n\nI would love to hear from you! Issues or pull requests work great. Both a [Matrix space][matrix] and [Discord][discord] are available for live help, but I have a strong bias towards answering in the form of documentation. You can also find me on [mastodon](https://mastodon.social/@mattiem).\n\nI prefer collaboration, and would love to find ways to work together if you have a similar project.\n\nI prefer indentation with tabs for improved accessibility. But, I'd rather you use the system you want and make a PR than hesitate because of whitespace.\n\nBy participating in this project you agree to abide by the [Contributor Code of Conduct](CODE_OF_CONDUCT.md).\n\n[build status]: https://github.com/ChimeHQ/Gramophone/actions\n[build status badge]: https://github.com/ChimeHQ/Gramophone/workflows/CI/badge.svg\n[platforms]: https://swiftpackageindex.com/ChimeHQ/Gramophone\n[platforms badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FChimeHQ%2FGramophone%2Fbadge%3Ftype%3Dplatforms\n[matrix]: https://matrix.to/#/%23chimehq%3Amatrix.org\n[matrix badge]: https://img.shields.io/matrix/chimehq%3Amatrix.org?label=Matrix\n[discord]: https://discord.gg/esFpX6sErJ\n[ebnf]: https://en.wikipedia.org/wiki/Extended_Backus–Naur_form\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimehq%2Fgramophone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchimehq%2Fgramophone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimehq%2Fgramophone/lists"}