A simple single line, triple-quoted comment is giving syntax error. Why?

Ian Kelly ian.g.kelly at gmail.com
Fri Apr 3 02:21:53 CEST 2015

On Thu, Apr 2, 2015 at 3:31 PM, Thomas 'PointedEars' Lahn
<PointedEars at web.de> wrote:
> Ian Kelly wrote:
>> […] Thomas 'PointedEars' Lahn […] wrote:
>>> Ian Kelly wrote:
>>>> Within a grammar, the question of "is an X a Y" is nonsensical in
>>>> isolation. It can only be answered in relation to a parse tree.
>>>> Consider the simple grammar:
>>>> S -> A | B
>>>> A -> x
>>>> B -> x
>>>> Is x an A? It depends.
>>> No, by the definition 2 below, that we all accepted implicitly up to this
>>> point, x is *definitely* an A.
>> What gives you the impression that I ever accepted it?
> ,-<news:mailman.181.1427346636.10327.python-list at python.org>
> |
> | What the grammar that you quoted from shows is that STRING+ is an
> | expression.
> There is *no way* for you to make that statement if you did not accept
> definition (2).

Actually, there is a very simple way: I was being sloppily imprecise
when I wrote that.  First, I was speaking only in reference to the
class of parse trees with more than one STRING, as that was the topic
under discussion. I should have been clearer about that. Second, I
never should have used the term "STRING+" there (or anywhere else in
this discussion), as that merely clouded the point I was trying to
offer. What I *meant* was that the complete sequence of produced
STRINGs -- as opposed to any individual STRING -- is an expression,
and I inappropriately used "STRING+" to denote that. (Maybe that is
the point you were trying to make when you were talking about EBNF

>> This question of whether "x is an A" is informal and not a topic of formal
>> language theory so far as I'm aware. Can you cite some source for it?
> No, because I was formalizing the ad-hoc definition by Chris Angelico in
> <news:mailman.51.1426995416.10327.python-list at python.org>.

That URI is not useful to me as I don't use a newsreader. Is that the
message dated Sun, 22 Mar 2015 14:36:48 +1100? I don't see any
suggestion of this definition in that post.

t>>> Now, according to these definitions, in the offered grammar x is *both*
>>> an A and a B.  Because what matters is _not_ the practical result of
>>> production chains (the actual parse tree), but the certainty of the
>>> theoretical possibility of it.
>> This strikes me as being a lot like arguing, "some kites are toys, and
>> some kites are birds; therefore, all kites are both toys and birds."
> False analogy again.  We are discussing *in theory* a *formal* grammar.  Its
> goal symbols have *no meaning* except what can be produced from them.

We're discussing a formal grammar as if it described a classification
hierarchy, which gives meaning to statements like "A STRING is an
expr". Otherwise, that statement is meaningless and can be neither
true nor false. So I think that the analogy between one such hierarchy
and another is apt.

>> You're really going to make me spell it out, aren't you? Fine, here you
>> go.
>> single_input -> […] -> expr -> […] -> atom -> STRING STRING
>> Note: the derivation contains exactly one expr node, which indirectly
>> produces both STRINGs. Neither STRING in this derivation is
>> individually produced from the expr.
> So you have proven that which nobody ever doubted nor requested, but I
> pointed out already.

As I tried to point out several posts back when I suggested that we
were in agreement, and which you flatly denied.

> What you have still not proven is what you claimed:
> the parse tree.

Because you misunderstood my claim.

More information about the Python-list mailing list