Capstone 1, a JSON reader and writer

The first project is a JSON reader and writer built from nothing: a tokenizer, a recursive descent parser, a value type, and a writer that prints the document back. Errors carry a line and a column, table tests and a fuzz target guard the parser, and a command line tool puts it in a shell. The part ends with a benchmark against encoding/json.

10.1 Capstone 1: a JSON tokenizer the project layout, the token type and a lexer that walks a JSON document Open 10.2 Capstone 1: the parser a recursive descent parser, the value type it builds and the errors it reports Open 10.3 Capstone 1: the value type an object, an array, a string, a number, a bool and null, with accessors and printing Open 10.4 Capstone 1: the writer escape strings, indent nested values and round-trip the document Open 10.5 Capstone 1: errors with positions a line and a column in the error, the offset carried through the parser and a message a user can act on Open 10.6 Capstone 1: table tests and fuzzing a table of good and bad documents, a fuzz target and the bug it finds Open 10.7 Capstone 1: the command line tool a flag, a file argument, the exit codes and the output format Open 10.8 Capstone 1: benchmarks against encoding/json a benchmark of both parsers, -benchmem and what the standard library does better Open

Lessons