Table-Driven Parsing Show the steps of a stack-based parser. (Compare to a derivation.) E -> T A A -> + T A | - T A | epsilon T -> ( E ) | 2 input: 2 + 2 Classwork You may work with a partner. Show the steps of a stack-based parser. S -> if E then S S -> E = E E -> 2 | x input: if x then x = 2 Parse Tables Build a parse table for the grammar. E -> T A A -> + T A | - T A | epsilon T -> ( E ) | 2 Classwork You may work with a partner. Build a parse table for the grammar. S -> if E then S S -> E = E E -> 2 | x What's the algorithm for table-driven parsing? push the start-symbol on the stack while (stack and input are not empty) if (top-of-stack is a terminal) if (top-of-stack matches input) pop the stack advance the input else report error else if (top-of-stack is a nonterminal) if (table[top-of-stack, input] is not blank) pop the stack push rule from table[top-of-stack, input] on the stack else report error end while