1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
L or= setmetatable {}, __index: => ->
import Op, IO, Action, FnDef, EventInput, ValueInput, IOInput, ColdInput
from require 'core.base'
import match from require 'core.pattern'
import Value, Result, load_ from require 'core.value'
import Scope from require 'core.scope'
load_!
import Registry from require 'core.registry'
import Tag from require 'core.tag'
import Cell, RootCell from require 'core.cell'
import cell, program from require 'core.parsing'
globals = Scope.from_table require 'core.builtin'
{
:Value, :Result
:Cell, :RootCell
:Op, :IO, :Action, :FnDef
:EventInput, :ValueInput, :IOInput, :ColdInput,
:match
:Scope
:Registry, :Tag
:globals
parse: program\match
eval: (str, inject) ->
scope = Scope nil, globals
scope\use inject if inject
ast = assert (cell\match str), "failed to parse: #{str}"
result = ast\eval scope
result\const!
}
|