Compilers Resources

- compilers

This post is a compilation of great resources I found while building a type checker for Python. These resources are free and highly focused on specific topics, making them ideal for learning by doing rather than sifting through extensive materials.

Parser

When it comes to writing a parser, your approach depends on your project’s goals. For compilers or interpreters, you can use a parser generator. However, if you’re working on tools like formatters or language servers, your parser needs to handle broken code gracefully.

Stanford Compilers Class

For a comprehensive understanding of relevant topics, consider following the Stanford Compilers Class. Although I haven’t watched it personally, I found this guide based on the class quite helpful.

Crafting Interpreters

It goes without saying that “Crafting Interpreters” is an indispensable resource for this journey. I recommend reading it chapter by chapter as you build your project.

Symbol Table

This series on the Python symbol table implementation from Eli Bendersky is useful for learning how does a symbol table works:

Semantic Analyzer

While resources specific to the semantic analysis phase are scarce, you can find inspiration and solutions in existing projects:

Type Checking

To delve deeper into type checking, it’s often best to study code from various projects:

Programming Language Zoo

If your language closely resembles one of those in the Programming Languages Zoo, studying their code can be immensely helpful due to their brevity and simplicity.

Explaining Rust Analyzer

For a comprehensive understanding of language servers, file systems, updates, and testing, check out this YouTube playlist.

LSP (Language Server Protocol)

Implementing the Language Server Protocol (LSP) can be simplified with Tower LSP, a powerful tool for quick setup. If you choose to implement the LSP protocol yourself, you can use it as a reference.

Oxc

you can explore the oxc GitHub repository. This repository provides a great implementation of a set of JS tools. You can delve into different packages within the codebase to understand the design patterns used for each part and how they are implemented.

Final Words

After this journey I found out that nothing is more fun than compilers. If you know more resources, please send them to me.