A simple Lisp interpreter for educational purposes.
Clone the repository and install:
git clone git@github.com:dimtion/llisp.git
cd llisp
pip install .
You can launch a REPL with the following command line:
$ llisplang
Welcome to Loïc Lisp interpreter (llisp)
Type exit to exit
>>>
Prompt a variable:
>>> 5
<<< 5
>>> (+ 2 3)
<<< 5
Variable declaration and assignation:
>>> (var n 10)
<<< n
>>> (* 5 n)
<<< 50
Function declaration and function call:
>>> (def (sum x y) (+ x y))
<<< sum
>>> (sum 33 17)
<<< 50
List management:
>>> (var l (list 1 2 3))
<<< l
>>> l
<<< [(AtomTypes.NUM) 1, (AtomTypes.NUM) 2, (AtomTypes.NUM) 3]
>>> (pop l)
<<< [(AtomTypes.NUM) 2, (AtomTypes.NUM) 3]
>>> (push 0 l)
<<< [(AtomTypes.NUM) 0, (AtomTypes.NUM) 1, (AtomTypes.NUM) 2, (AtomTypes.NUM) 3]
>>> (el l)
<<< 1
Those are the features that are currently implemented, more to come in the future:
- REPL and file source code input
- Arithmetic operators (int, floats)
- Variable declaration and assignation
- Branching with conditionals if
- Function declaration and call
- Recursive functions
- List manipulation
- String manipulation
- Standard library