yacc precedences and associativities

Matt O'Brien <mjobrien@delphi.com>
1 Oct 1999 10:15:10 -0400

          From comp.compilers

Related articles
yacc precedences and associativities mjobrien@delphi.com (Matt O'Brien) (1999-10-01)
| List of all articles for this month |

From: Matt O'Brien <mjobrien@delphi.com>
Newsgroups: comp.compilers
Date: 1 Oct 1999 10:15:10 -0400
Organization: Delphi (info@delphi.com email, 800-695-4005 voice)
Keywords: yacc, practice, comment

Would you recommend using %left,%right,%nonassoc to fix shift/reduce
conflicts in a particular grammar using yacc or could you run into
problems down the road if you specify precedences and associativities that
way? Also .. %prec .. Or do you say just to fiddle with the
grammar?
thanks,matt
[My advice is to use precedences in a few simple and well-understood
situations, expressions like expr OP expr and dangling else, but not
to use them elsewhere. The problem is that precedence rules always make
the shift/reduce conflict go away, but in less stereotyped contexts the
conflict more often than not reveals a problem in the grammar which the
precedence then hides. -John]


Post a followup to this message

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