Re: Semantic actions in Yacc ?

"Virendra K. Mehta" <c1veeru@WATSON.IBM.COM>
Fri, 3 Mar 1995 22:14:28 GMT

          From comp.compilers

Related articles
Semantic actions in Yacc ? frazerw@dseg.ti.com (1995-03-02)
Re: Semantic actions in Yacc ? c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-03-03)
Re: Semantic actions in Yacc ? parrt@parr-research.com (Terence John Parr) (1995-03-04)
Re: Semantic actions in Yacc ? C.A.Elliott@dcs.warwick.ac.uk (1995-03-06)
Re: Semantic actions in Yacc ? clark@quarry.zk3.dec.com (1995-03-06)
Re: Semantic actions in Yacc ? caibmnfx@ibmmail.com (Parag V. Tijare) (1995-03-08)
| List of all articles for this month |
Newsgroups: comp.compilers
From: "Virendra K. Mehta" <c1veeru@WATSON.IBM.COM>
Organization: Compilers Central
Date: Fri, 3 Mar 1995 22:14:28 GMT

[ Frazer Worley, #909980 DAD penned : ]
|o|
|o| eg. Consider a binary grammar.
|o|
|o| grammar : { SemanticBlk1() ; } digits { SemanticBlk2() ; }
|o| ;
|o|
|o| digits : /* empty */
|o| | {} digits {} digit {}


Try


                                          | digits {} digit {}


Basically, actions are just like any other non-terminals in yacc.
Unnecessarily interspersing them with terminals and non-terminals can cause
all sort of conflicts because of the one symbol lookahead. This is compounded
by the fact that no two actions are considered same even if they are empty.


Ciao!
Veeru.
--
Virendra K Mehta | IBM T J Watson Research Centre
c1veeru@watson.ibm.com | (914) 784-7774
viren@wipsys.soft.net |
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.