Compilers, Interpreters and Formal Languages
Please rate the course
Course short description
This course is a beginner-friendly introduction to compilers. We will gradually develop an interpreter for a simple scripting language.
We will cover:
- Lexical analysis
- Syntax analysis
- Parsing algorithms
- Intermediate Representation (AST)
- Formal languages and grammars
- Backus-Naur Form (BNF) and syntax diagrams
- Error detection and handling
- Code generation
- Creating your own virtual machine (VM)
- Bytecode generation
- Type checking
- LLVM IR
- Basic code optimization
- ...and much more!
Compilers have always been considered a complex topic, and their historical association with "dragons" (starting with the Dragon Book) only added to this myth's mystique. We will try to explain everything with beginners in mind. This course can be called a "first course" on compilers for developers who have not yet written interpreters.
What We Will Create
We will develop a compiler for a simple programming language called Pinky. It will be a hypothetical scripting language with syntax inspired by Lua and ALGOL W.
The main language for the course will be Python, which will allow us to focus on compiler-specific concepts while remaining productive. In addition, we will provide useful tips for implementing these ideas in the C language.
Required Tools
All you need is a command line, a simple text editor, and a Python interpreter. These tools are cross-platform, so you will be able to work on Windows, macOS, or Linux.
The course does not require prior knowledge, but knowing the basics of programming (if-else, loops, functions) will help you better grasp the material.