on 5cbb435 help sign in
TODO.md−1
since splitsnapshots
unifiedsplit
@@ -8,4 +8,3 @@
8- [x] ^ should be higher priority than unary ops
8- [x] ^ should be higher priority than unary ops
9- [x] Unifiy parened exprs
9- [x] Unifiy parened exprs
10- [ ] pow
10- [ ] pow
11−- [ ] attributes
desk/lib/lua/interpreter.hoon+7−34
@@ -33,7 +33,7 @@
33 $:
33 $:
34 tables=$~([(malt ~[[0 *table]]) 1] (objects table))
34 tables=$~([(malt ~[[0 *table]]) 1] (objects table))
35 global-env=table
35 global-env=table
36− local-envs=$~(~[(malt ~[['_ENV' table+[0 ~]]])] (lest (map name value)))
36+ local-envs=$~(~[(malt ~[['_ENV' table+[0 ~]]])] (list (map name value)))
37 ==
37 ==
38++ eval-m
38++ eval-m
39 |$ [val]
39 |$ [val]
@@ -62,26 +62,20 @@
62 =<
62 =<
63 |= =blok
63 |= =blok
64 ^- (eval-m value)
64 ^- (eval-m value)
65− %- with-local
66 =/ body body.blok
65 =/ body body.blok
66+ ;< ~ bind push-local
67 |-
67 |-
68 ^- (eval-m value)
68 ^- (eval-m value)
69 ?~ body
69 ?~ body
70 ?~ ret.blok (pure nil+~)
70 ?~ ret.blok (pure nil+~)
71 ?~ u.ret.blok (pure nil+~)
71 ?~ u.ret.blok (pure nil+~)
72 ;< rets=(lest value) bind (eval-exprlist u.u.ret.blok)
72 ;< rets=(lest value) bind (eval-exprlist u.u.ret.blok)
73− (pure (multires rets))
73+ (pure multires+rets)
74 ;< ~ bind (eval-stat i.body)
74 ;< ~ bind (eval-stat i.body)
75 ;< ret=value bind $(body t.body)
75 ;< ret=value bind $(body t.body)
76+ ;< ~ bind pop-local
76 (pure ret)
77 (pure ret)
77 |%
78 |%
78− ++ with-local
79− |* act=(eval-m)
80− ^- _act
81− ;< ~ bind push-local
82− ;< res=_val:$:act bind act
83− ;< ~ bind pop-local
84− (pure res)
85 ++ push-local
79 ++ push-local
86 ^- (eval-m ~)
80 ^- (eval-m ~)
87 |= st=state
81 |= st=state
@@ -91,15 +85,10 @@
91 ^- (eval-m ~)
85 ^- (eval-m ~)
92 |= st=state
86 |= st=state
93 =. local-envs.st
87 =. local-envs.st
94− ?~ t.local-envs.st !!
88+ ?~ local-envs.st !!
95 t.local-envs.st
89 t.local-envs.st
96 [st ~]
90 [st ~]
97 --
91 --
98−++ multires
99− |= vals=(lest value)
100− ^- value
101− ?~ t.vals i.vals
102− multires+vals
103++ eval-exprlist
92++ eval-exprlist
104 |= vals=exprlist
93 |= vals=exprlist
105 ^- (eval-m (lest value))
94 ^- (eval-m (lest value))
@@ -125,31 +114,15 @@
125 (set-table ->-.i.asmnts (~(put by tabl) ->+.i.asmnts +.i.asmnts))
114 (set-table ->-.i.asmnts (~(put by tabl) ->+.i.asmnts +.i.asmnts))
126 ==
115 ==
127 $(asmnts t.asmnts)
116 $(asmnts t.asmnts)
128− %local-asmnt
129− =/ lhs=(list name)
130− %+ turn attrnamelist.stat
131− |= [=name attr=(unit attrib)]
132− ?> ?=(~ attr)
133− name
134− ;< actual-values=(list [name value]) bind
135− ?~ rhs.stat (pure ~)
136− ;< rhs=(list value) bind (eval-exprlist u.rhs.stat)
137− (pure (zip lhs rhs))
138− ;< st=state bind get-state
139− =. i.local-envs.st
140− %- ~(uni by i.local-envs.st)
141− %- malt
142− (weld (turn lhs |=(=name [name `value`nil+~])) actual-values)
143− (set-state st)
144 ==
117 ==
145++ set-var
118++ set-var
146 |= var=name
119 |= var=name
147 |= val=value
120 |= val=value
148 ^- (eval-m ~)
121 ^- (eval-m ~)
149 ;< envs=(list (map name value)) bind get-local-envs
122 ;< envs=(list (map name value)) bind get-local-envs
150− =/ new-envs=(unit (lest (map name value)))
123+ =/ new-envs=(unit (list (map name value)))
151 |-
124 |-
152− ^- (unit (lest (map name value)))
125+ ^- (unit (list (map name value)))
153 ?~ envs ~
126 ?~ envs ~
154 ?. (~(has by i.envs) var)
127 ?. (~(has by i.envs) var)
155 =/ rest $(envs t.envs)
128 =/ rest $(envs t.envs)
desk/lib/lua/parser.hoon+2−2
@@ -568,7 +568,7 @@ apex
568++ parse-local-asmnt
568++ parse-local-asmnt
569 %^ tnee %parse-local-asmnt local-asmnt
569 %^ tnee %parse-local-asmnt local-asmnt
570 %+ cook
570 %+ cook
571− |= [* * =attrnamelist rhs=(unit explist)] [attrnamelist rhs]
571+ |= [* * =attnamelist rhs=(unit explist)] [attnamelist rhs]
572 ;~ plug
572 ;~ plug
573 (jest 'local')
573 (jest 'local')
574 wss
574 wss
@@ -582,7 +582,7 @@ apex
582 ==
582 ==
583 ==
583 ==
584++ parse-attnamelist
584++ parse-attnamelist
585− %^ tnee %parse-attnamelist attrnamelist
585+ %^ tnee %parse-attnamelist attnamelist
586 %+ most (ifix [ws ws] com)
586 %+ most (ifix [ws ws] com)
587 ;~ plug
587 ;~ plug
588 parse-name
588 parse-name
desk/lib/lua/printer.hoon+5−5
@@ -264,7 +264,7 @@ print
264 %- zing
264 %- zing
265 :~
265 :~
266 "local "
266 "local "
267− (print-attrnamelist attrnamelist.local-asmnt)
267+ (print-attnamelist attnamelist.local-asmnt)
268 ?~ rhs.local-asmnt ""
268 ?~ rhs.local-asmnt ""
269 %- zing
269 %- zing
270 :~
270 :~
@@ -272,13 +272,13 @@ print
272 (print-explist u.rhs.local-asmnt)
272 (print-explist u.rhs.local-asmnt)
273 ==
273 ==
274 ==
274 ==
275−:: attrnamelist
275+:: attnamelist
276::
276::
277−++ print-attrnamelist
277+++ print-attnamelist
278− |= =attrnamelist
278+ |= =attnamelist
279 ^- tape
279 ^- tape
280 %- commaed
280 %- commaed
281− %+ turn attrnamelist
281+ %+ turn attnamelist
282 |= [=name attr=(unit attrib)]
282 |= [=name attr=(unit attrib)]
283 %- zing
283 %- zing
284 :~
284 :~
desk/res/lua/baz.lua+2−3
@@ -1,6 +1,5 @@
1x = 8
1x = 8
2
2
3−local y = x + 3
3+y = x
4
4
5−
6−return y / 2
5+return y
desk/res/lua/foo.lua+2−2
@@ -47,9 +47,9 @@ do
47 return 8, foo;
47 return 8, foo;
48end
48end
49
49
50−-- print('the way of the future')
50+print('the way of the future')
51
51
52−-- print 'hello'
52+print 'hello'
53
53
54h{key1 = 'Sonmi~451'}
54h{key1 = 'Sonmi~451'}
55
55
desk/sur/lua.hoon+2−2
@@ -104,8 +104,8 @@
104+$ funcbody [pars=parlist body=blok]
104+$ funcbody [pars=parlist body=blok]
105+$ parlist [pars=(list name) wildcard=?]
105+$ parlist [pars=(list name) wildcard=?]
106+$ local-function [=name body=funcbody]
106+$ local-function [=name body=funcbody]
107−+$ local-asmnt [=attrnamelist rhs=(unit exprlist)]
107++$ local-asmnt [=attnamelist rhs=(unit exprlist)]
108−+$ attrnamelist (lest [=name attr=(unit attrib)])
108++$ attnamelist (lest [=name attr=(unit attrib)])
109+$ attrib
109+$ attrib
110 $?
110 $?
111 %const
111 %const