Skip to content
/ llisp Public

Loïc Lisp Interpreter - A toy Lisp interpreter (one week project)

License

Notifications You must be signed in to change notification settings

dimtion/llisp

Repository files navigation

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 [email protected]: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

About

Loïc Lisp Interpreter - A toy Lisp interpreter (one week project)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published