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
|
--- lam.eval
local eval = {}
local read = require "read"
local util = require "util"
local types = require "types"
table.unpack = table.unpack or unpack
local Environment =
function (inner, outer)
-- an Environment is really just a lua table between symbols and
-- values. They can be nested for uh, closure reasons or
-- something. TODO: figure out how this intersects with
-- Namespaces or Symboltables or whatever.
local mt = {
__type = "Environment",
__index = outer,
}
return setmetatable(inner, mt)
end
local Procedure =
function (params, body, env)
local proc = {
params = params,
body = body,
env = env,
}
local mt = {
__type = "Procedure",
__call =
function (self, ...)
end,
}
return setmetatable(proc, mt)
end
---
return eval
|