{"id":17715628,"url":"https://github.com/nateseymour/buffalo","last_synced_at":"2026-03-06T17:35:03.300Z","repository":{"id":251418903,"uuid":"837334247","full_name":"NateSeymour/buffalo","owner":"NateSeymour","description":"C++23 Parser Generator","archived":false,"fork":false,"pushed_at":"2025-05-04T17:12:49.000Z","size":411,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T18:21:11.574Z","etag":null,"topics":["bison","cplusplus","cplusplus-23","parser-generator"],"latest_commit_sha":null,"homepage":"https://nateseymour.github.io/buffalo/","language":"C++","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/NateSeymour.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}},"created_at":"2024-08-02T18:15:38.000Z","updated_at":"2025-05-04T17:12:44.000Z","dependencies_parsed_at":"2024-08-02T22:33:36.771Z","dependency_job_id":"13dae2dc-ce32-45b4-ab53-ffff5affeb26","html_url":"https://github.com/NateSeymour/buffalo","commit_stats":null,"previous_names":["nateseymour/buffalo"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateSeymour%2Fbuffalo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateSeymour%2Fbuffalo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateSeymour%2Fbuffalo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateSeymour%2Fbuffalo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NateSeymour","download_url":"https://codeload.github.com/NateSeymour/buffalo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252582241,"owners_count":21771634,"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":["bison","cplusplus","cplusplus-23","parser-generator"],"created_at":"2024-10-25T12:06:33.797Z","updated_at":"2026-03-06T17:35:03.234Z","avatar_url":"https://github.com/NateSeymour.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# buffalo\n\u003e *buffalo: to bewilder, baffle (also: **bamboozle**)* [2024 Merriam-Webster Dictionary]\n\nBewilder, baffle (even bamboozle!) your grammars with `buffalo`, a C++23 header-only SLR parser generator with\n`yacc/bison`-like syntax.\n\nIt supports the definition of terminals, non-terminals and grammar structures all within the same C++ file.\n\n## Features\n- Terminal definition with builtin scanning based on `compile-time-regular-expressions` (`spex`).\n- Grammar definition in pseudo BNF notation.\n- Shift/Reduce conflict resolution through precedence (based on definition order) and associativity (left/right/none).\n\n## Compiler Support\n`buffalo` officially supports the following compilers:\n- GCC 14\n- Clang 18\n- MSVC\n\n## Examples\n### Calculator\n```c++\n/* calculator.cpp */\n#include \u003cbuffalo/buffalo.h\u003e\n#include \u003cbuffalo/spex.h\u003e\n\n/*\n * Grammar Definition\n */\nusing G = bf::GrammarDefinition\u003cdouble\u003e;\n\n/*\n * Terminals\n */\nbf::DefineTerminal\u003cG, R\"(\\d+(\\.\\d+)?)\", double\u003e NUMBER([](auto const \u0026tok) {\n    return std::stod(std::string(tok.raw));\n});\n\nbf::DefineTerminal\u003cG, R\"(\\^)\"\u003e OP_EXP(bf::Right);\n\nbf::DefineTerminal\u003cG, R\"(\\*)\"\u003e OP_MUL(bf::Left);\nbf::DefineTerminal\u003cG, R\"(\\/)\"\u003e OP_DIV(bf::Left);\nbf::DefineTerminal\u003cG, R\"(\\+)\"\u003e OP_ADD(bf::Left);\nbf::DefineTerminal\u003cG, R\"(\\-)\"\u003e OP_SUB(bf::Left);\n\nbf::DefineTerminal\u003cG, R\"(\\()\"\u003e PAR_OPEN;\nbf::DefineTerminal\u003cG, R\"(\\))\"\u003e PAR_CLOSE;\n\n/*\n * Non-Terminals\n */\nbf::DefineNonTerminal\u003cG\u003e expression\n    = bf::PR\u003cG\u003e(NUMBER)\u003c=\u003e[](auto \u0026$) { return $[0]; }\n    | (PAR_OPEN + expression + PAR_CLOSE)\u003c=\u003e[](auto \u0026$) { return $[1]; }\n    | (expression + OP_EXP + expression)\u003c=\u003e[](auto \u0026$) { return std::pow($[0], $[2]); }\n    | (expression + OP_MUL + expression)\u003c=\u003e[](auto \u0026$) { return $[0] * $[2]; }\n    | (expression + OP_DIV + expression)\u003c=\u003e[](auto \u0026$) { return $[0] / $[2]; }\n    | (expression + OP_ADD + expression)\u003c=\u003e[](auto \u0026$) { return $[0] + $[2]; }\n    | (expression + OP_SUB + expression)\u003c=\u003e[](auto \u0026$) { return $[0] - $[2]; }\n    ;\n\nbf::DefineNonTerminal\u003cG\u003e statement\n    = bf::PR\u003cG\u003e(expression)\u003c=\u003e[](auto \u0026$)\n    {\n        return $[0];\n    }\n    ;\n\n/*\n * Calculations\n */\nauto calculator = bf::SLRParser\u003cG\u003e::Build(statement);\ndouble result = *calculator.Parse(\"18 + 2^(1 + 1) * 4\");\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnateseymour%2Fbuffalo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnateseymour%2Fbuffalo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnateseymour%2Fbuffalo/lists"}