A simple Boolean Expression Lexer and Parser written in Elixir.
The package can be installed by adding belp
to your list of dependencies in
mix.exs
:
def deps do
[
{:belp, "~> 1.0"}
]
end
iex> Belp.eval!(
...> "(foo or bar) and not baz",
...> %{"foo" => false, "bar" => true, "baz" => false}
...> )
true
iex> Belp.eval!("invalid expression")
** (Belp.SyntaxError) Syntax error near token "expression" on line 1
See HexDocs for the full API.