Tiger Var Escapes
Tiger in Stratego -- Compilation by Program Transformation
TigerVarEscapes is a component of the
TigerCompiler in the
TigerTrans package.
The component transforms programs in
TigerAbstractSyntax format such that all variable
declarations are annotated to indicate whether or not the variable escapes. The annotation
takes the form of one of the constructors
Reg or
Stack applied to the identifier of
the declaration.
Thus a local variable declaration for a variable
"x" that escapes becomes:
VarDec(Stack("x"), None, e)
while a formal parameter
"y" that does not escape becomes
FArg(Reg("y"), Tid("string"))
Remark: Once Stratego supports
TermAnnotation this might be done more elegantly using
an annotation.
Tiger-VarEscape.r
The implementation of escaping variables analysis that comes with the distribution of the
TigerTrans package is conservative and indicates every variable as escaping.
CompilerComponent