If your custom node translator introduces new kinds of
statements, or if you add a new expression type, you must provide
the Java™ code to generate the
corresponding IRL code.
About this task
To provide a code generator extender, you must create
an implementation of IlrCodeGeneratorExtender.
Procedure
To provide a code generator extender:
- Create an implementation of IlrCodeGeneratorExtender.
This
interface declares methods that are automatically called when the
IRL code generator main class inspects an expression or a statement
that is not part of the predefined expressions or statements.
- In the implementation of IlrCodeGeneratorExtender,
define a print method for each of the custom types that your languages
introduces. To print the generated IRL, use the methods provided by
the code generator, by casting it as an IlrIRLCodeGenerator.
- Register the code generator extender to the abstract syntax
node in the concrete syntax properties, using the codeGeneratorExtender.irl property,
and the fully qualified name of the code generator extender class.