a = b = 1 just syntactic sugar?

Martin v. Löwis martin at v.loewis.de
Mon Jun 9 12:48:22 CEST 2003

Ed Avis <ed at membled.com> writes:

> Yes - I don't know enough about parser generators to tell what they
> do in the case of an ambiguity.  

Typically, they favour one arbitrary alternative over the other.
So it is best if the grammar is not ambiguous in the first place.

> 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?

Out of the box, it wouldn't.

> Are there already legal Python constructs that match two or more
> grammar rules?

Not that I'm aware of.


More information about the Python-list mailing list