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

sohcahtoa82 at gmail.com sohcahtoa82 at gmail.com
Tue Mar 31 19:10:32 EDT 2015


On Tuesday, March 31, 2015 at 12:24:53 AM UTC-7, Ian wrote:
> On Sun, Mar 29, 2015 at 4:41 AM, Thomas 'PointedEars' Lahn
> <PointedEars at web.de> wrote:
> > Ian Kelly wrote:
> >
> >> […] Thomas 'PointedEars' Lahn […] wrote:
> >>> Ian Kelly wrote:
> >> Why should the burden of proof be on me in the first place?
> >
> > Because *you* made the claim that “STRING+” could be part of an AST in this
> > way.
> 
> Okay, I didn't understand before that this was the part that you were
> objecting to. I had written "There is only one expr node, and it
> contains both STRING tokens", to which you replied "Prove it." I did
> not intend to imply anything at all by the inclusion of STRING+ in the
> tree. That pseudo-tree was hastily sketched out, and as both you and
> Gregory have pointed out, STRING+ is not a symbol of the grammar and
> should not have been included as a node. None of this has any bearing
> on what I was trying to demonstrate with that tree.
> 
> >> 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?
> 
> >> If the tree that generates the x produces it from an A node, then yes.
> >> Otherwise, no.
> >
> > Fallacy.
> >
> > First, two definitions, so that we are clear what we are talking about:
> >
> > (1) Let a *production chain* be the repeated application of the production
> >     rules of a formal grammar such that
> >
> >       C ⇒ D ⇒ x
> >
> >     is a production chain if there are production rules
> >
> >       C → D
> >       D → x.
> >
> >     [Note the difference between “⇒” and “→”.]
> 
> Sure.
> 
> > (2) Let the statement “x is an A” be true if x can be produced in a
> >     production chain starting with or including the non-terminal A
> >     left-hand side –
> >
> >       x ∈ A ↔ ∃A (… ⇒ A ⇒ … ⇒ x).
> 
> Sorry, but this definition just seems entirely arbitrary to me.
> Mathematically, it looks nonsensical; A is a symbol, not a set. 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?
> 
> > 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."
> 
> >> So when I write that the "foo" in "foo" "bar" is not an expression, I
> >> am only speaking in relation to the parse tree that generates "foo"
> >> "bar".
> >
> > But it has been indicated by others that the parse tree that you presented
> > is wrong, based on a misconception about the syntax of the formal grammar,
> > and you have not yet substantiated your claim that it is correct.
> 
> As noted above, the inaccuracy that Gregory pointed out has no bearing
> on my argument.
> 
> You're really going to make me spell it out, aren't you? Fine, here you go.
> 
> single_input -> simple_stmt -> expr_stmt -> testlist_star_expr -> test
> -> or_test -> and_test -> not_test -> comparison -> expr -> xor_expr
> -> and_expr -> shift_expr -> arith_expr -> term -> factor -> power ->
> 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.
> 
> >> I don't know what you mean by a "backdoor".
> >
> > Appending a statement that is contradictory to what was stated just before,
> > or at least ambiguous, so that the possibility arises for one to say “I did
> > not mean that” when that/a contradiction to the former statement is pointed
> > out later.
> 
> The purpose was not to make the possibility arise to say that. The
> purpose was to point out the discontinuity *immediately* so that it
> would be already addressed and not *need* to be pointed out later
> (although we can see how well that turned out).
> 
> I have to say that I find it highly surprising that you find this
> construction objectionable. Would you still consider it
> "contradictory" if I had phrased it equivalently as a logical "or"
> rather than using the word "except"?
> 
> >> The purpose of that parenthetical was to explicitly acknowledge that the
> >> single STRING could be viewed as an expression when taken out of context,
> >
> > Yes, your fallacy is mainly based on ignoring the context.  Context is
> > important; you cannot just ignore it and still make correct arguments.
> 
> Funny, I thought that was my line. This whole argument came about
> because you seem to be stubbornly insistent on ignoring the context
> that I set for my statement, calling it "contradictory" instead.
> 
> >> and to disclaim that I was excluding that case from the preceding
> >> statement. I still stand by that statement; The "foo" in "foo" "bar" is
> >> not an expression in the same sense that the "42" is not an expression in
> >> "hucr,.@#%c|42ptqc$".
> >
> > False analogy.  The “42” in there cannot be produced by “expr” *in that
> > context* (it can only be produced by “STRING”).
> 
> I apologize for the confusion. The quotation marks there were only
> intended to separate the nonsense construction from my own text, not
> as string delimiters. I realize that in the first part of the analogy
> I did use them as string delimiters, so I was inconsistent.
> 
> The analogy to be drawn is that a parse tree of ⟨"foo" "bar"⟩ that
> contains an expr node for each STRING is an invalid parse, just as a
> parse tree of ⟨hucr,.@#%c|42ptqc$⟩ that isolates ⟨42⟩ as a single expr
> (or any other parse tree in this particular case) is invalid.
> 
> >>> 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.
> >>
> >> I have no idea what point you're trying to convey here.
> >
> > Is the “See above” not enough a reference?
> 
> I get the connection between what you wrote here and what you wrote
> above. I don't get the connection between what I wrote (that has now
> been trimmed away) and what you wrote in response to it. My
> parenthetical about parsing STRINGs in isolation was not in itself an
> argument against what you wrote. It was in fact agreeing, within a
> limited context.

Holy hell, dude, you've been arguing about this for nearly two weeks now.

Let it go.



More information about the Python-list mailing list