Skip to content
Back to the catalog
Project json-parserLanguagesBeginnerComing 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.

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.

JSON is the most boring format in the world, and that's exactly why it's the best place to learn to write parsers: its grammar fits on a napkin, yet it contains every idea you'll reuse later on real languages.

You'll build the parser in the two classic steps — tokenize, then assemble the tree — and finish it off with what separates an exercise from a usable tool: error messages that say what broke and on which line.

Roadmap

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

  1. Phase 13 stages

    From text to tokens

    Walk the input character by character and emit tokens: braces, commas, literals.

  2. Phase 22 stages

    From tokens to a tree

    A recursive descent parser for objects, arrays and nested values.

  3. Phase 32 stages

    The full specification

    Unicode escapes, scientific notation, and errors with line and column.

Before you start

A library that turns JSON text into your language's data structures: a tokenizer, a recursive descent parser, full coverage of the specification (numbers, strings with escapes and \uXXXX, nesting) and errors with line, column and context.

  • 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

  • lisp-interpreter
    Coming 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.

    Advanced11 stages~16 hLanguages
    parsingASTclosures+1

    Python · JavaScript · TypeScript

  • 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