Content deleted Content added
m →Generating a parse tree: typos and clarity in one sentence |
→Generating a parse tree: Corrected my own mistake, due to inconsistency between figure and algorithm, and improved explanation. |
||
Line 78:
==Extensions==
===Generating a parse tree===
The above algorithm is a [[recognizer]] that will only determine if a sentence is in the language. It is simple to extend it into a [[parser]] that also construct a [[parse tree]], by storing parse tree nodes as elements of the array, instead of
The end result is then a shared-forest of possible parse trees, where common trees parts are factored between the various parses. This shared forest can conveniently be read as an ambiguous grammar generating only the sentence parsed, but with the same ambiguity as the original grammar, and the same parse trees up to a very simple renaming of non-terminals, as shown by {{harvtxt|Lang|1994}}.
===Parsing non-CNF context-free grammars===
|