|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.core.isdl.ast.Expr avrora.core.isdl.ast.CallExpr
The CallExpr
class represents a subroutine call within the IR. Subroutines can be called for
side effects and produce results in the IR, allowing factoring of common pieces of code.
Field Summary | |
java.util.List |
args
The args fields stores a reference to a list of expressions that are evaluated and passed
as arguments to the subroutine. |
Token |
method
The method field stores a string that represents the name of the subroutine being called. |
Fields inherited from class avrora.core.isdl.ast.Expr |
PREC_A_ADD, PREC_A_AND, PREC_A_MUL, PREC_A_OR, PREC_A_SHIFT, PREC_A_XOR, PREC_L_AND, PREC_L_EQU, PREC_L_OR, PREC_L_REL, PREC_L_XOR, PREC_TERM, PREC_UN |
Constructor Summary | |
CallExpr(java.lang.String m,
java.util.List a)
The constructor of the CallExpr class simply initializes the references to the subroutine
name and arguments. |
|
CallExpr(Token m,
java.util.List a)
The constructor of the CallExpr class simply initializes the references to the subroutine
name and arguments. |
Method Summary | |
Expr |
accept(CodeRebuilder r,
java.lang.Object env)
The accept() method implements one half of the visitor pattern for rebuilding of
expressions. |
void |
accept(CodeVisitor v)
The accept() method implements one half of the visitor pattern so that client visitors can
traverse the syntax tree easily and in an extensible way. |
void |
accept(ExprVisitor v)
The accept() method implements one half of the visitor pattern so that client visitors can
traverse the syntax tree easily and in an extensible way. |
int |
getPrecedence()
The getPrecedence() method gets the binding precedence for this expression. |
java.lang.String |
toString()
The toString() method recursively converts this expression to a string. |
Methods inherited from class avrora.core.isdl.ast.Expr |
getBitWidth, innerString, isBitRangeExpr, isConstantExpr, isLiteral, isMap, isVariable, tokenToBool, tokenToInt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final Token method
method
field stores a string that represents the name of the subroutine being called.
public final java.util.List args
args
fields stores a reference to a list of expressions that are evaluated and passed
as arguments to the subroutine.
Constructor Detail |
public CallExpr(Token m, java.util.List a)
CallExpr
class simply initializes the references to the subroutine
name and arguments.
m
- the name of the subroutine as a stringa
- list of expressions representing the arguments to the subroutinepublic CallExpr(java.lang.String m, java.util.List a)
CallExpr
class simply initializes the references to the subroutine
name and arguments.
m
- the name of the subroutine as a stringa
- list of expressions representing the arguments to the subroutineMethod Detail |
public void accept(ExprVisitor v)
accept()
method implements one half of the visitor pattern so that client visitors can
traverse the syntax tree easily and in an extensible way.
accept
in class Expr
v
- the visitor to acceptpublic void accept(CodeVisitor v)
accept()
method implements one half of the visitor pattern so that client visitors can
traverse the syntax tree easily and in an extensible way.
accept
in class Expr
v
- the visitor to acceptpublic Expr accept(CodeRebuilder r, java.lang.Object env)
accept()
method implements one half of the visitor pattern for rebuilding of
expressions. This visitor allows code to be slightly modified while only writing visit methods for the
parts of the syntax tree affected.
accept
in class Expr
r
- the rebuilder to accept
visit()
method of the rebuilderpublic java.lang.String toString()
toString()
method recursively converts this expression to a string. For binary
operations, inner expressions will be nested within parentheses if their precedence is lower than the
precedence of the parent expression.
public int getPrecedence()
getPrecedence()
method gets the binding precedence for this expression. This is used
to compute when inner expressions must be nested within parentheses in order to preserve the implied
order of evaluation.
getPrecedence
in class Expr
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |