Back to Predictive Parsing, Continued. On to Shift-Reduce Parsing, Continued.
Held Friday, February 23, 2001
Summary
Today we consider an alternate form of parsing, shift-reduce parsing. Shift-reduce parsing can be applied to many more grammars than can predicitve parsing.
Notes
Overview
for each nonterminal N, build the method parseN as follows for each production, N ::= Stuff for each symbol in first(Stuff) add a case for that symbol, using the steps to parse Stuff end for if nullable(Stuff) then for each symbol in Follow(N) add a case for that symbol, using the steps to parse Stuff -- Note that we still parse Stuff, even thoush we -- ``know'' it nullifies end for end if end for each production end for each nonterminal
N ::= N beta
A ::= A a A ::= b
b
followed by
zero or more a
's, so we can rewrite that as
A ::= b A' A' ::= | a A'
N ::= a A | a B
N ::= a N' N' ::= A | B
N ::= A A | B B A ::= a A | c B ::= a | b B
Monday, 22 January 2001
Friday, 23 February 2001
Back to Predictive Parsing, Continued. On to Shift-Reduce Parsing, Continued.
[Current]
[Discussions]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Primary
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Quizzes]
[Readings]
[Reference]
Sets
[Blackboard]
[98F]
Links
Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.
This page was generated by Siteweaver on Mon Apr 30 10:51:56 2001.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2001S/outline.15.html
.
You may validate
this page's HTML.
The source was last modified Mon Feb 26 10:15:42 2001.