Tau Parser - a parsing library for C++ for Boolean grammars (CFG + conjunction + negation)
[https://github.com/IDNI/parser](https://github.com/IDNI/parser)
Tau Parser handles Boolean grammars: context-free, conjunction and negation. You can write something like `identifier & ~keyword` directly in the grammar to match any identifier that isn't a reserved word. No separate lexer hack, no keyword table living in your host code.
The grammar format (TGF) is EBNF-like and readable. Here's keyword-exclusion in practice:
identifier => (alpha | '_') (alnum | '_')* & ~keyword.
keyword => "let" | "if" | "else" | "while" | "fn" | "return".
* Earley-based, so left recursion works, no grammar refactoring.
* Handles ambiguity natively (full parse forest available), but auto-disambiguation gives you a single tree by default with zero configuration. You can switch it off per-nonterminal when you actually want the alternatives.
* Header-only after codegen. Run `tgf calc.tgf gen`, include the generated header, and parse:
auto r = calc_parser::instance().parse(input, len);
if (r.found) r.get_tree()->to_print(std::cout);
* The `tgf` CLI also ships an interactive REPL and a test runner for `.tgf.test` files with tree-shape assertions.
* Tree shaping (`@trim`, u/inline) lets you strip whitespace/punctuation and collapse wrapper nodes so you get a clean AST.
* Platform parity across Linux, macOS, Windows (mingw-w64), and WASM/Emscripten.
Boolean grammars can also express some things beyond context-free e.g. requiring two productions to derive the *same* string, or asserting a span does *not* match a production — so certain constraints that'd normally need a separate validation pass live in the grammar instead.
**Status:** alpha, under active development toward 1.0.
https://redd.it/1u3frd5
@r_cpp
Post #25408
13