polyglot.visit
Class TypedTranslator
java.lang.Object
polyglot.visit.PrettyPrinter
polyglot.visit.Translator
polyglot.visit.TypedTranslator
- All Implemented Interfaces:
- java.lang.Cloneable, Copy
public class TypedTranslator
- extends Translator
TypedTranslator extends Translator for type-directed code generation.
The base Translator uses types only to generate more readable code.
If an ambiguous or untyped AST node is encountered, code generation
continues. In contrast, with TypedTranslator, encountering an
ambiguous or untyped node is considered internal compiler error.
TypedTranslator should be used when the output AST is expected to be
(or required to be) type-checked before code generation.
Methods inherited from class polyglot.visit.Translator |
context, context, copy, exports, job, nodeFactory, toString, translate, translateSource, translateTopLevelDecl, typeSystem, writeHeader |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TypedTranslator
public TypedTranslator(Job job,
TypeSystem ts,
NodeFactory nf,
TargetFactory tf)
print
public void print(Node parent,
Node child,
CodeWriter w)
- Description copied from class:
Translator
- Print an ast node using the given code writer. This method should not
be called directly to translate a source file AST; use
translate(Node)
instead. This method should only be called
by nodes to print their children.
- Overrides:
print
in class Translator