060_Bottom_Up_Parsing_3

060_Bottom_Up_Parsing_3 - Bottom-Up Parsing III...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Bottom-Up Parsing III Announcements Written Assignment 1 due 5:00PM today . Submit by email or in the drop-off box in the Gates open area (under the Stanford Venture Fund Laboratories entrance); the filing cabinet should be clearly marked and I'll be nearby. Programming Project 2 due one week from today at 11:59PM. Where We Are Lexical Analysis Syntax Analysis Semantic Analysis IR Generation IR Optimization Code Generation Optimization Source Code Machine Code Recap from Last Time Bottom-up parsing is often done with a handle-finding automaton . Automaton looks for viable prefixes; algorithm determines whether to shift or reduce. LR(0) parsing only works on grammars when reduces are unambiguous. LR(1) parsing works on a large number of grammars, but requires too large a parse table to be practical. SLR(1) parsing augments LR(0) with one lookahead token when a shift/reduce conflict is found. SLR(1) Parsing S E E T E T + E T int T ( E ) T int * T SLR(1) Parsing S E E T E T + E T int T ( E ) T int * T S E E T E T + E T int T . int * T T (E) start S E E E T E T + E T T int T int * T int T ( E) E T E T + E T int T . int * T T (E) ( T int * T T int T . int * T T (E) * E T + E E T E T + E T int T . int * T T (E) + E T + E E int T (E ) E T (E) ) T int * T T ( int T int int T SLR(1) Parsing S E E T E T + E T int T ( E ) T int * T S E E T E T + E T int T . int * T T (E) start S E E E T E T + E T T int T int * T int T ( E) E T E T + E T int T . int * T T (E) ( T int * T T int T . int * T T (E) * E T + E E T E T + E T int T . int * T T (E) + E T + E E int T (E ) E T (E) ) T int * T T ( int T int int T Review of SLR(1) Construct an LR(0) automaton. Only reduce A v if the next lookahead token is in FOLLOW(A). Intuitively, don't reduce when there's no way that the reduction could produce A. The Limits of SLR(1) S E E L = R E R L id L * R R L The Limits of SLR(1) S E E L = R E R L id L * R R L S E E L = R E R L id L * R R L start The Limits of SLR(1) S E E L = R E R L id L * R R L S E E L = R E R L id L * R R L start E L = R R L L The Limits of SLR(1) S E E L = R E R L id L * R R L S E E L = R E R L id L * R R L start E L = R R L L The Limits of SLR(1) S E E L = R E R L...
View Full Document

Page1 / 219

060_Bottom_Up_Parsing_3 - Bottom-Up Parsing III...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online