Skip to content

Instantly share code, notes, and snippets.

@alexmadeathing
alexmadeathing / README.md
Last active October 12, 2021 11:44
Simple boolean expression parser

A parser designed to parse extremely simple boolean logic expressions. Expressions may contain boolean literals, C style identifiers (which represent runtime booleans), and a few boolean logic operators.

Some example expressions:

  • true
  • a | b
  • a & (b | c)
  • a & !(b | c)
  • !a & !b & !c

It is implemented in Nom using the following grammar as a reference (whitespace not included for clarity):