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:
“The General Order is always to manoeuver in a body and on the attack; to maintain strict but not pettifogging discipline; to keep the troops constantly at the ready; to employ the utmost vigilance on sentry go; to use the bayonet on every possible occasion; and to follow up the enemy remorselessly until he is utterly destroyed.”
—Lazare Carnot (17531823)
“Without metaphor the handling of general concepts such as culture and civilization becomes impossible, and that of disease and disorder is the obvious one for the case in point. Is not crisis itself a concept we owe to Hippocrates? In the social and cultural domain no metaphor is more apt than the pathological one.”
—Johan Huizinga (18721945)