next up previous contents
Next: The parsers Up: Handle-recognising DFAs and LR(0) Previous: Construction of a handle-recognising   Contents

Operation of a handle-recognising DFA

Any handle-recognising DFA works as follows:

  1. Start in state $I_0$.

  2. SHIFT: As we read symbols from the input, make the appropriate transitions in the DFA from the current state.

  3. REDUCE: If we are in a state that has a production rule of the form
    $A\, \rightarrow\, \alpha {}_{\triangle}$ for any non-terminal $A$ and r.h.s. $\alpha$, then we have recognised the handle $\alpha$, and can reduce by the rule. We do this as follows:
    1. move backwards along the DFA transitions for each symbol in $\alpha$
    2. from the state you end up in, make a forwards transition on $A$

  4. ACCEPT: The final DFA state is the one containing the item $S'\, \rightarrow\, S{}_{\triangle}$. If we reach this state and have consumed all the input, then we accept the string as being valid.



James Power 2002-11-29