Remarks
As can be seen from the example the parser performs three types of steps depending on whether the top of the stack is a nonterminal, a terminal or the special symbol $:
- If the top is a nonterminal then it looks up in the parsing table on the basis of this nonterminal and the symbol on the input stream which rule of the grammar it should use to replace it with on the stack. The number of the rule is written to the output stream. If the parsing table indicates that there is no such rule then it reports an error and stops.
- If the top is a terminal then it compares it to the symbol on the input stream and if they are equal they are both removed. If they are not equal the parser reports an error and stops.
- If the top is $ and on the input stream there is also a $ then the parser reports that it has successfully parsed the input, otherwise it reports an error. In both cases the parser will stop.
These steps are repeated until the parser stops, and then it will have either completely parsed the input and written a leftmost derivation to the output stream or it will have reported an error.
Read more about this topic: LL Parser
Famous quotes containing the word remarks:
“An illustrious individual remarks that Mrs. [Elizabeth Cady] Stanton is the salt, Anna Dickinson the pepper, and Miss [Susan B.] Anthony the vinegar of the Female Suffrage movement. The very elements get the white male into a nice pickle.”
—Anonymous, U.S. womens magazine contributor. The Revolution (August 19, 1869)
“Where do whites fit in the New Africa? Nowhere, Im inclined to say ... and I do believe that it is true that even the gentlest and most westernised Africans would like the emotional idea of the continent entirely without the complication of the presence of the white man for a generation or two. But nowhere, as an answer for us whites, is in the same category as remarks like Whats the use of living? in the face of the threat of atomic radiation. We are living; we are in Africa.”
—Nadine Gordimer (b. 1923)
“The general feeling was, and for a long time remained, that one had several children in order to keep just a few. As late as the seventeenth century . . . people could not allow themselves to become too attached to something that was regarded as a probable loss. This is the reason for certain remarks which shock our present-day sensibility, such as Montaignes observation, I have lost two or three children in their infancy, not without regret, but without great sorrow.”
—Philippe Ariés (20th century)