tlux / belp

A simple Boolean Expression Lexer and Parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

A simple Boolean Expression Lexer and Parser

License:MIT License


Languages

Language:Elixir 94.2%Language:Erlang 5.8%