Use the CYK algorithm. For a nonempty input word , let be the set of nonterminals that derive the substring . Initialize
For increasing substring lengths, compute
Accept exactly when the start symbol belongs to . The proof is a mathematical induction on substring length: a one-letter derivation uses a terminal production, while every longer parse tree has a root production whose two subtrees yield two adjacent nonempty substrings. The recurrence considers every possible split point and therefore finds exactly all possible roots. For a fixed grammar the algorithm uses time. Under the strict form in part (a), it rejects immediately.

Articles by others on the same topic (0)

There are currently no matching articles.