1 /* $Id: expression.g,v 1.5 1994/06/24 10:18:15 ceriel Exp $ */
3 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4 * See the copyright notice in the ACK home directory, in the file "Copyright".
6 /* EXPRESSION SYNTAX PARSER */
9 %start If_expr, if_expression;
20 constant_expression(&ifval)
28 '(' expression(pval) ')'
36 { ch7mon(oper, pval); }
41 binary_expression(int maxrank; arith *pval;)
42 {int oper; arith val1;}
45 [%while (rank_of(DOT) <= maxrank)
47 binary_expression(rank_of(oper)-1, &val1)
49 ch7bin(pval, oper, val1);
55 conditional_expression(arith *pval;)
56 {arith val1 = 0, val2 = 0;}
58 /* allow all binary operators */
59 binary_expression(rank_of('?') - 1, pval)
63 assignment_expression(&val2)
64 { *pval = (*pval ? val1 : val2); }
69 assignment_expression(arith *pval;)
71 conditional_expression(pval)
75 expression(arith *pval;)
78 assignment_expression(pval)
80 assignment_expression(&val1)
82 ch7bin(pval, ',', val1);
105 '<' | '>' | LESSEQ | GREATEREQ
113 multop | addop | shiftop
119 [ arithop | relop | eqop | AND | OR ]
123 constant(arith *pval;) :
125 {*pval = dot.tk_val;}
128 constant_expression (arith *pval;) :
129 assignment_expression(pval)