Previous Up Next

Chapter 7  Translation from typed AST to BOL

The translation phase is responsible for converting the typed abstract syntax tree produced by the type checker into BOL code. A major part of the translation process is compiling the high-level patterns of the typed AST to decision trees encoded in BOL. Pattern compilation is described in Chapter 8; in the chapter we describe the other aspects of translation.

The current translation scheme relies on the assumption that we have complete knowledge of the representationf of any imported module (including parameter modules). In the future, we plan to suport a development mode that allows modules to be compiled based on only the signatures of their antecedants. Development mode will require a more conservative treatment of features such as class linking.

7.1  The translation environment

7.2  Translating types

7.3  Exception handling

One of the responsibilities of the translation phase is to make the exception handling control-flow explicit. This goal is achieved by adding an exception handler parameter to each function.

7.4  Translating classes and objects

7.4.1  Class linkage

7.4.2  Translating methods

7.4.3  Translating makers

7.4.4  Translating initially clauses

A class definition may have an initially clause, which is an expression that gets invoked immediately after object initialization (see Section 7.4.7). We support initially clauses by translating them to a premethod-like function (i.e., a function that takes self as its first argument). The name of the initially function is stored in the class's environment. When the class has a superclass, its initially function is responsible for invoking the superclass initially function first (if present). If the superclass has an initially function, but the subclass does not, then we use the superclass's initially function for the subclass.

7.4.5  Translating method dispatch

7.4.6  Translating field operations

7.4.7  Translating new


Previous Up Next