
100 Compilers – Principles and Practice
This completes the generation of the FSM of the PDF from the grammar. If you compare the states
and transitions with Fig. 4.8, you will find one-to-one correspondence.
4.3.6 Table-driven LR(0) Parser
We have to now construct the parsing table for the given grammar. We now define two functions:
F() is an action function or mapping; F(state on TOS, current input) → {S, rk, A, error}, where
S = shift in a symbol, rk = reduce by production rule k, A = accept the string and error will be
denoted by a blank in the table.
G() is the next state or GoTo function; G(state on TOS, symbol in V) → {q, error}, where ...