Skip to content

Intermediate Code Generator

SWP-Comp-Ch3ck3r edited this page Apr 18, 2013 · 20 revisions

Document Status: Draft / Work in Progress

This article is a draft and work in progress. Feel free to comment and discuss on the issue tracker.

GROUP

FUC Group

  • Danny
  • Frank
  • Manuel

JAVABITES

  • Alpin
  • Vivi
  • Florian
  • Yang Zhang

Remarks

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

  1. ASCII-Text
  2. Quadrupel
  3. Triple
  4. Tuple
  5. 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.

Interface specification

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