Compare commits

..

2 commits

Author SHA1 Message Date
able 30bdd44ba5 minor changes 2024-05-03 13:48:10 -05:00
able 3a37525c65 More examples 2024-05-03 13:43:17 -05:00
6 changed files with 32 additions and 8 deletions

10
examples/comparison.lisp Normal file
View file

@ -0,0 +1,10 @@
(eq 1 1) ; True
(eq 1 2) ; False
(define a (λ () (+ 1 2 3)))
(define b (lambda () (+ 1 2 3)))
(eq a b) ; True
(eq () nil) ; True
(eq () (eval ())) ; True

View file

@ -1,3 +1,3 @@
(define a 10)
(define b 20)
(define c (+ a b))
(define c (lambda () (+ a b)))

3
examples/eval.lisp Normal file
View file

@ -0,0 +1,3 @@
(eval
(quote
(+ 1 2)))

View file

@ -1,2 +1,7 @@
(define a (λ () (+ 1 2 3)))
(a)
(define a
(λ ()
(+ 1 2 3)))
(define b
(lambda ()
(+ 1 2 3)))

9
examples/repl.lisp Normal file
View file

@ -0,0 +1,9 @@
(define repl
(lambda () (
(print "λ -> ")
(print
(eval
(read)))
(print "\n")
(repl))))
(repl)

7
lasp.S
View file

@ -5,7 +5,7 @@ li64 r13, 0
;; r253 will be the offset from the stack pointer specified by the spec to be r254
li64 r253, 0
; Load first char
ldr r12, r13, lisp, 1
loop:
@ -27,6 +27,7 @@ loop:
; push the char onto the stack
jmp push_u64_stack
; loop :skull:
jmp loop
tx
@ -63,10 +64,6 @@ closed_paren:
jmp log_lisp_error
eval_stack:
jmp pop_u64_stack
jmp panic
panic:
jmp log_lisp_error
lisp: