Need to make partial_eval_helper able to fail though, so that it can fail in the now fallible compiler. Squashed commit of the following: commit 283150d1e19cf9f74bc32e9c554f5e041d53582d Author: Nathan Braswell <miloignis@gmail.com> Date: Tue Jan 18 00:14:51 2022 -0500 Another bugfix, I think now we're truely running into the partial-eval needs to be able to fail part commit c62c228a1e89e7922850d2070bc046e5f80af5a5 Author: Nathan Braswell <miloignis@gmail.com> Date: Mon Jan 17 23:34:19 2022 -0500 Fixed needed check, added note on needing to support failing partial eval commit d480e486210dd5c7c4842e3a3d3e447dc7a5274e Author: Nathan Braswell <miloignis@gmail.com> Date: Mon Jan 17 22:14:58 2022 -0500 Fixed compilation bugs, added debugging prints to running. commit fc4dc4d3170bf1ceb4cd934cff54dd9ce6c8713a Author: Nathan Braswell <miloignis@gmail.com> Date: Mon Jan 17 17:28:29 2022 -0500 The unique id / ctx refactor is starting to work, with all basic test cases compiling & partial evaling, but mis-compile bugs remaining
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
|
|
|
|
((wrap (vau root_env (quote)
|
|
((wrap (vau (let1)
|
|
|
|
|
|
(let1 lambda (vau se (p b1) (wrap (eval (array vau p b1) se)))
|
|
(let1 current-env (vau de () de)
|
|
(let1 cons (lambda (h t) (concat (array h) t))
|
|
(let1 lapply (lambda (f p) (eval (cons (unwrap f) p) (current-env)))
|
|
(let1 vapply (lambda (f p ede) (eval (cons f p) ede))
|
|
(let1 Y (lambda (f)
|
|
((lambda (x1) (x1 x1))
|
|
(lambda (x2) (f (lambda (& y) (lapply (x2 x2) y))))))
|
|
;(let1 vY (lambda (f)
|
|
; ((lambda (x3) (x3 x3))
|
|
; (lambda (x4) (f (vau de (& y) (vapply (x4 x4) y de))))))
|
|
;(let1 let (vY (lambda (recurse) (vau de (vs b) (cond (= (len vs) 0) (eval b de)
|
|
; true (vapply let1 (array (idx vs 0) (idx vs 1) (array recurse (slice vs 2 -1) b)) de)))))
|
|
|
|
|
|
(array 'open 3 "test_self_out" (lambda (fd code)
|
|
(array 'write fd "wabcdefge" (lambda (written code)
|
|
(array 'exit written)))))
|
|
|
|
;(array 'write 1 "test_self_out2" (vau (written code) 1))
|
|
|
|
|
|
; end of all lets
|
|
)))));))
|
|
)
|
|
|
|
; impl of let1
|
|
; this would be the macro style version (((;)) (vau de (s v b) (eval (array (array wrap (array vau (array s) b)) v) de)))
|
|
)) (vau de (s v b) (eval (array (array vau (array s) b) (eval v de)) de)))
|
|
; impl of quote
|
|
)) (vau (x5) x5))
|
|
|
|
|
|
|
|
;(array 'write 1 "test_self_out2" (vau (written code) 1))
|