The Grammar.

The annotated grammar below is presented in three columns. The first column is the symbol being defined, the second column contains a list of the possibilities for that symbol, and the third column, when present, provides additional explanation.



INPUT



PROGRAM

STMT

EXPR ;



PROGRAM



program ID ; STMTS ; end ;



STMTS

``One or more instances of

STMT

''



STMT

LHS := EXPR ;



EXPR ;



for ITERATOR do STMTS end ;



while EXPR do STMTS end ;



take LHS frome LHS ;



take LHS fromb LHS ;



take LHS from LHS ;



read LHS_ LIST ;



read LHS_ LIST from EXPR ;



print EXPR_ LIST ;



print EXPR_ LIST to EXPR ;



return ;



return EXPR ;



IF_ STMT



if EXPR then STMTS ELSE_ IFS ELSE_ PART end



ELSE_ IFS



``zero or more repetitions of the following''



elseif EXPR then STMTS



ELSE_ PART



``may be omitted''



else STMTS



ITERATOR



ITER_ LIST



ITER_ LIST | EXPR



ITER_ LIST



``one or more

SIMPLE$\displaystyle \_$ ITERATOR

s separated by commas.''



SIMPLE_ ITERATOR



BOUND_ LIST in EXPR



BOUND = ID ( BOUND_ LIST )



BOUND = ID { BOUND_ LIST }



BOUND_ LIST



``one or more

BOUND

, separated by commas''



BOUND

˜



ID



[ BOUND_ LIST ]



SELECTOR



{ EXPR_ LIST }



( EXPR_ LIST )



( EXPR .. EXPR )



( .. EXPR )



( EXPR .. )



( )



FORMER



EXPR : ITERATOR



EXPR_ LIST



EXPR .. EXPR



EXPR , EXPR .. EXPR



LHS



ID



LHS SELECTOR



[ LHS_ LIST ]



LHS_ LIST



``One or more instances of

LHS

, separated by commas''



``Any

LHS

in the list can be replaced by

&̃nbsp;

''



EXPR



ID



INTEGER



FLOATING_ POINT



STRING



true



false



OM



newat



FUNC_ CONST



( EXPR )



[ FORMER ]



{ FORMER }



# EXPR



EXPR SELECTOR



EXPR . ID EXPR



EXPR ? EXPR



EXPR ** EXPR



EXPR * EXPR



EXPR / EXPR



EXPR mod EXPR



EXPR div EXPR



EXPR + EXPR



EXPR - EXPR



EXPR with EXPR



EXPR less EXPR



EXPR = EXPR



EXPR /= EXPR



EXPR < EXPR

EXPR > EXPR

EXPR <= EXPR

EXPR >= EXPR



EXPR in EXPR



EXPR notin EXPR



EXPR subset EXPR



EXPR and EXPR



EXPR or EXPR



EXPR impl EXPR



not EXPR



+ EXPR



- EXPR



% BINOP EXPR



EXPR % BINOP EXPR



exists ITER_ LIST | EXPR



forall ITER_ LIST | EXPR



EXPR where DEFNS end



DEFNS



``Zero or more instances of

DEFN

''



DEFN



BOUND := EXPR ;



ID SELECTOR := EXPR ;



EXPR_ LIST



``One or more instances of

EXPR

separated by commas''



BINOP



``Any binary operator (

+

,

-

,

*

,

**

,

/

,

div

,

mod

,

with

,

less

,

and

,

or

,

impl

) or an

ID

whose value is a function of two parameters.''



FUNC_ CONST



FUNC_ HEAD LOCALS VALUES STMTS end



FUNC_ HEAD



func ( ID_ LIST ) ;



func ( ) ;



LOCALS



local ID_ LIST ;



VALUES



value ID_ LIST ;



ID_ LIST



``One or more instances of

ID

separated by commas.''