this post was submitted on 20 Jun 2026
7 points (88.9% liked)

Lisp Community

881 readers
2 users here now

A community for the Lisp family of programming languages.

Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1958, Lisp is the second-oldest high-level programming language. Only Fortran is older, by one year.

Related communities

Language references

Tools

Tutorials/FAQS

Useful Lisp resources

Search

Videos

Common Lisp

Clojure

Racket

Scheme

Books

Food for thought

Implementations

Events

founded 7 years ago
MODERATORS
 

In honor of the contributions made by Church and McCarthy, I wrote this project and the accompanying article to show how anyone can write a tiny Lisp interpreter in a few lines of C or in any "C-like" programming language for that matter. I attempted to preserve the original meaning and flavor of Lisp as much as possible. As a result, the C code in this project is strongly Lisp-like in compact form. Despite being small, these tiny Lisp interpreters in C include 21 built-in Lisp primitives, simple garbage collection and REPL, which makes them a bit more practical than a toy example. If desired, more Lisp features can be easily added with a few more lines of C as explained in my article with examples that are ready for you to try.

There is more: two sequels to tinylisp

In addition to tinylisp, I've written two other small classic Lisp implementations that share similarities with tinylisp, but expanded to include over 40 built-in Lisp primitives, strings, macros, exceptions, execution tracing, file loading, and a REPL:

  • Lisp in 1k lines of C with garbage collector, explained uses mark-sweep/compacting garbage collection. Unlike tinylisp however, a separate pool of free cons pair cells is used to construct lists. The garbage collector frees up space in the pool using mark-sweep. Space is freed up in the atom/string heap by compacting the heap after mark-sweep using pointer reversal.
  • Lisp in 1k lines of C with Cheney's copying garbage collector, explained uses Cheney's copying garbage collector. Like tinylisp, a stack is used to efficiently construct lists, i.e. by pushing two cells at a time on the stack to allocate cons pairs. Heap allocation simply pushes atom/string space up from the bottom of the heap (towards the stack). The garbage collector frees up stack and heap space by copying the active cons pair cells, atoms and strings to a new stack/heap.
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here