gnu.expr
Class ExpWalker
java.lang.Object
gnu.expr.ExpWalker
- Direct Known Subclasses:
- ChainLambdas, FindCapturedVars, FindTailCalls, InlineCalls, PushApply, ResolveNames
public class ExpWalker
- extends java.lang.Object
Class for doing a tree-walk over an Expression tree.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExpWalker
public ExpWalker()
getCompilation
public Compilation getCompilation()
- Get the Compilation associated with this walker.
walkExpression
protected Expression walkExpression(Expression exp)
setContext
public void setContext(Compilation comp)
walk
public Expression walk(Expression exp)
- Call the walk method of argument Expression.
Could call Expression's walk directly, but this allows us to
interpose a method call on each Expression. We use it to note the
Expression's line number. Should not need to be overridden;
if you do, you may also want to override walkExps.
walkApplyExp
protected Expression walkApplyExp(ApplyExp exp)
walkIfExp
protected Expression walkIfExp(IfExp exp)
walkScopeExp
protected Expression walkScopeExp(ScopeExp exp)
walkLetExp
protected Expression walkLetExp(LetExp exp)
walkLambdaExp
protected Expression walkLambdaExp(LambdaExp exp)
walkClassExp
protected Expression walkClassExp(ClassExp exp)
walkObjectExp
protected Expression walkObjectExp(ObjectExp exp)
walkModuleExp
protected Expression walkModuleExp(ModuleExp exp)
walkSetExp
protected Expression walkSetExp(SetExp exp)
walkTryExp
protected Expression walkTryExp(TryExp exp)
walkBeginExp
protected Expression walkBeginExp(BeginExp exp)
walkQuoteExp
protected Expression walkQuoteExp(QuoteExp exp)
walkReferenceExp
protected Expression walkReferenceExp(ReferenceExp exp)
walkThisExp
protected Expression walkThisExp(ThisExp exp)
walkSynchronizedExp
protected Expression walkSynchronizedExp(SynchronizedExp exp)
walkBlockExp
protected Expression walkBlockExp(BlockExp exp)
walkExitExp
protected Expression walkExitExp(ExitExp exp)
walkFluidLetExp
protected Expression walkFluidLetExp(FluidLetExp exp)
walkLangExp
protected Expression walkLangExp(LangExp exp)
getCurrentLambda
public final LambdaExp getCurrentLambda()
walkExps
public Expression[] walkExps(Expression[] exps)
walkExps
public Expression[] walkExps(Expression[] exps,
int n)
- Call walk on the Expressions in an array.
However, the walk method is inlined for speed.
walkDefaultArgs
public void walkDefaultArgs(LambdaExp exp)
error
public void error(char kind,
java.lang.String message)
noteError
public Expression noteError(java.lang.String message)
getFile
public final java.lang.String getFile()
getLine
public final int getLine()
getColumn
public final int getColumn()
setFile
public void setFile(java.lang.String filename)
setLine
public void setLine(int line)
setColumn
public void setColumn(int column)
setLine
public void setLine(java.lang.String filename,
int line,
int column)