Contents    Page-10    Prev    Next    Page+10    Index   

Top-down Parser

A top-down parser begins with the Sentence symbol, S, expands a production for S, and so on recursively until words (terminal symbols) are reached. If the string of words matches the input, a parsing has been found.[See the Language Generation slide earlier in this section.]

This approach to parsing might seem hopelessly inefficient. However, top-down filtering, that is, testing whether the next word in the input string could begin the phrase about to be tried, can prune many failing paths early.

For languages with keywords, such as programming languages or natural language applications, top-down parsing can work well. It is easy to program.