Building a subset of Lisp written in C to learn both languages - tutorial at http://www.buildyourownlisp.com
cc
compiler for Clang (change togcc
inclisp.sh
at will)mpc
(Micro Parser Combinator) library, included in source already- Other standard C libraries:
stdio.h
,stdlib.h
,math.h
To run the interactive console, pull this repository and then in your terminal, run:
# Each new revision of the 'clisp' language has its own file
# the latest being 'variables.c'
./clisp.sh variables
- S-Expression (evaluatable)
- Q-Expression (can be written as code inside data)
- Environment for containing variables defined and retrieving them
- Functions (builtin)
- Arithmetic (
+
,-
,*
,/
,%
,^
,max
,min
) - List-processing (
list
,head
,tail
,eval
,join
,cons
,len
,init
) - Definition (
def
) for numerical variables so far, supporting tuple assignment (e.g.def {a b c} 1 2 3
) - Exit (
exit ()
) - All defined variables (
env ()
)
- Arithmetic (
- Rich error reports and error-as-expression