LIPS is a Lisp dialect striving for elegant simplicity and performance.
The core is implemented in strict C99 which should make it easy to compile with most compilers. Besides a C compiler and make, LIPS requires libao and readline.
On Debian-derieved these are easily:
apt-get install build-essential libreadline-dev libao-dev
The latest version of LIPS is available from the repository
git clone https://github.com/martinolsen/lips
Compile and test the code:
make clean all run-test
There, this is pretty much all it does right now.
Integers are simple numbers
42
=> 42
Strings are denoted by enclosing double-quotes
"Hello world!"
=> "Hello world!"
Macros are expanded by the reader, just before evaluation.
To indicate an error, simply call ERROR
with an identifying symbol:
(ERROR 'MY-ERROR)
To handle errors, define a lambda as *ERROR-HANDLER*
:
(LABEL *ERROR-HANDLER*
(LAMBDA (C) (PRINT "Error!")))
The identifying symbol is passed to the error handler:
(LABEL *ERROR-HANDLER*
(LAMBDA (C)
(COND ((EQ C 'MY-ERROR) (PRINT "My bad!")))))
If the error handler returns NIL
, the error is treated as not handled.
The UNBOUND-SYMBOL
error accurs when a symbol is not bound to a value
(defined).