• Input:    Precedence-table for G = (N, T, P, S); x Î T*
• Output: Right parse of x if x Î L(G); otherwise, error
• Method:
• Push $ onto the pushdown;
• repeat
• let a = the current token and
        b = the topmost terminal on the pushdown
• case Table[b, a] of:
• = : push(a) & read next a from input string
• < : replace b with b< on the pushdown &
        push(a) & read next a from input string
• > : if <y is the pushdown top string and r: A ® y Î P
        then replace <y with A & write r to output
  else error
• blank : error
  until a = $ and b = $
• success
Operator-Precedence Parser: Algorithm
5/42