lisper
lisper copied to clipboard
A tiny scheme interpreter in Haskell
$ stack exec lisper λ (define (range a b) (if (> a b) '() (cons a (range (+ a 1) b)))) λ (range 1 8) Undefined primitive function "range"
This can act as a stdlib and can go a long way.
`error` makes it hard to handle exceptions consistently and gracefully. Use the Either monad everywhere
Primitives must be defined and added to a default environment rather than the current approach. It will make evaluation simpler and will give complete access to them. Cannot use `+`...
`(+ "a" "b")` fails with error `lisper: Expected number; got "b" instead`. The error should be about `a`, not ` b`
References 1. http://www.stephendiehl.com/posts/strings.html 1. https://github.com/ivan-m/wl-pprint-text 1. http://hackage.haskell.org/package/wl-pprint-1.2/docs/Text-PrettyPrint-Leijen.html
Initial thoughts here acbeb0f9ee2410495467983810598a14c817f15a