Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.syntax
Class Expr

    java.lang.Object
      avrora.syntax.ASTNode
          avrora.syntax.Expr

Direct Known Subclasses:
  Expr.BinOp, Expr.Func, Expr.RelativeAddress, Expr.Term, Expr.UnOp

public abstract class Expr
extends ASTNode

The `Expr` class represents an expression within the program that must be evaluated to a value. This could be an integer constant, a computable expression involving arithmetic operators, a variable, or an expression relative to the current position within the program.

Nested Class Summary
`static class` | `Expr.BinOp` The `BinOp` class represents a simple binary arithmetic operator such as addition, multiplication, etc.
`static class` | `Expr.CharLiteral` The `CharLiteral` class represents a character literal in the program that can be used as an integer value.
`static class` | `Expr.Constant` The `Constant` class represents a integer literal (a constant) within the program.
`static class` | `Expr.Func` The `Func` class represents a builtin function that is applied to an operand.
`static class` | `Expr.RelativeAddress` The `RelativeAddress` class represents an expression that is derived from the addition (or subtraction) of a constant to the current byte address.
`static class` | `Expr.StringLiteral` The `StringLiteral` class represents a string literal within the program.
`static class` | `Expr.Term` The `Term` class is a superclass for all expressions that consist of a single lexical token.
`static class` | `Expr.UnOp` The `UnOp` class represents an expression that is a single operand with a unary operation applied to it.
`static class` | `Expr.Variable` The `Variable` class represents a variable reference within the program.

Constructor Summary
`Expr()`

Method Summary
`abstract int` | `evaluate(int currentByteAddress, Context c)` The `evaluate()` method computes the value of the expression in this context and returns its value.

Methods inherited from class avrora.syntax.ASTNode
`getLeftMostToken, getRightMostToken`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Expr

    public Expr()

Method Detail

### evaluate

    public abstract int evaluate(int currentByteAddress,
                                 Context c)

  The `evaluate()` method computes the value of the expression in this context and returns its value.

  Parameters:
    `currentByteAddress` - the current byte address within the program
    `c` - the context in which to evaluate this expression
  Returns:
    the value of the expression as a 32-bit integer

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD