Defining Target Machines — How to Create a Compiler part 5b/5 — Data oriented programming

Hello! Remember my making-a-compiler series? If you have not seen the previous episodes yet, suggest you do watch them now. Otherwise you will be very confused when watching this video. So, let’s begin with the fundamentals. This compiler targets multiple platforms. Each target architecture has a name, word size, list of registers, and so on, […]

Read More

Register Renaming — How to Create a Compiler part 4b/5 — Preparing for code generator

♪♪ Two simple chords and footstep sounds ♪♪ Good evening! [In French language] When I made episode 4 of this building-a-compiler series, I intentionally left out some optimizations, because they were rather complicated. In this episode we shall do them. But first, one optimization that should have been in the previous episode, but I totally […]

Read More

Optimizing Trees — How to Create a Compiler part 2/5 — Simple optimizations to a program in an AST

Optimizing Trees — How to Create a Compiler part 2/5 — Simple optimizations to a program in an AST

Good evening! [In Arabic language] In the last episode, we created a parser for a B-like programming language. It parses each function into a tree structure, where expressions contain expressions. Today we will focus on optimization. As I have said before, much in programming is actually work – towards making the work itself easier. The […]

Read More

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

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

♪♪ Two simple chords and footstep sounds ♪♪ Hello! [In Irish language] It’s time to do some optimizations. By now you have already seen the first three episodes of the series, so let’s jump straight into the code. First I am doing some refactoring on the existing code, such as utilizing C++17 structured binding statements. […]

Read More