ExSel v0.0.1 ExSel.Ast
Simple expression language AST
Link to this section Summary
Functions
Evaluates the passed ast and variables
Link to this section Types
Link to this type
aexpr_binop()
Link to this type
bexpr()
Link to this type
cexpr_eq()
Link to this type
cexpr_ord()
Link to this section Functions
Link to this function
eval!(ast, ctx \\ %{})
eval!(ast :: t(), ctx :: eval_ctx()) :: eval_result() | none()
Evaluates the passed ast and variables
Examples
iex> alias ExSel.Ast
iex> Ast.eval!(true, %{})
true
iex> Ast.eval!({:+,[1,{:var, "a"}]}, %{"a" => 1})
2
iex> Ast.eval!({:==,[1,1]}, %{})
true
iex> Ast.eval!({:/,[1,0]}, %{})
** (ArithmeticError) bad argument in arithmetic expression