A simple single line, triple-quoted comment is giving syntax error. Why?
Thomas 'PointedEars' Lahn
PointedEars at web.de
Sat Mar 28 14:20:13 EDT 2015
Ian Kelly wrote:
> […] Thomas 'PointedEars' Lahn […] wrote:
>> Ian Kelly wrote:
>>> What I mean is that if you construct a parse tree of "foo" "bar" using
>>> that grammar, it looks like this:
>>>
>>> expr
>>> |
>>> STRING+
>>> / \
>>> STRING STRING
>>> […]
>>>
>>> There is only one expr node, and it contains both STRING tokens.
>> Prove it.
>
> I'm not going to expend the effort that would be required to go
> through the entire Python grammar step-by-step and exhaustively prove
> that "foo" "bar" can unambiguously only be produced as a single expr.
And why should you? That is not what you claimed.
> If you believe otherwise, show a parse tree that parses these as
> separate expressions.
Fallacies: Straw man, shifting the burden of proof.
>> But be warned: Neither would prove that a string literal is not an
>> expression.
>
> I've not claimed that a string literal is not an expression.
Yes, you did. You debated my statement which says that. Let me refresh
your memory. I said:
| As I showed, string literals and consecutive tokens of string literals
| (“STRING+”) so as to do implicit concatenation *are* expressions of the
| Python grammar.
To which you replied:
| What the grammar that you quoted from shows is that STRING+ is an
| expression. The individual STRINGs of a STRING+ are not expressions, […]
^^^^^^^ ^^^^^^^^^^^^^^^^^^^
You continued with
| except to the extent that they can be parsed in isolation as a STRING+.
but that is nothing more than a backdoor, contradictory to what you said
before (and, as it has been showed, nonsensical).
> My claim is that a literal consisting of the implicit concatenation of
> more than one string token is can only be parsed as one expression, not
> several.
Then you must have fundamentally misunderstood my statement and this whole
discussion.
> Parsing "foo" "bar"
>
>> Because you did not consider the most simple variant of an AST
>> (or subtree) according to this grammar:
>>
>> expr
>> |
>> STRING
>
> Of course I did. This is again *exactly* what I was talking about in
> reference to parsing the individual strings in isolation.
Actually, you were arguing against my statement that string literals are
expressions (that a string literal is an expression). You claimed, rather
explicitly, that they were not. See above.
>> Again, “STRING+” does _not_ mean “STRING STRING STRING*”; it means
>> “STRING STRING*”. The second and following STRINGs are *optional*.
>
> Please stop speaking down to me.
I am not speaking down to you. But the fact needed to be emphasized that
you could not have been reading carefully what I wrote.
> I'm quite familiar with basic concepts of EBNF.
But apparently not logic.
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
More information about the Python-list
mailing list