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:
“In communist society, where nobody has one exclusive sphere of activity but each can become accomplished in any branch he wishes, society regulates the general production and thus makes it possible for me to do one thing today and another tomorrow, to hunt in the morning, fish in the afternoon, rear cattle in the evening, criticize after dinner, just as I have a mind, without ever becoming hunter, fisherman, shepherd or critic.”
—Karl Marx (18181883)
“The real exertion in the case of an opera singer lies not so much in her singing as in her acting of a role, for nearly every modern opera makes great dramatic and physical demands.”
—Maria Jeritza (18871982)