Chapter 7: Intermediate representation and symbol table

. Compiler writers have tried to define Universal IRs and have failed. (UNCOL in 1958)

. There is no standard Intermediate Representation. IR is a step in expressing a source program so that machine understands it

. As the translation takes place, IR is repeatedly analyzed and transformed

. Compiler users want analysis and translation to be fast and correct

. Compiler writers want optimizations to be simple to write, easy to understand and easy to extend

. IR should be simple and light weight while allowing easy expression of optimizations and transformations.

Compiler writers have tried to define Universal IRs and have failed . UNCOL , UNiversal Computer Oriented Language, was a proposed universal language for compilers . It was discussed but never implemented. UNCOL would have supported a back-end for every machine architecture. A compiler for a new programming language would only have to compile to UNCOL. Everybody knows that UNCOL was a failure. As of now, there is no standard Intermediate Representation. A significant part of the compiler is both language and machine independent.

There are many issues in choosing an IR:

. Analysis and translation should be fast and correct.

. Writing an IR should be simple for compiler writers.

. IR should be easy to understand and easy to extend.

. It should be light weight and should allow optimizations and translation easily.