Re: [Python-Dev] Python Grammar Ambiguity

2006-04-28 Thread Christos Georgiou
"Michael Foord" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It worries me that there might be a valid expression allowed here that I > haven't thought of. My current rules allow anything that looks like > ``(a, [b, c, (d, e)], f)`` - any nested identifier list. Would anything

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Michael Foord
Guido van Rossum wrote: > This is probably because we have a similar ambiguity in assignments: > the grammar says something like > > exprlist ('=' exprlist)* > > but what is actually desired is > > (varlist '=')* exprlist > > Unfortunately the latter is not LL1 so we lie to the parser and tell

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Brett Cannon
On 4/24/06, Michael Foord <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm working on a parser for part of the Python language (expressions but > not statements basically). I'm using PLY to generate the parser and it's > mostly done. > > I've hit on what looks like a fundamental ambiguity in the Pyt

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Guido van Rossum
This is probably because we have a similar ambiguity in assignments: the grammar says something like exprlist ('=' exprlist)* but what is actually desired is (varlist '=')* exprlist Unfortunately the latter is not LL1 so we lie to the parser and tell it the first form, and then in the code

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Michael Foord
[EMAIL PROTECTED] wrote: > Michael> I've hit on what looks like a fundamental ambiguity in the > Michael> Python grammar which is difficult to get round with PLY; and > Michael> I'm wondering *why* the grammar is defined in this way. > > Michael, > > You refer to the ref manual document

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Michael Foord
(oops - should have gone to list) Guido van Rossum wrote: > Well, yes, the syntax is supposed to be something like "for varlist in > testlist". Could you report this as a doc bug (if you found this > information in the docs)? > I think the documentation (which does put expression_list there) r

[Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Michael Foord
Hello all, I'm working on a parser for part of the Python language (expressions but not statements basically). I'm using PLY to generate the parser and it's mostly done. I've hit on what looks like a fundamental ambiguity in the Python grammar which is difficult to get round with PLY; and I'm

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread skip
Michael> I've hit on what looks like a fundamental ambiguity in the Michael> Python grammar which is difficult to get round with PLY; and Michael> I'm wondering *why* the grammar is defined in this way. Michael, You refer to the ref manual documentation: Michael> List displays (

Re: [Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Guido van Rossum
Well, yes, the syntax is supposed to be something like "for varlist in testlist". Could you report this as a doc bug (if you found this information in the docs)? On 4/24/06, Michael Foord <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm working on a parser for part of the Python language (expressio

[Python-Dev] Python Grammar Ambiguity

2006-04-24 Thread Michael Foord
Hello all, I'm working on a parser for part of the Python language (expressions but not statements basically). I'm using PLY to generate the parser and it's mostly done. I've hit on what looks like a fundamental ambiguity in the Python grammar which is difficult to get round with PLY; and I'm won