Cflat.Interpreter (cflat v0.2.4)
This module implements an interpreter for syntax trees of code following the grammar of the C♭ programming langauge.
Summary
Functions
Evaluate program in syntax tree form
Examples
iex> "int i = 42;" |> Cflat.tokenize() |> Cflat.parse() |> Cflat.Interpreter.evaluate()
%{"i" => 42}
Evaluate program in syntax tree form in environment
Examples
iex> "int i = j + 1;" |> Cflat.tokenize() |> Cflat.parse() |> Cflat.Interpreter.evaluate(%{"j" => 42})
%{"i" => 43, "j" => 42}