A tiny, hairless Lisp interpreter built in Godot. (Telly is my cat, he is a gmo bald man, photo included for reference)

This project is a super simple implementation of a Lisp-like language, along with a basic REPL for experimenting, learning, and building weird little things. It’s not trying to be complete or production-ready, just understandable, hackable, and fun.

Use it however you want:

  • learn how a Lisp interpreter works
  • poke around the evaluation model
  • steal it for your own games
  • build your own weird programming systems on top of it

It’s heavily inspired by the early ideas in Structure and Interpretation of Computer Programs: expressions, evaluation, and the idea that programs are processes.

Right now it supports a small subset of Lisp:

  • arithmetic
  • define
  • lambda (closures!)
  • recursion
  • a very basic environment model

There is also a REPL so you can experiment directly.

This is still very much a work in progress and almost certainly contains a world of bugs. Expect rough edges, missing features, and questionable design decisions.

If you want to understand interpreters, or just vibe with a tiny Lisp inside Godot, this is for you.

Download the source, break it, improve it, or build something strange with it.


--- Some programs to try

Basics

(+ 1 2)
(+ 1 (+ 2 3))
(- 10 3 2)
(* 2 3 4)
(/ 20 2 2)

Variables

(define x 5)
x
(define x 10)
(+ x 3)

Functions

(define square (lambda (x) (* x x)))
(square 5)

Functions Calling Functions

(define square (lambda (x) (* x x)))
(define sum-of-squares
  (lambda (a b)
    (+ (square a) (square b))))
(sum-of-squares 3 4)

Closures (Functions that remember)

(define make-adder
  (lambda (n)
    (lambda (x) (+ x n))))
(define add5 (make-adder 5))
(add5 10)

Inline Lambda

((lambda (x) (+ x 3)) 7)

Conditionals

(if (= 1 1) 42 0)
(if (= 1 2) 42 0)

Recursion

(define fact
  (lambda (n)
    (if (= n 0)
        1
        (* n (fact (- n 1))))))
(fact 5)

Fibonacci (slower, but fun)

(define fib
  (lambda (n)
    (if (< n 2)
        n
        (+ (fib (- n 1)) (fib (- n 2))))))
(fib 6)

Quote (Code as Data)

(quote (1 2 3))
(quote (+ 1 2))

Try Breaking It

x
(+ 1 unknown)
(define)
(if 1 2)

The Magic One

lisp is so cool

(define make-adder
  (lambda (n)
    (lambda (x) (+ x n))))
((make-adder 7) 3)




Download

Download NowName your own price

Click download now to get access to the following files:

lambda.zip 24 MB

Leave a comment

Log in with itch.io to leave a comment.