Writing a boolean expression parser in Elixir using NimbleParsec
Aug 19, 2018
Lately I spent some time writing a parser using NimbleParsec and was really pleased with how the library works. So I decided to write up a small tutorial on building a parser for boolean logic and how I approached building the grammar and the parser.
This is what we will attempt to parse:
true and false The boolean constants () Grouping of expressions not Negation of expressions and Logical conjunction of expressions or Logical disjunction of expressions Precedence rules To correctly parse boolean expressions we need to take into account the operator precedence rules.