yasih
yasih copied to clipboard
Yet another Scheme implemented in Haskell
yasih - Yet Another Scheme in Haskell
A small scheme interpreter written following the tutorial book "Write Yourself a Scheme in 48 Hours" to learn both Haskell and Scheme in detail. Discontinued. Yasih has been a fun learning experiment!
Installation
Clone the repo
git clone https://github.com/0x0f0f0f/yasih
cd yasih
Install
# Compile and the binary
stack install
# Copy the standard library to an include path
mkdir -p ~/.local/lib/yasih/
cp stdlib/stdlib.scm ~/.local/lib/yasih/stlib.scm
Usage
The binary yasih
accepts a program as the first
argument, if no argument is passed then a REPL will be started.
If -e
is passed as an option the first argument will be evaluated as an expression.
yasih -e "(+ 2 3)"
5
Usage of rlwrap when using the REPL is suggested, it enables readline features such as arrow keys in the interpreter and bash-like keybindings
rlwrap yasih
λ> (define (map f l) (if (null? l) l (cons (f (car l)) (map f (cdr l)))))
(lambda ("f" "l") ...)
λ> (map (lambda (x) (+ 1 x)) '(1 2 3 4))
(2 3 4 5)
Documentation
Check out the docs
Examples
To try the examples in the examples
directory run:
cd examples
rlwrap yasih file.scm
Testing
There are work in progress integration tests.
To test the R5RS coverage status run
SILENT=true ./integration-tests/r5rs-coverage.sh
To run general integration tests run
SILENT=true ./integration-tests/integration-test.sh
How to forkbomb :)
((lambda (x) (x (x x))) (lambda (x) (x (x x))))