Capstone projects

Three projects, built one lesson at a time, with nothing new in the language: every rule the course taught is used again and none is introduced. The first is a JSON parser in five lessons, from the tokenizer to the writer that round-trips a document and the test table that finds the bugs. The second is a task tracker in five: the model, a file format, the command line, the errors that reach the user as a message and a non-zero exit code, and the tests. The third is a search index in four, from the tokenizer to the inverted index, the ranked query and the benchmark that makes the hot path faster.

123 Capstone 1: a JSON tokenizer the project layout, the token type and a lexer that walks a JSON document (C++ 137) Open 124 Capstone 1: the parser a recursive descent parser, the value type it builds and the errors it reports (C++ 138) Open 125 Capstone 1: a JSON value an enum of object, array, string, number, bool and null, with accessors and printing (C++ 139) Open 126 Capstone 1: writing JSON escape strings, indent nested values and round-trip the document (C++ 140) Open 127 Capstone 1: testing the parser a table of good and bad documents, a test runner and the bugs it finds (C++ 141) Open 128 Capstone 2: a task model a task with an id, a state and a due date, and the operations that keep it valid (C++ 142) Open 129 Capstone 2: saving tasks a line-based file format, load and save, and a corrupt line that is skipped (C++ 143) Open 130 Capstone 2: the command line parse subcommands, dispatch to handlers and print a task list (C++ 144) Open 131 Capstone 2: error handling Result through the layers, error messages for the user and a non-zero exit code (C++ 145) Open 132 Capstone 2: testing the tracker test the model, the storage and the commands, with a temporary file per test (C++ 146) Open 133 Capstone 3: a tokenizer split documents into words, normalise case and keep the positions (C++ 147) Open 134 Capstone 3: the inverted index map a word to the documents and positions that hold it, and build it from a directory (C++ 148) Open 135 Capstone 3: queries and ranking AND and OR queries, a ranked answer and a phrase search over positions (C++ 149) Open 136 Capstone 3: measure and speed it up time the index build and the queries, then improve the hot path and measure again (C++ 150) Open

Lessons