Compilers, Interpreters and Formal Languages

12h 3m 54s
English
Paid
November 7, 2024

This course is a beginner-friendly introduction to compilers. We will gradually develop an interpreter for a simple scripting language.

More

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.

Watch Online Compilers, Interpreters and Formal Languages

Join premium to watch
Go to premium
# Title Duration
1 Motivations & Learning Outcomes 14:35
2 How to Take this Course 02:59
3 Compilers as Translators 06:47
4 CPU Components 11:28
5 Opcodes & Instructions 10:00
6 Stack Push & Pop 05:32
7 Control Flow 15:12
8 What is a Program? 11:10
9 Tokens & Lexemes 05:23
10 Syntax Tree 17:00
11 Setting Up our Project Folder 09:50
12 Configuring Python on Windows 02:58
13 Makefile 01:25
14 Adding Token & Lexer Files 03:22
15 Simple Scanning Algorithm 11:33
16 Single-Character Tokens 11:54
17 Ignoring Whitespace & Comments 09:38
18 Scanning Equals & Not Equals 05:08
19 Scanning Two-Char Tokens 06:24
20 Scanning Numbers 13:22
21 Scanning Strings & Identifiers 09:14
22 Identifying Keywords 04:56
23 Scanning -- as Line Comment 05:13
24 Multiline Comments 01:58
25 Syntax Analysis 05:44
26 Context-Free Grammars & BNF 17:46
27 Grammar for Simple Expressions 13:56
28 A Model for AST Nodes 19:36
29 Recursive Descent Parsing 14:30
30 Parser Helper Functions (Exercise) 05:44
31 AST of a Simple Expression 11:41
32 Pretty AST Printing (Exercise) 03:16
33 AST Printing & Polish Notation 09:20
34 Terminal Colors & ANSI Escape Codes 03:33
35 Standardizing Errors Messages 10:39
36 Storing Line Numbers in Nodes 07:11
37 Renaming Term & Factor 04:59
38 A Tree-Walking Interpreter 07:47
39 Coding a Simple Tree-Walking Interpreter 16:23
40 Pinky Language Data Types 10:24
41 Dynamic Types at Runtime 14:03
42 Runtime Type Checks 08:34
43 Parsing Equality & Comparison (Exercise) 08:57
44 Parsing Equality & Comparison Operators 10:48
45 Exponent Associativity 07:50
46 Logical And & Logical Or 07:25
47 Short-Circuit Evaluation 12:46
48 Testing Expressions 13:21
49 REPL 03:24
50 A Program as a List of Statements 14:03
51 Parsing Print Statements 12:38
52 Interpreting Print Statements 06:51
53 PrintLn Statements (Exercise) 01:02
54 PrintLn Statements & Escape Chars 06:35
55 If Statements 21:04
56 Identifiers & Assignments 16:31
57 The Environment Class 13:08
58 Environment Load & Store (Exercise) 11:16
59 Global & Local Variables 10:53
60 While Statement (Exercise) 02:08
61 While Statements 06:43
62 For Statements 17:20
63 Stringifying Booleans & Integers 07:27
64 Mandelbrot Set (Exercise) 07:52
65 Mandelbrot Set Script in Pinky 08:25
66 Dragon Curve 01:01
67 Functions in Pinky 10:28
68 Function Model 14:02
69 Parsing Function Declaration 05:49
70 Parsing Function Call 17:20
71 Interpreting Function Declaration 26:35
72 Interpreting Function Call 09:51
73 Expressions as Statements? 03:06
74 Max. Number of Params (Exercise) 01:05
75 Max. Number of Params 00:45
76 Parsing Return Statements 07:20
77 Interpreting Return Statements 15:58

Similar courses to Compilers, Interpreters and Formal Languages

The Complete Foundation Stock Trading Course

The Complete Foundation Stock Trading Courseudemy

Duration 9 hours 29 minutes 35 seconds
Machine Learning A-Z : Become Kaggle Master

Machine Learning A-Z : Become Kaggle Masterudemy

Duration 36 hours 23 minutes 54 seconds
Replit Agent

Replit AgentMckay Wrigley (takeoff)

Duration 30 minutes 22 seconds
The Automation Bootcamp: Zero to Mastery

The Automation Bootcamp: Zero to Masteryzerotomastery.io

Duration 22 hours 39 minutes 15 seconds
Bulletproof SAAS Offer

Bulletproof SAAS OfferProdigies University

Duration 2 hours 32 minutes 7 seconds
Refactoring UI - Complete Package

Refactoring UI - Complete Packageadamwathan

Duration 40 minutes 42 seconds
100 Days of Code: The Complete Python Pro Bootcamp

100 Days of Code: The Complete Python Pro Bootcampudemy

Duration 54 hours 16 minutes 30 seconds