February 2022
Beginner to intermediate
572 pages
13h
English
Given a context-free grammar, we create an equivalent nondeterministic pushdown automaton (npda) that models the LL parsing process. We previously saw in Section 7.2 an algorithm for converting any context-free grammar to an npda. In that algorithm, we first had to convert the context-free grammar to Greibach normal form. Here we use a different approach where the context-free grammar is not restricted to any form.
We design the npda in the following way. Given a grammar G = (V, T, S, P), parsing starts with the start symbol and repeatedly replaces a variable by one of its rules. For a rule A → w ∈ P with A ∈ V and w ∈ (V ∪ T)*, the ...
Read now
Unlock full access