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:

    ... women can never do efficient and general service in hospitals until their dress is prescribed by laws inexorable as those of the Medes and Persians. Then, that dress should be entirely destitute of steel, starch, whale-bone, flounces, and ornaments of all descriptions; should rest on the shoulders, have a skirt from the waist to the ankle, and a waist which leaves room for breathing.
    Jane Grey Swisshelm (1815–1884)

    God ... created a number of possibilities in case some of his prototypes failed—that is the meaning of evolution.
    Graham Greene (1904–1991)