Optimizing Trees — How to Create a Compiler part 2/5 — Simple optimizations to a program in an AST
In this tool-assisted education video series I create a compiler in C++ for a B-like programming language. In this episode we deal with simple optimization techniques like constant folding and dead code elimination, and also look into ways to simplify the internal representation of the code. This is part of a multi-episode series. In the next video, we will deal with a different intermediate representation. Become a member: https://youtube.com/Bisqwit/join Downloads: — https://github.com/bisqwit/compiler_s... All the material associated with this episode can be downloaded here. Check out this book if you would like to learn more indepth about compilers and optimization (Amazon affiliate link): — https://www.amazon.com/gp/product/155... Acknowledgements: — Music¹: Aryol :: Warmup :: Kyohei Sada (SPC-OPL3 conversion) — Music²: Famicom Tantei Club Part II: Ushiro ni Tatsu Shōjo :: Dean’s Room :: Kenji Yamamoto (SPC-OPL3 conversion), original composition: Bach’s Invention № 15 — Music³: Star Ocean :: Past Days :: Motoi Sakuraba (SPC-OPL3 conversion) — Music⁴: Aryol :: Arrest :: Kyohei Sada (converted into MIDI and played through OPL3 emulation through homebrew software) — Music⁵: Live a Live :: Prehistoric :: Yoko Shimomura (SPC-OPL3 conversion) — Music⁶: Bahamut Lagoon :: Matelite :: Noriko Matsueda (SPC-OPL3 conversion) — Music⁷: Descent :: Game 03 :: Ken Allen and others — Music⁸: Earthbound :: Monkey Maze :: Akio Ōmuri and others — Music⁹: Light Fantasy :: Field theme 2 :: Michiharu Hasuya and others (SPC-OPL3 conversion) — SFX: Mostly from YouTube Audio Library. Some are recorded from video games like The Guardian Legend and Lunar Ball. ¹ 00:01 & 00:42 ² 00:15 ³ 03:03 ⁴ 08:30 ⁵ 11:30 & 13:35 ⁶ 15:30 ⁷ 19:32 ⁸ 24:41 ⁹ 27:47 My links: Twitter: / realbisqwit Liberapay: https://liberapay.com/Bisqwit Patreon: / bisqwit (Other options at https://bisqwit.iki.fi/donate.html) Twitch: / realbisqwit Homepage: https://iki.fi/bisqwit/ You can contribute subtitles: https://www.youtube.com/timedtext_vid... or to any of my videos: https://www.youtube.com/timedtext_cs_... #Bisqwit #Compiler #Tutorial

Three-Address Code — How to Create a Compiler part 3/5 — Converting AST into statement-based IR

Parser and Lexer — How to Create a Compiler part 1/5 — Converting text into an Abstract Syntax Tree

9. What Compilers Can and Cannot Do

If You Have A Bad Memory, I’ll Help You Fix It In 28 Minutes

I lost weeks optimizing a drone – brief look at The Farmer Was Replaced

Creator of C++: Bell Labs, Negative Overhead Abstraction, Mistakes | Bjarne Stroustrup

Remember SCANTRON? How did that work?

ROM Hacks and Translation Challenges in RPGs (How to Create a Compiler, part 0/5)

Optimizing IR — How to Create a Compiler part 4a/5 — Optimizing a three-address code based IR

This Simple Algorithm Powers Real Interpreters: Pratt Parsing

Sam H. Smith – Parsing without ASTs and Optimizing with Sea of Nodes – BSC 2025

I made a Compiler in 25 Days - Here is what I learned

Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones

JANITOR vs THE BIGGEST GUYS IN THE GYM. They Didn’t Expect THAT

What Is An Abstract Syntax Tree, With WealthFront Engineer Spencer Miskoviak

Making My Own Programming Language and Coding a Game in It

Comparing C to machine language

ABI & Instruction Mapping — How to Create a Compiler part 5a/5 — Designing Machine Code Synthesis

Making a Programming Language & Interpreter in under 10 minutes!

