Skip to content
Back to the catalog
Project lisp-interpreterLanguagesAdvancedComing soon

Build your own Lisp interpreter

Build a Lisp interpreter from scratch. Write a tokenizer, parser and evaluator, then add closures to discover how a language executes your code.

Build it in your language

The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.

Guide language

The stage guides read in this language. Only languages this project is fully translated into show up here; the interface language does not change.

What this project is about

Project in preparation: we are completing and verifying the implementation path and its tests. The capabilities below describe the project goal; starting the project is not enabled yet.

Lisp was chosen for one reason: its syntax is so minimal that the parser gets out of the way in an afternoon, letting you spend the rest of the challenge on the interesting part, which is evaluation.

You'll build a full interpreter: environments, functions, closures, recursion and macros. By the end you'll understand what your favourite language does between hitting “run” and the result appearing.

Roadmap

11 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.

  1. Phase 13 stages

    Reading expressions

    Tokenizer, S-expression reader, and representing atoms and lists.

  2. Phase 23 stages

    Evaluating

    Environments, variables, arithmetic, conditionals and special forms.

  3. Phase 33 stages

    Functions and closures

    Lambdas, lexical scope, recursion and optimised tail calls.

  4. Phase 42 stages

    Code that writes code

    Quote, macros, errors with a trace, and a small library.

Before you start

An interpreter for a Lisp dialect: an S-expression reader, an evaluator over chained environments, user-defined functions with closures, conditionals, recursion with tail-call optimisation, error handling, and macros that generate code.

  • regex-engine
    Beta

    Build your own regex engine

    Build a regex engine from scratch. Turn expressions into automata with backtracking, groups and character classes without using a regex library.

    Advanced8 stages~11 hLanguages
    automataparsingbacktracking

    TypeScript · Python · Rust

  • json-parser
    Coming soon

    Build your own JSON parser

    Build a JSON parser from scratch. Tokenize input, parse the grammar, construct a syntax tree and report useful errors for invalid JSON.

    Beginner7 stages~6 hLanguages
    tokenizerparsingrecursion

    TypeScript · Python · Go · Java

  • mini-compiler
    Coming soon

    Build your own compiler

    Build a compiler from scratch. Turn source code into bytecode with lexing, an AST, semantic analysis, code generation and a virtual machine.

    Expert16 stages~30 hLanguages
    lexerASTbytecode+1

    Rust · C++ · TypeScript