diff options
author | Case Duckworth | 2024-03-04 21:01:27 -0600 |
---|---|---|
committer | Case Duckworth | 2024-03-04 21:01:27 -0600 |
commit | bbaff0e0c204c2fab216f6501dc8c11b4425b4bc (patch) | |
tree | b2a06edc7b1c8e6f86839bff8c16e06297080674 /eval2.lua | |
parent | Add copying (diff) | |
download | lam-first-try.tar.gz lam-first-try.zip |
Ugghhhh totally not working first-try
Diffstat (limited to 'eval2.lua')
-rw-r--r-- | eval2.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/eval2.lua b/eval2.lua new file mode 100644 index 0000000..02444b8 --- /dev/null +++ b/eval2.lua | |||
@@ -0,0 +1,39 @@ | |||
1 | --- lam.eval | ||
2 | |||
3 | local eval = {} | ||
4 | local read = require "read" | ||
5 | local util = require "util" | ||
6 | local types = require "types" | ||
7 | table.unpack = table.unpack or unpack | ||
8 | |||
9 | local Environment = | ||
10 | function (inner, outer) | ||
11 | -- an Environment is really just a lua table between symbols and | ||
12 | -- values. They can be nested for uh, closure reasons or | ||
13 | -- something. TODO: figure out how this intersects with | ||
14 | -- Namespaces or Symboltables or whatever. | ||
15 | local mt = { | ||
16 | __type = "Environment", | ||
17 | __index = outer, | ||
18 | } | ||
19 | return setmetatable(inner, mt) | ||
20 | end | ||
21 | |||
22 | local Procedure = | ||
23 | function (params, body, env) | ||
24 | local proc = { | ||
25 | params = params, | ||
26 | body = body, | ||
27 | env = env, | ||
28 | } | ||
29 | local mt = { | ||
30 | __type = "Procedure", | ||
31 | __call = | ||
32 | function (self, ...) | ||
33 | end, | ||
34 | } | ||
35 | return setmetatable(proc, mt) | ||
36 | end | ||
37 | |||
38 | --- | ||
39 | return eval | ||