PCC compiler question

tektronix!tekmdp!bronze!grahamr tektronix!tekmdp!bronze!grahamr
Mon Apr 4 07:36:57 AEST 1983


I, too, want this argument to end, but without any mud slung at yacc.
With all due respect, there is no yacc bug.  We were all brought up on
appendix A of the yacc manual, where there is only one set of productions
for an "expression".  The C language is not this way; it has lvalues to
deal with AND THEY ARE *SYNTACTICALLY* DIFFERENT FROM SIMPLE EXPRESSIONS.

This is the fragment we are dealing with:

expr	:	expr ANDAND expr
	|	lvalue ASSIGN expr
	|	primary
	;

primary	:	ID
	;

lvalue	:	ID
	;

The input is "ID ANDAND ID ASSIGN ID".  Please note that the phrase
"ID ANDAND ID" cannot be reduced to "lvalue".  Look in the C Reference
Manual and you will find that the same is true there.  This means that
the parser simply will not do this reduction.  This characteristic of
LR parsers is supposed to be a feature.  Precedence rules are invoked
when there are two or more legal parses.  That is not happening here and
therefore the precedence rules are not being invoked.

On the subject of cdecl:  We are working on the problem.  If you don't
have it by 4/8, send me mail or give me a call and I'll put you on my
bulk mailing list.

	Graham Ross
	Tektronix, Inc.
	(ucbvax|decvax)!teklabs!tekmdp!grahamr
	(503) 629-1953



More information about the Comp.lang.c mailing list