Learn the fundamentals of compiler construction with this modernized implementation of Jack Crenshaw's classic step-by-step "Let's Build a Compiler" series. Originally written in Pascal and targeting the Motorola 68000 processor, this educational project has been updated to use Python and generate LLVM IR.
LLVM IR is a versatile intermediate representation that offers several benefits:
- Portability and Optimization: Enables efficient and portable code generation across multiple architectures and platforms.
- Platform Support: Targets a wide range of systems, including Windows, Linux, macOS, mobile devices, and embedded platforms, supporting architectures like x86, ARM, and RISC-V.
- Cross-Platform Capabilities: Simplifies cross-platform compilation, making this compiler a flexible and modern educational tool.
This project was developed and tested on Ubuntu 24.04 LTS with recent versions of Python, Clang, and LLVM. To follow along, ensure you have the following tools installed:
python3
clang
llc
opt
sudo apt update && sudo apt full-upgrade
sudo apt install python3 clang llvm lld llvm-dev