|
||||||||||
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.Logical avrora.core.isdl.ast.Logical.BinOp
The BinOp
inner class represents an operation on two values with an infix binary operation
that produces a boolean. For example, logical XOR and integer comparison and such operations are binary
infix and therefore subclasses of this class.
Nested Class Summary |
Nested classes inherited from class avrora.core.isdl.ast.Logical |
Logical.AndExpr, Logical.BinOp, Logical.EquExpr, Logical.GreaterEquExpr, Logical.GreaterExpr, Logical.LessEquExpr, Logical.LessExpr, Logical.NequExpr, Logical.NotExpr, Logical.OrExpr, Logical.UnOp, Logical.XorExpr |
Field Summary | |
Expr |
left
The left field stores a reference to the expression that is the left operand of the
binary operation. |
java.lang.String |
operation
The operation field stores the string name of the operation of this binary operation.
|
int |
precedence
The precedence field stores the precedence level of this binary operation. |
Expr |
right
The left field stores a reference to the expression that is the right operand of the
binary operation. |
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 | |
Logical.BinOp(int p,
Expr l,
java.lang.String o,
Expr r)
The constructor of the BinOp class initializes the public final fields that form the
structure of this expression. |
Method Summary | |
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. |
boolean |
isConstantExpr()
The isConstantExpr() method tests whether this expression is a constant expression
(i.e. it is reducable to a constant and has no references to variables, maps, etc). |
java.lang.String |
toString()
|
Methods inherited from class avrora.core.isdl.ast.Expr |
accept, accept, getBitWidth, innerString, isBitRangeExpr, 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 java.lang.String operation
operation
field stores the string name of the operation of this binary operation.
For example, 'and' represents logical AND.
public final Expr left
left
field stores a reference to the expression that is the left operand of the
binary operation.
public final Expr right
left
field stores a reference to the expression that is the right operand of the
binary operation.
public final int precedence
precedence
field stores the precedence level of this binary operation. This is
used to compute when to surround inner expressions with parentheses when printing code in infix
notation.
Constructor Detail |
public Logical.BinOp(int p, Expr l, java.lang.String o, Expr r)
BinOp
class initializes the public final fields that form the
structure of this expression.
p
- the binding precedence of this operatorl
- the left expression operando
- the string name of the operationr
- the right expression operandMethod Detail |
public boolean isConstantExpr()
isConstantExpr()
method tests whether this expression is a constant expression
(i.e. it is reducable to a constant and has no references to variables, maps, etc).
isConstantExpr
in class Expr
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 java.lang.String toString()
public int getPrecedence()
Expr
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 |