Jump to content

Talk:Syntax diagram

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

What about the special implementation of sqlite3? --Michael.Haephrati (talk) 11:06, 23 April 2016 (UTC)[reply]

Left recursion and consistency

[edit]

On 7 October 2014, a change by 157.26.65.6 made what I believe to be a reasonable improvement, noting that one of the production rules in the BNF example did not exactly match railroad diagram. However, he only fixed one instance. The next production rule down (for terms) suffered from the same issue, and the EBNF example suffered from the same issue.

It seems like the best plan is to make the BNF and EBNF examples both match the railroad diagram. On the one hand, these two formulations are practically equivalent, and preference may depend on context. On the other hand, as explained in "Compilers: Principles, Techniques, and Tools" (by Aho Sethi and Ulman) on page 182 in the Syntax Analysis chapter: left recursive grammars can cause recursive descent parsers to go into infinite loops, which can often be avoided simply by re-writing the grammar so as to not be left recursive. The non-left-recursive form is certainly easier to conceptually match to the railroad diagrams, so IMO 157.26.65.6 had the right idea.

Ironically, on 27 October 2015, a change by 96.243.107.75 effectively reverted his fix, probably without being aware of it, with the message, "Fixed BNF to agree with EBNF". As noted on 16 May 2014 by 174.96.19.226 on 16 May 2014, the EBNF initially had a number of errors, so the inconsistency should be fixed but not by matching the EBNF but rather fixing it.

I'm doing that now; hopefully this message will clarify the rationale in a way that can't be fully conveyed in the commit message.

JMCorey (talk) 09:09, 13 October 2019 (UTC)[reply]

Update Grammars and Diagrams for Consistency

[edit]

I can generate diagrams automatically with a tool we built, but I don't want to step on toes here as I haven't worked on this page before. I'm happy to take this on and update the page to include other grammar formats like ABNF as well. Gregg-Irwin (talk) 03:34, 19 January 2021 (UTC)Gregg-Irwin[reply]