ExpressionsTopStatementsVariables

Variables

< variable > -> < identifier >
| < variable > . < identifier >
| < variable > [ < expression > ]

A variable is either 1) a simple identifier, 2) a sub-variable followed by a field selector, or 3) a sub-variable followed by an array subscript expression. If a variable is a simple identifier the identifier must be bound by a variable declaration or a formal parameter declaration in an enclosing scope. If the variable is a sub-variable followed by a field selector, the sub-variable must denote an object of a record type that includes the component specified by the selector. If the variable is a sub-variable followed by a subscript expression, the sub-variable must denote an array and the value of the expression at run-time must be non-negative and less than the number of elements in the array.


Computer Science 434
Department of Computer Science
Williams College

ExpressionsTopStatementsVariables