Skip to main content
Commonmark migration
Source Link
added 58 characters in body
Source Link
Sylwester
  • 3.8k
  • 16
  • 28

It's impossible to implement the whole Zozotez in Zozotez since it does not have means of mutating cons and : (setq/define) need that to update bindings. I also didn't implement explicit begin/progn or list&rest argument, macros and special printing arguments since I didn't use it in the interpreter. I did include p (print) even though I don't use it so programs need to explicit print their calculations just like the original interpreter.

It's impossible to implement the whole Zozotez in Zozotez since it does not have means of mutating cons. I also didn't implement explicit begin or list argument, macros and special printing arguments since I didn't use it in the interpreter. I did include p (print) even though I don't use it so programs need to explicit print their calculations just like the original interpreter.

It's impossible to implement the whole Zozotez in Zozotez since it does not have means of mutating cons and : (setq/define) need that to update bindings. I also didn't implement explicit begin/progn or &rest argument, macros and special printing arguments since I didn't use it in the interpreter. I did include p (print) even though I don't use it so programs need to explicit print their calculations just like the original interpreter.

Source Link
Sylwester
  • 3.8k
  • 16
  • 28

#Zozotez LISP: 414

linefeeds added to get a nice block is not needed and not counted.

((\(E V A L)(E(r)'(())))(\(x e)(?(s x)(V x e)((\(b j)(?(= b ")(a j)(?(= b \)x (?(= b ?)(?(E(a j)e)(E(a(d j))e)(E(a(d(d j)))e))(?(s b)(A b(E(a j)e)(E(a(d j) )e))(E(a(d(d b)))(L(a(d b))j e)))))))(E(a x)e)(d x))))(\(x g)(? g(?(= x(a(a g)))(d(a g))(V x(d g)))x))(\(f h v)(?(= f r)(r)(?(= f p)(p h)(?(= f s)(s h)(? (= f a)(a h)(?(= f d)(d h)(?(= f =)(= h v)(c h v))))))))(\(k v i)(? k(L(d k)( d v)(c(c(a k)(E(a v)i))i))i))) 

In theory it should be able to run itself, but since the original interpreter is a BrainFuck binary and itself an interpreter I have only been able to test each part. When given itself and a simple expression (p p) I think it needs more time than the 40 minutes I have waited so far and I'm using my fast jitbf to run it which (mis)uses Perl Inline-C to run C code on the fly.

It's impossible to implement the whole Zozotez in Zozotez since it does not have means of mutating cons. I also didn't implement explicit begin or list argument, macros and special printing arguments since I didn't use it in the interpreter. I did include p (print) even though I don't use it so programs need to explicit print their calculations just like the original interpreter.

The same ungolfed:

;; A stand alone Zozotez script need to be ;; contained in one expression, here with ;; all functions provided as arguments to ;; get them bound in the dynamic environment ((\ (E V A L) (E(r)'(()))) ;; E (EVAL) (\ (x e) (? (s x) (V x e) ((\ (b j) (? (= b ") (a j) (? (= b \) x (? (= b ?) (? (E(a j)e) (E(a(d j))e) (E(a(d(d j)))e)) (? (s b) (A b (E(a j)e) (E (a(d j))e)) (E (a(d(d b))) (L(a(d b))j e))))))) (E (a x) e)(d x)))) ;; V (VALUE / symbol->value) (\ (x g) (? g (? (= x (a (a g))) (d (a g)) (V x (d g))) x)) ;; A (APPLY) but just for primitives (\ (f h v) (? (= f r) (r) (? (= f p) (p h) (? (= f s) (s h) (? (= f a) (a h) (? (= f d) (d h) (? (= f =) (= h v) (c h v)))))))) ;; L ( joint evLis / extend-env) (\ (k v i) (? k (L (d k) (d v) (c (c (a k) (E (a v) i)) i)) i)))