Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

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

Topics

Resources

License

Releases

No releases published

Packages

No packages published