Hi,
i am very interested in language simplicity.
Brainfuck is my favorite language ATM.
http://www.nada.kth.se/~matslina/awib/
Could i build lisp compiler with brainfuck compiler?
westerp@lemur /l/n/w/a/zozotez> jitbf zozotez.bf
;; create REPL by running a anonymous lambda == \ expression.
((\
(set quote lambda cons car cdr if eq atom flambda print read eval au-revoir REPL list setq)
(print '(Bonjour to Zozotez REPL classic LISP1. (au-revoir) to exit.) NIL)
(REPL))
;; the arguments to this anonymous function
: " \ c a d ? = s ~ p r e ; builtins
(\ () 'au-revoir) ; exit-function
(\ () ; REPL
(print 'Zozotez-moi~>())
(if (eq (print(eval(read))) 'au-revoir) () (REPL)))
(\ q q) ; list
(~ ($s $o) (list set (list quote $s) $o))) ; setq (last argument)
Bonjour to Zozotez REPL classic LISP1. (au-revoir) to exit.
Zozotez-moi~>(setq + (lambda (x y) (if x (cons (car x) (+ (cdr x) y)) y)))
#'(\ (x y) (if x (cons (car x) (+ (cdr x) y)) y))
Zozotez-moi~>(setq - (lambda (z w) (if w (- (cdr z) (cdr w)) z)))
#'(\ (z w) (if w (- (cdr z) (cdr w)) z))
Zozotez-moi~>(setq fibonacci (lambda (n a1 a2) (if n (fibonacci (- n '(1)) a2 (+ a2 a1)) a1)))
#'(\ (n a1 a2) (if n (fibonacci (- n (" (1))) a2 (+ a2 a1)) a1))
Zozotez-moi~>(fibonacci '(1 1 1 1 1 1 1 1 1) () '(1))
(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1)
Zozotez-moi~>(au-revoir)
au-revoir
((:'@(\()(p'Zozotez-moi~>())(p(e(r)))(@)))) ; a REPL
Zozotez-moi~>(: 'last
(\ (in)
(? (d in)
(last (d in))
in)))
#'(\ (in) (? (d in) (last (d in)) in))
Zozotez-moi~>(last '(a b c))
(c)
Users browsing this forum: No registered users and 1 guest