kat is a basic scheme interpreter written in C++. In order to build kat from sources, the
following are required:
- cmake
If all requirements are met, perform the following steps:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -G Ninja ../
ninja
You can run kat by typing:
./kat
and then you can type the well known Y-combinator to get yourself started :)
(define Y
(lambda (f)
((lambda (x) (f (lambda (y) ((x x) y))))
(lambda (x) (f (lambda (y) ((x x) y)))))))
(define factorial
(Y (lambda (fact)
(lambda (n)
(if (= n 0)
1
(* n (fact (- n 1))))))))
(write (factorial 5))
kat is a work in progress and under heavy construction. Since no error handling is implemented,
the interpreter will exit (or crash) on bad input.
The following functions are implemented:
null?boolean?symbol?integer?char?string?pair?procedure?char->integerinteger->charnumber->stringstring->numbersymbol->stringstring->symbol+-*quotientremainder=<>conscarcdrset-car!set-cdr!listeq?applyinteraction-environmentnull-environmentenvironmentevalloadopen-input-portclose-input-portinput-port?open-output-portclose-output-portoutput-port?readread-charpeek-charwritewrite-chareof-object?errordisplay
- v0.26 Added the
displayprimitive procedure. - v0.23 A very simple object pooling strategy is implemented. The number of memory allocations decreased dramatically.
- v0.22 A mark & sweep garbage collector is now used for memory hadling
- v0.21 Added stdlib.scm. This file contains more function definitions written in scheme.
- v0.20 Some basic I/O functions added.