whatisgithub

What is craftinginterpreters?

munificent/craftinginterpreters — explained in plain English

Analysis updated 2026-06-24

10,755HTMLAudience · developerComplexity · 3/5Setup · moderate

In one sentence

A free online book and full source code for building two complete working programming language interpreters from scratch, one in Java, one in C, covering every step from reading characters to running closures and classes.

Mindmap

mindmap
  root((Crafting Interpreters))
    Two implementations
      jlox in Java
      clox in C
    Language built
      Lox scripting language
      Lexing and parsing
      Closures and classes
    Repo contents
      Book source
      Full interpreter code
      Test suite
    Audience
      Developers
      CS learners
    Build tools
      Dart
      Java
      C compiler
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Work through the book chapter by chapter to build a fully working scripting language interpreter in Java or C, with tests to verify your work at each stage.

USE CASE 2

Use the included test suite to check your own Lox interpreter written in a different language against the reference implementation.

USE CASE 3

Study the C source code for a real bytecode virtual machine to understand how scripting languages compile and execute programs under the hood.

What is it built with?

JavaCDartMakefile

How does it compare?

munificent/craftinginterpretersjavascript-tutorial/zh.javascript.infouiverse-io/galaxy
Stars10,75510,73910,678
LanguageHTMLHTMLHTML
Setup difficultymoderateeasyeasy
Complexity3/51/51/5
Audiencedeveloperdeveloperdesigner

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1day+

Building the full book site requires Dart, a C compiler, and Java, running just the interpreter code needs only a C compiler or Java.

So what is it?

Crafting Interpreters is a free online book that walks readers through building two complete programming language interpreters from scratch. The language being built is called Lox, and the book covers it twice: first in Java, producing an interpreter called jlox, and then in C, producing a faster, bytecode-based interpreter called clox. Both full implementations are included in this repository. The book is aimed at people who want to understand how programming languages actually work under the hood. No prior experience with compilers or interpreters is assumed. The author takes readers step by step through lexing, parsing, evaluating expressions, handling variables, functions, closures, and classes, explaining each concept in plain terms before showing the code that implements it. This repository contains not just the finished interpreter code but also the Markdown source for every chapter of the book, along with a custom build system that weaves prose and code together into the final website at craftinginterpreters.com. The build is driven by Dart scripts and a Makefile. Running it locally requires Dart, a C compiler, and Java. There is also a full test suite for both interpreters. The tests can be run against any chapter's version of the code, not only the final build. This lets readers verify that the interpreter is working correctly even midway through the book. The test runner also accepts custom interpreter executables, so anyone who writes their own Lox implementation in another language can use the same tests to check it. If you find a typo or error in the book, you can file a GitHub issue or send a pull request. A community wiki page lists Lox implementations written in other languages by readers who worked through the material.

Copy-paste prompts

Prompt 1
I am following Crafting Interpreters and just finished the jlox scanner chapter. Show me how to run the test suite against my current implementation to check which tests pass.
Prompt 2
In the clox bytecode VM from Crafting Interpreters, how does the chunk structure store both opcodes and their source line numbers? Explain and show the relevant C struct.
Prompt 3
I want to implement the Lox language in Python by following Crafting Interpreters. How do I use the book's test suite with my own Python interpreter executable?
Prompt 4
Explain how closures are implemented in the jlox Java interpreter from Crafting Interpreters. What is an Environment object and how does it chain to capture variables from outer scopes?
Prompt 5
How do I build the Crafting Interpreters book website locally from source? What tools do I need and what command do I run?

Frequently asked questions

What is craftinginterpreters?

A free online book and full source code for building two complete working programming language interpreters from scratch, one in Java, one in C, covering every step from reading characters to running closures and classes.

What language is craftinginterpreters written in?

Mainly HTML. The stack also includes Java, C, Dart.

How hard is craftinginterpreters to set up?

Setup difficulty is rated moderate, with roughly 1day+ to a first successful run.

Who is craftinginterpreters for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.