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:
“Though of erect nature, man is far above the plants. For mans superior part, his head, is turned toward the superior part of the world, and his inferior part is turned toward the inferior world; and therefore he is perfectly disposed as to the general situation of his body. Plants have the superior part turned towards the lower world, since their roots correspond to the mouth, and their inferior parts towards the upper world.”
—Thomas Aquinas (c. 12251274)
“... business training in early life should not be regarded solely as insurance against destitution in the case of an emergency. For from business experience women can gain, too, knowledge of the world and of human beings, which should be of immeasurable value to their marriage careers. Self-discipline, co-operation, adaptability, efficiency, economic management,if she learns these in her business life she is liable for many less heartbreaks and disappointments in her married life.”
—Hortense Odlum (1892?)