Compilers, Interpreters & Formal Languages
Source: https://pikuma.com/courses/create-a-programming-language-compiler
This course is designed to be a beginner-friendly introduction to compilers. As we evolve, we will incrementally put together an interpreter for a very simple scripting language.
We’ll cover:
- Lexical analysis
- Syntax analysis
- Parsing algorithms
- Intermediate representation (AST)
- Formal languages & grammars
- BNF notation & syntax diagrams
- Identifying and reporting errors
- Code generation
- Writing our own VM
- Emitting opcodes and instructions
- Type checking
- …and much, much more!
Compilers always had a reputation for being a difficult topic, and their historical association with dragons 🐉 (starting with the Dragon Book) never really help the cause. make your own programming language
We’ll try to approach every explanations with beginners in mind. You can think of it as a “first course” on compilers for developers that never wrote an interpreter before. What we’ll build
We’ll build together, from the ground up, a compiler for a simple programming language called Pinky. Think of a toy scripting language with a syntax inspired by Lua and ALGOL W.
x := 0
pi := 3.141592
name := 'Pinky'
-------------------------------------
-- Find the max between two numbers
-------------------------------------
func max(a, b)
if a > b then
ret a
end
ret b
end
-------------------------------------
-- Compute the factorial of a number
-------------------------------------
func factorial(n)
if n == 1 then
ret 1
else
ret n * factorial(n - 1)
end
end
-------------------------------------
-- Main function
-------------------------------------
func main()
i := 0
while i <= 10 do
print(i)
i := i + 1
end
for i := 1, 10 do
print(factorial(i))
end
end
main()
Our main host language will be Python. Python allows us to focus our attention on compiler-specific concepts while being extremely productive. Still, I’ll try to include some helpful tips on how to implement the ideas we just learned using the C programming language.
Download Links
Password: cms.ddpanda.org
Related Courses & Lessons
Keep learning from this topic
ES6, ES7 & ES8, TIME to update your JavaScript / ECMAScript!
ECMAScript Next is here. It's time to modernize your JavaScript.
The Complete Android 15 Course [Part 1]-Master Java & Kotlin
Learn Android App Development in both Java & Kotlin Languages. You'll master Android from ZERO to HERO
Functional Programming in C++
Functional Programming in C++ teaches developers the practical side of functional programming and the tools that C++ provides to develop...
Getting Started: Rust
Learn how to get started with Rust, from the basics of memory management to building and testing a web API...
Object Oriented Design And Programming
Master Object-Oriented Programming concepts, UML, Classes, Objects, Inheritance, Polymorphism, Encapsulation, and Design



