yacc with multiple attributes

smryan at garth.UUCP smryan at garth.UUCP
Fri Jul 1 06:52:26 AEST 1988


In article <16345 at brl-adm.ARPA> jbaker at ee.ucla.edu (Joe Baker) writes:
>[ This isn't really a C question, but all the yacc users seem to be
>here.  Sorry for the interruption from the C/FORTRAN debate. ]

Please do.
 
>2) Use a struct on the value stack, and carry both value and type
>information (i.e., copy the stuff in Aho, Sethi, and Ullman, chap. 6.)
>I think this would work with various intermediate code representations,

I am currently doing something in this style and found out too late about
major Yacc bugs/features/problems/characteristics: although the stack is
very good about passing up synthesised attributes, it is terrible at passing
down inherited attributes.

I have patched around this by inserting semantics into a production to set
aside inherited attributes. Yacc converts these embedded semantics into a
null production, but seems unable/unwilling to compute lookahead through
these null productions. This has distorted the language and its grammar.

I would suggest, if you haven't started anything yet, avoid Yacc at all costs.



More information about the Comp.lang.c mailing list