Skip to content
/ belp Public

A simple Boolean Expression Lexer and Parser

License

Notifications You must be signed in to change notification settings

tlux/belp

Repository files navigation

Belp

Build Coverage Status Module Version Hex Docs License Last Updated

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, "~> 1.0"}
  ]
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.