Intermediate Language in the Quiche Compiler
[This article is a copy of comments in source code for the Def.IL unit.] The intermediate language (IL) is the core of the Quiche compiler. The parsertakes the source code and converts it to IL. The code generator takes the IL andconverts it to assembly code. Each IL record stores an operation and up the …. Read More
Writing a Compiler 3: The Branch Fixup
I left the last article by talking about a bug. Look at this source code: and the IL which is being generated from it: Assignments to a variable are versioned. I.e. every variable reference has a ‘subscript’, which is incremented for every write. So in this example we have %a_0, %a_1, and %a_2, all of …. Read More
Writing a Compiler 2: Conditionals
In part one I showed how my compiler is parsing expressions and converting this into an intermediate language format suitable for optimisation and code generation. The code in part one was purely linear with no branches or loops. In this second article I begin to deal with code which has multiple execution paths. I’ll start …. Read More
Writing a Compiler 1: Expressions and Intermediate Language
Recently I’ve been getting increasingly broody to write a compiler. They’ve always been something of a mystery to me and, while I’ve always fancied writing one, I’ve never had a convincing reason to do so. But, since I’ve returned to retro computing, I can see definite limitations in the options currently available for writing software …. Read More