Homework 2

This commit is contained in:
Carlos Galindo 2020-01-15 22:30:09 +01:00
parent 12f678a924
commit bf60a078d7
Signed by: kauron
GPG key ID: 83E68706DEE119A3
64 changed files with 4786 additions and 1185 deletions

View file

@ -16,6 +16,17 @@ public class AstVisitor<R,A> extends ExprVisitor<R,A> {
return ast.accept(this, arg);
}
/**
* Overrides {@link ExprVisitor#visitChildren(Expr, Object)} and
* delegates to the more general {@link #visitChildren(Ast, Object)}
* with {@link Ast} parameter. This method is final to prevent
* overriding only one of the two versions.
*/
@Override
public final R visitChildren(Expr ast, A arg) {
return visitChildren((Ast) ast, arg);
}
/**
* A handy function which visits the children of {@code ast},
* providing "arg" to each of them. It returns the result of
@ -45,6 +56,7 @@ public class AstVisitor<R,A> extends ExprVisitor<R,A> {
/**
* The default action for expressions is to call this */
@Override
protected R dfltExpr(Expr ast, A arg) {
return dflt(ast, arg);
}