050_Bottom_Up_Parsing_2

050_Bottom_Up_Parsing_2 - Bottom-Up Parsing II...

Info iconThis preview shows pages 1–17. 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

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 II Announcements Programming Project 1 due tonight at 11:59PM. Written Assignment 1 due next Wednesday, 5:00PM. If you need help: Hrysoula will be holding OH from 1:00 3:00 today in Gates 24A. Feel free to ask on www.piazzza.com Or email the staff directly at cs143-sum1011-staff@lists.stanford.edu . Submission instructions on course website. Programming Project 2 out, due Wednesday, July 13 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 A left-to-right, bottom-up parse is a rightmost derivation traced in reverse . A handle is a substring of a sentential form that can be reduced without getting stuck. Bottom-up parsing is often done as shift/reduce parsing: Split the text to parse into two groups. Shift : Push a new token atop the stack. Reduce : Update the top of the stack by applying a reduction. Question: How do we find the handle? Viable Prefixes A viable prefix is a string w such that, for some v , w | v is a legal configuration in a shift/reduce parser. In other words, a viable prefix is a string of terminals and nonterminals, that does not extend past a handle, that can be completed with terminals into a sentential form. Critical Fact The set of viable prefixes for any grammar is a regular language . Critical Fact The set of viable prefixes for any grammar is a regular language . This is a nontrivial result! Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int S E $ Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int S E $ E E + T Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int S E $ E E + T E T Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int S E $ E E + T E T T int Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int S E $ E E + T E T T int Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + int ) ( int + int S E $ E E + T E T T int Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + T ) ( int + int S E $ E E + T E T T int Tracking our Position in Productions S E $ E T E E + T T int T ( E ) int + int * int $ + T ) ( int + int S E $ E E + T E T Tracking our Position in Productions...
View Full Document

Page1 / 400

050_Bottom_Up_Parsing_2 - Bottom-Up Parsing II...

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

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