Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!uw-beaver!teknowledge-vaxc!sri-unix!garth!smryan From: smryan@garth.UUCP Newsgroups: comp.lang.c Subject: Re: yacc with multiple attributes Message-ID: <838@garth.UUCP> Date: 30 Jun 88 20:52:26 GMT References: <16345@brl-adm.ARPA> Reply-To: smryan@garth.UUCP (Steven Ryan) Organization: INTERGRAPH (APD) -- Palo Alto, CA Lines: 21 In article <16345@brl-adm.ARPA> jbaker@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.