Skip to content
Back to the catalog
Project lisp-interpreterLanguagesAdvancedBeta

A Lisp interpreter

Tokenizer, parser, evaluator and closures. Discover how a language runs your code, step by step.

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

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.

    1. 01Tokenizer
    2. 02Atoms and lists
    3. 03Reader errors
  2. Phase 23 stages

    Evaluating

    Environments, variables, arithmetic, conditionals and special forms.

    1. 01Environments and symbols
    2. 02Arithmetic and comparison
    3. 03Definitions and conditionals
  3. Phase 33 stages

    Functions and closures

    Lambdas, lexical scope, recursion and optimised tail calls.

    1. 01Lambdas
    2. 02Closures and lexical scope
    3. 03Tail recursion
  4. Phase 42 stages

    Code that writes code

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

    1. 01Quote and macros
    2. 02Traces and 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.

  • json-parser
    Beta

    A JSON parser

    Your first contact with lexers and grammars. Tokenize, build the tree and fail with useful errors.

    Beginner7 stages~6 hLanguages
    tokenizerparsingrecursión

    TypeScript · Python · Go · Java

  • mini-compiler
    Beta

    A mini compiler to bytecode

    From source code to runnable bytecode. Lexing, AST, semantic analysis, code generation and a VM that runs it.

    Expert16 stages~30 hLanguages
    lexerastbytecode+1

    Rust · C++ · TypeScript

  • regex-engine
    Beta

    A regular expression engine

    From the expression to the automaton. Backtracking, groups and character classes without your language's regex.

    Advanced8 stages~11 hLanguages
    autómatasparsingbacktracking

    TypeScript · Python · Rust