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:
“Some people are under the impression that all that is required to make a good fisherman is the ability to tell lies easily and without blushing; but this is a mistake. Mere bald fabrication is useless; the veriest tyro can manage that. It is in the circumstantial detail, the embellishing touches of probability, the general air of scrupulousalmost of pedanticveracity, that the experienced angler is seen.”
—Jerome K. Jerome (18591927)
“Consider the deference which is everywhere paid to a doctors opinion. Nothing more strikingly betrays the credulity of mankind than medicine. Quackery is a thing universal, and universally successful. In this case it becomes literally true that no imposition is too great for the credulity of men.”
—Henry David Thoreau (18171862)