|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectavrora.syntax.ASTNode
avrora.syntax.Expr
avrora.syntax.Expr.BinOp
The BinOp class represents a simple binary arithmetic operator such as addition,
multiplication, etc. It contains two internal expressions, the left and right.
| Nested Class Summary |
| Nested classes inherited from class avrora.syntax.Expr |
Expr.BinOp, Expr.CharLiteral, Expr.Constant, Expr.Func, Expr.RelativeAddress, Expr.StringLiteral, Expr.Term, Expr.UnOp, Expr.Variable |
| Field Summary | |
Expr |
left
The left field records an expression that represents the operand on the left side of
the operator. |
AbstractToken |
op
The op field records the token that corresponds to the actual arithmetic operator. |
Expr |
right
The right field records an expression that represents the operand on the right side of
the operator. |
| Constructor Summary | |
Expr.BinOp(AbstractToken tok,
Expr l,
Expr r)
|
|
| Method Summary | |
int |
evaluate(int currentByteAddress,
Context c)
The evaluate() method computes the value of the expression in this context and returns
its value. |
AbstractToken |
getLeftMostToken()
The getLeftMostToken() method gets the first token associated with the abstract syntax
tree node. |
AbstractToken |
getRightMostToken()
The getRightMostToken() method gets the last token associated with the abstract syntax
tree node. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final AbstractToken op
op field records the token that corresponds to the actual arithmetic operator.
public final Expr left
left field records an expression that represents the operand on the left side of
the operator.
public final Expr right
right field records an expression that represents the operand on the right side of
the operator.
| Constructor Detail |
public Expr.BinOp(AbstractToken tok,
Expr l,
Expr r)
| Method Detail |
public int evaluate(int currentByteAddress,
Context c)
evaluate() method computes the value of the expression in this context and returns
its value. This implementation works straightforwardly by first evaluating the left operand, then
the right, and then computing the result of the arithmetic operation.
evaluate in class ExprcurrentByteAddress - the current byte address within the programc - the context in which to evaluate this expression
public AbstractToken getLeftMostToken()
ASTNodegetLeftMostToken() method gets the first token associated with the abstract syntax
tree node.
getLeftMostToken in class ASTNodeAbstractToken instance representing the first token that is a part of this
syntactic item.public AbstractToken getRightMostToken()
ASTNodegetRightMostToken() method gets the last token associated with the abstract syntax
tree node.
getRightMostToken in class ASTNodeAbstractToken instance representing the last token that is a part of this
syntactic item.public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||