Given a grammar G and a string that one believes is a
member of L(G) there are two basic ways that one can attempt to find
a derivation of from S.
Top-down parsing
Begin with the start symbol of G and repeatedly
substitute the left hand side of a production for a
non-terminal until the start symbol has been rewritten to
match .
Bottom-up parsing
Begin with and repeatedly "simplify"
the string by replacing a sub-string that matches the right hand
side of a production by the non-terminal on its left hand side
until has been simplified to S.
In our discussion we will make the assumption that we want to
produce derivations "on-the-fly". That is, that we do not want
to hold the entire input string in memory but wish to generate
a derivation while making a single pass through the input string.