Contents | Prev | Next | Index


Operands

With the exception of literal constants, e.g. numbers, strings, and sets, operands are denoted by designators. A designator consists of a (possibly module-qualified) identifier refering to a a constant, variable, procedure, or function. This identifier may be followed by a list of selectors if the designated item is an element of a structure.

designator        ::= designator_id selector_list 
                  ::= designator_id               
designator_id     ::= qualident                   
                  ::= INHERITED <identifier>      
selector_list     ::= selector_list selector      
                  ::= selector                    
selector          ::= . <identifier>              
                  ::= [ index_list ]    
                  ::= ^                           
index_list        ::= index_list , index          
                  ::= index                       
index             ::= expr                        

If a designates an array, then index selector a[e] denotes the element of a whose index is the current value of the expression e. The type of e must be assignment compatible with the index type of a. A designator of the form a[e0,e1,...,en] stands for  a[e0][e1]...[en].

If r designates a record, then field selector r.f denotes the field f of r. If c designates a variable of a class type, then field selector c.f denotes the field f of c, and method selector c.m denotes the method m of c.

If p designates a pointer, then reference selector p^ denotes the variable that is referenced by p.

If the designated object is a constant or a variable, then the designater refers to its current value. Otherwise, if it is a procedure, the designator refers to that procedure. If it is a function, it means that a function is to be called and that the value returned form that function call is the one standing for the designator. As in proper procedure calls, the actual parameters for a function call must correspond to the formal parameters, too.

Here are a few examples of designators (refer to examples in the section about variable declarations):

i (INTEGER)
a[i] (REAL)
w[3].name[i] (CHAR)
t^.left^.right (Tree)


Contents | Prev | Next | Index

Canterbury Pascal for JVM  (Last documentation update Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com  . All rights reserved.
Please send any comments or corrections to neuhoff@mhccorp.com