Skip to content

0. preamble

This tutorial will walk you step-by-step through building a lexer and Pratt parser for the C language. By the end, you’ll understand how real-world compilers work.

Diagram

You only need basic programming experience. You don’t need to know Rust or C. The tutorial introduces most of the needed concepts as we go.

I will skip writing tests within this tutorial, but as you go, you should test code that you wrote.

Feel free to experiment! Modify the syntax, add new operators. It will help you solidify the knowledge..