LL Parser - General Case

General Case

The parser works on strings from a particular context-free grammar.

The parser consists of

  • an input buffer, holding the input string (built from the grammar)
  • a stack on which to store the terminals and non-terminals from the grammar yet to be parsed
  • a parsing table which tells it what (if any) grammar rule to apply given the symbols on top of its stack and the next input token

The parser applies the rule found in the table by matching the top-most symbol on the stack (row) with the current symbol in the input stream (column).

When the parser starts, the stack already contains two symbols:

where '$' is a special terminal to indicate the bottom of the stack and the end of the input stream, and 'S' is the start symbol of the grammar. The parser will attempt to rewrite the contents of this stack to what it sees on the input stream. However, it only keeps on the stack what still needs to be rewritten.

Read more about this topic:  LL Parser

Famous quotes containing the words general and/or case:

    Private property is held sacred in all good governments, and particularly in our own. Yet shall the fear of invading it prevent a general from marching his army over a cornfield or burning a house which protects the enemy? A thousand other instances might be cited to show that laws must sometimes be silent when necessity speaks.
    Andrew Jackson (1767–1845)

    Pardon me, you are not engaged to any one. When you do become engaged to some one, I, or your father, should his health permit him, will inform you of the fact. An engagement should come on a young girl as a surprise, pleasant or unpleasant, as the case may be. It is hardly a matter that she could be allowed to arrange for herself.
    Oscar Wilde (1854–1900)