Ian Kelly wrote: > […] Thomas 'PointedEars' Lahn […] wrote: >> 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. > > Of course it is. I claimed that there was only one expr node in the > parse tree of "foo" "bar".
Which is something else. > That would require two things: […] What I asked you would require only a real-life representation of the parse tree above. >>> If you believe otherwise, show a parse tree that parses these as >>> separate expressions. >> Fallacies: Straw man, shifting the burden of proof. > > If there is a straw man here, it is only the result of one or both of > us failing to communicate. I agree. > If so, then why did you ask me to prove it? See above. > 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. > In any case, it sounds to me like we're probably in agreement at this > point. I do not think so. > 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. > 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 “→”.] (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). 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. However, in the interest of disambiguity in their parsers, programming languages do not have such a set of production rules in their grammar that lead to ambiguous productions. In particular, you will not find in the Python grammar another production rule that leads to “STRING” being producable by a production chain not containing “expr”. So, if we accept these definitions, we can and have to extend the classification of STRING( literals) to say that they are “atom”s, “arith(metic)_expr”(ession)s (as strange as that may sound), and so on, “expr”(ession)s, “comparison”s and so on (as strange as that may sound), and finally “st(ate)m(en)t”s (this fact started the whole discussion), and “single_input”s, and not anything else. > 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. > I am not speaking about the parse tree that generates only > "foo", because it is irrelevant, even though in that context it would > be an expression. Same fallacy as above. > 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 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. > 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”). >> 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'm quite familiar with basic concepts of EBNF. >> But apparently not logic. > > Are you intentionally trying to be inflammatory? I am merely stating my observations. There is no offense where none is taken. > I think that I have misunderstood your writing in places and that you have > likewise misunderstood mine in others. Can we leave it at that? No, because misunderstandings need to be clarified and fallacies need to be exposed if we are to arrive at the truth. -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/mailman/listinfo/python-list