{"id":18660462,"url":"https://github.com/codella/bullock","last_synced_at":"2025-09-16T15:37:41.307Z","repository":{"id":62554714,"uuid":"101474194","full_name":"codella/bullock","owner":"codella","description":":construction: Work In Progress :construction: A simple Ruby PEG implementation - no strings attached!","archived":false,"fork":false,"pushed_at":"2017-08-26T08:46:37.000Z","size":117,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-12T00:03:23.120Z","etag":null,"topics":["peg-parser","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/codella.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}},"created_at":"2017-08-26T08:46:21.000Z","updated_at":"2024-07-20T20:50:58.000Z","dependencies_parsed_at":"2022-11-03T05:15:36.989Z","dependency_job_id":null,"html_url":"https://github.com/codella/bullock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codella/bullock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codella%2Fbullock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codella%2Fbullock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codella%2Fbullock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codella%2Fbullock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codella","download_url":"https://codeload.github.com/codella/bullock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codella%2Fbullock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275441410,"owners_count":25465355,"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","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"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":["peg-parser","ruby","ruby-gem"],"created_at":"2024-11-07T07:43:51.769Z","updated_at":"2025-09-16T15:37:41.263Z","avatar_url":"https://github.com/codella.png","language":"Ruby","readme":"\u003cimg src=\"logo.png\" height='64'\u003e\n\n# Bullock\nA simple Ruby PEG implementation - no strings attached!\n\n## Why Would I Need Another Ruby PEG?\nProbably you don't, but I definitely do and I would like to explain you why.\n\nI have been tackling some interesting tasks recently, such as rewriting a TemplateHandler for Rails that speaks Handlebars.\n\nAt first, I started my investigation to understand what is the best PEG for me and my team. We were in need of a PEG that was both less intrusive and with a smooth learning curve. Also, we needed the parser and lexer code to be easily maintainable in the future.\n\nWe ended up choosing [RLTK](https://github.com/chriswailes/RLTK), that in my opinion is a good example of clear API in terms of lexing and parsing specification - so we decided to adopt it. Although we found it compelling an clean at first, we ended up in merging in our runtime other gems that are an unnecessary risk for us. This happened simply because this implementation, like many other out there, they do **more than we actually needed**.\n\nThis gem aims to give to the Ruby world a simple PEG implementation, with a smooth learning curve, simple API, excellent test coverage, examples of usage with great explanation and, last but not least, **no runtime dependencies at all**.\n\nThese are the actual gems that are needed in develoment mode:\n```\nUsing columnize 0.9.0\nUsing debugger-linecache 1.2.0\nUsing slop 3.6.0\nUsing byebug 4.0.3\nUsing diff-lcs 1.2.5\nUsing rspec-support 3.2.1\nUsing rspec-core 3.2.0\nUsing rspec-expectations 3.2.0\nUsing rspec-mocks 3.2.0\nUsing rspec 3.2.0\nUsing bundler 1.8.2\n```\n\n**11 gems needed in development mode, and 0 gems needed at runtime!**\n\n## Why This Logo?\nWell... There was a Yacc, then a Bison followed and now... a Bullock :^)\n\n## How to Bullock\n\n### Lexing\n```ruby\nlexer = Bullock.lexer do\n  rule(/regex/, :state) { |match| ... }\n  rule(/another_regex/) { ... }\nend\n\ntokens = lexer.lex(string)\n```\n\n#### Match First Lexer\n\n#### Match Longest Lexer\n\n### Parsing\n```ruby\nparser = Bullock.parser(start: :a) do\n  symbol(:a) do\n    produces('a b .c') { |c| ... }\n    produces('x y z') { |x, y, z| ... }\n  end\n\n  production(:b, 'x .Y z') { |y| ... }\nend\n\noutcome = parser.parse(tokens)\n```\n\n## Error Handling\n\n### Lexer Errors\n\n### Parse Errors\n\n## How to Contribute\n\n### Principles\n\n### Practices\n\n## Examples\n\n### Calculator\n\n### External DSL\n\n## References\n\n * http://web.cs.dal.ca/~sjackson/lalr1.html\n * https://www.cs.uaf.edu/~cs331/notes/FirstFollow.pdf\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodella%2Fbullock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodella%2Fbullock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodella%2Fbullock/lists"}