Skip to content
Loïc Lisp Interpreter - A toy Lisp interpreter
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
llisp
project_euler
tests
.flake8
.gitignore
.isort.cfg
.pre-commit-config.yaml
.travis.yml
LICENSE
Makefile
README.md
pyproject.toml
requirements.txt
setup.py

README.md

Loïc Lisp Interpreter (Llisp)

Build Status Coverage Status Code style: black GitHub license

A simple Lisp interpreter for educational purposes.

Installation and usage

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
>>>

Some examples commands:

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

Features

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
You can’t perform that action at this time.