Skip to main content

Programming Language with LLVM

2h 46m 4s
English
Paid

Course description

How programming languages work under the hood? What’s the difference between compiler and interpreter? What is a virtual machine, and JIT-compiler? And what about the difference between functional and imperative programming?

There are so many questions when it comes to implementing a programming language!

The problem with “compiler classes” in school is such classes are usually presented as some “hardcore rocket science” which is only for advanced engineers.

Moreover, classic compiler books start from the least significant topic, such as Lexical analysis, going straight down to the theoretical aspects of formal grammars. And by the time of implementing the first Tokenizer module, students simply lose an interest to the topic, not having a chance to actually start implementing a programing language itself. And all this is spread to a whole semester of messing with tokenizers and BNF grammars, without understanding an actual semantics of programming languages.

I believe we should be able to build and understand a full programming language semantics, end-to-end, in 4-6 hours — with a content going straight to the point, showed in live coding sessions as pair-programming and described in a comprehensible way.

In the Programming Language with LLVM class we focus on compiling our language to LLVM IR, and build a lower-level programming language. Working closely with the LLVM compiler infrastructure level you will understand how lower-level compilation and production-level languages, such as C++, Rust, etc work today.

Implementing a programing language would also make your practical level in other programming languages more professional.

Read more about the course

Prerequisites

There are three prerequisites for this class.

The Programming Language with LLVM course is a natural extension for the previous classes — Building an Interpreter from scratch (aka Essentials of Interpretation), where we build also a full programming language, but at a higher, AST-level, and also Building a Virtual Machine. Unless you already have understanding of how programming languages work at this level, i.e. what eval, a closure, a scope chainenvironments, and other constructs are — you have to take the interpreters class as a prerequisite.

Also, going to lower (bitcode/IR) level where production languages live, we need to have basic C++ experience. This class however is not about C++, so we use just very basic (and transferrable) to other languages constructs.

Who this class is for?

This class is for any curious engineer, who would like to gain skills of building complex systems (and building a programming language is an advanced engineering task!), and obtain a transferable knowledge for building such systems.

If you are interested specifically in LLVM, its compiler infrastructure, and how to build your own langauge, then this class is also for you.

What is used for implementation?

Since lower-level compilers are about performance, they are usually implemented in a low-level language such as C or C++. This is exactly what we use as well, however mainly basic features from C++, not distracting to C++ specifics. The code should be easily convertible and portable to any other language, e.g. to Rust or even higher-level languages such as Python. Using C++ also makes it easier implementing further JIT-compiler.

Note: we want our students to actually follow, understand and implement every detail of the LLVM compiler themselves, instead of just copy-pasting from final solution. Even though the full source code for the language is presented in the video lectures, the code repository for the project contains /* Implement here */ assignments, which students have to solve.

Watch Online

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 20 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Introduction to LLVM IR and tools

All Course Lessons (20)

#Lesson TitleDurationAccess
1
Introduction to LLVM IR and tools Demo
13:34
2
LLVM program structure | Module
06:18
3
Basic numbers | Main function
10:21
4
Strings | Printf operator
06:44
5
Parsing: S-expression to AST
10:24
6
Symbols | Global variables
06:40
7
Blocks | Environments
10:00
8
Local variables | Stack allocation
10:51
9
Binary expressions | Comparison operators
04:16
10
Control flow: If expressions | While loops
10:42
11
Function declarations | Call expression
06:25
12
Introduction to Classes | Struct types
09:29
13
Compiling Classes
08:51
14
Instances | Heap allocation
10:05
15
Property access
05:16
16
Class Inheritance | vTable
09:00
17
Methods application
07:29
18
Functors – callable objects
04:42
19
Closures, Cells, and Lambda expressions
08:04
20
Final executable | Next steps
06:53

Unlock unlimited learning

Get instant access to all 19 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Comments

0 comments

Want to join the conversation?

Sign in to comment

Similar courses

AI Coding with GitHub Copilot

AI Coding with GitHub Copilot

Sources: zerotomastery.io
Discover how GitHub Copilot, an AI tool trained on code, helps programmers write code efficiently. Ideal for numerous languages and frameworks.
1 hour 8 minutes 6 seconds
Operating Systems

Operating Systems

Sources: Oz Nova (csprimer.com)
The goal of this course is to help you understand the operating system, one of the most important pieces of software with which almost all programs interact.
29 hours 33 minutes 35 seconds
The Complete Foundation Stock Trading Course

The Complete Foundation Stock Trading Course

Sources: udemy
This is the Number One ranked Stock Trading course on Udemy. In this course, you will learn how to trade the Stock Market. It's a course designed for Complete B
9 hours 29 minutes 35 seconds
Grokking Statistics

Grokking Statistics

Sources: Thomas Nield
Discover statistics with clear explanations and real-life examples. Learn probability, distributions, and hypothesis testing for practical applications.
ZTM Campus Event Recordings

ZTM Campus Event Recordings

Sources: zerotomastery.io
While it's always best to attend an event live so that you can ask your own questions and engage with instructors and students, we do record some events held...
17 hours 29 minutes 37 seconds