Belp

Build Status Coverage Status Hex.pm

A simple Boolean Expression Lexer and Parser written in Elixir.

Installation

The package can be installed by adding belp to your list of dependencies in mix.exs:

def deps do
[
{:belp, "~> 0.2"}
]
end

Usage

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.