eyg_interpreter
Gleam implementation of the EYG language. This implementation runs on JavaScript runtimes and works in the browser.
gleam add eyg_interpreter@1
This library defines two execution modes:
- expression - always returns a value
- block - optionally returns a value and the final environment.
If in doubt use the expression module. Block is useful for creating shells (or REPLs, terminals, consoles).
import eyg/interpreter/expression
import eyg/ir/tree as ir
pub fn main() {
let source = ir.Let("x", ir.Integer(5), ir.Variable("x"))
let scope = []
expression.execute(source, scope)
// => value.Integer(5)
}
Further documentation can be found at https://hexdocs.pm/eyg_interpreter.
Development
gleam run # Run the project
gleam test # Run the tests