a = b = 1 just syntactic sugar?

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Mon Jun 9 22:17:57 EDT 2003


Ed Avis wrote:
> I don't know enough about parser generators to tell what they
> do in the case of an ambiguity.  Would it find a syntax error or would
> it pick one of the two alternatives based on which production occurs
> earlier in the grammar definition?

Depends on the parser generator. Yacc warns about ambiguities
when processing the grammar; if you ignore the warnings, at
runtime it does whatever it thinks best (which might not be
what *you* thought best:-[). I don't know what pgen does.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list