-
Notifications
You must be signed in to change notification settings - Fork 0
Intermediate Code Generator
This article is a draft and work in progress. Feel free to comment and discuss on the issue tracker.
- Danny
- Frank
- Manuel
- Alpin
- Vivi
- Florian
- Yang Zhang
Input of the intermediate code generator is the abstract syntax tree (AST) generated by the parser. The AST is not defined in this document and is part of the Abstract Syntax Tree Specification.
Output of the intermediate code generator is one of the following representations of three address code
- ASCII-Text
- Quadrupel
- Triple
- Tuple
- Postfix
FUC-group suggests the quadrupel representation for three address code. Main advantages of quadrupel representation:
- Target Code Generator does not need to implement its own parser for three address code
- Quadrupel representation is easy to transform into triple or tuple representation by visualization modules
To separate Frontend and Backend the quadrupel representation can be saved as a binary file, e.g. by serializing.
This is the proposed interface for Intermediate Code Generator
public interface IntermediateCodeGenerator {
public Quadruple[] generateIntermediateCode(AST ast) throws IntermediateCodeGeneratorException;
}
For a specification for Quadrupel please see Three Address Code Specification