123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- /*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
- /* E X P R E S S I O N S */
- /* stripped down version of the one in the Modula-2 compiler */
- /* $Header$ */
- qualident :
- IDENT
- [
- selector
- ]*
- ;
- selector :
- '.' IDENT
- ;
- ExpList :
- expression
- [
- ',' expression
- ]*
- ;
- ConstExpression :
- expression
- /*
- * Changed rule in new Modula-2.
- */
- ;
- expression :
- SimpleExpression
- [
- /* relation */
- [ '=' | '#' | '<' | LESSEQUAL | '>' | GREATEREQUAL | IN ]
- SimpleExpression
- |
- /* empty */
- ]
- ;
- SimpleExpression :
- [
- '+'
- |
- '-'
- |
- /* empty */
- ]
- term
- [
- /* AddOperator */
- [ '+' | '-' | OR ] term
- ]*
- ;
- term :
- factor
- [
- /* MulOperator */
- [ '*' | '/' | DIV | MOD | AND ] factor
- ]*
- ;
- factor :
- qualident
- [
- designator_tail?
- [
- ActualParameters
- |
- /* empty */
- ]
- |
- bare_set
- ]
- |
- bare_set
- | %default
- [ %default
- INTEGER
- |
- REAL
- |
- STRING
- ]
- |
- '(' expression ')'
- |
- NOT factor
- ;
- bare_set :
- '{'
- [
- element
- [
- ',' element
- ]*
- |
- /* empty */
- ]
- '}'
- ;
- ActualParameters :
- '(' ExpList? ')'
- ;
- element :
- expression
- [
- UPTO expression
- |
- /* empty */
- ]
- ;
- designator :
- qualident designator_tail?
- ;
- designator_tail :
- visible_designator_tail
- [ %persistent
- %default
- selector
- |
- visible_designator_tail
- ]*
- ;
- visible_designator_tail :
- '['
- expression
- [
- ',' expression
- ]*
- ']'
- |
- '^'
- ;
|