next up previous contents
Next: Shift Reduce Parsers Up: PARSING Previous: PARSING   Contents

Top Down Parsers

The most widely known, and easiest to implement, parser is a top-down, recursive descent parser. This is a goal driven method that starts with the root symbol of the grammar, and recursively solves the leftmost subgoal (or nonterminal) of each rule it comes across (or rightmost if it is a right to left parser).

If at any point a wrong choice was made, (no remaining subgoals and whole sentence has not been covered), backtracking is used to return to the last choice point with remaining alternatives and continue down another route. This method of parsing is exponential in the number of words in the sentence and is very prone to infinite loops. All that is required is a left, or right, recursive grammar depending on the type of parser.



Andrew P Coates (UG) 2002-07-17