Otherwise shio winter 2013 9 uw cse 401 michael

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: A ::= Abc | b B ::= d •  Viable prefixes and handles of a CFG are a regular language, thus can recognize with a DFA. Winter 2013 UW CSE 401 (Michael Ringenburg) 8 4 1/23/13 Review From Last Week e CSE341: Programming CSE341: Programming Languages Languages accept 8 9 S ::= aABe S$ start 1 Lecture 1 B Lecture 1 Course Mechanics aCourse A Mechanics 6 c 7 A ::= Abc b 2 3 ML Variable Bindings ML Variable Bindings b d Dan Grossman 5 Fall 2011 4 A ::= b Dan Grossman Fall 2011 B ::= d S ::= aABe A ::= Abc | b B ::= d •  Basic idea: Reduce by handle when we reach state corresponding to viable prefix that goes all the way to the end of a handle. Otherwise, shiO. Winter 2013 9 UW CSE 401 (Michael Ringenburg) Review From Last Week e CSE341: Programming Caccept SE341: Programming Languages Languages 8 9 S ::= aABe S$ start 1 Lecture 1 B Lecture 1 Course Mechanics aCourse A Mechanics 6 c 7 A ::= Abc b 2 3 ML Variable Bindings ML Variable Bindings b d Dan Grossman 5 Fall 2011 4 A ::= b Dan Grossman Fall 2011 B ::= d S ::= aABe A ::= Abc | b B ::= d •  But, recall from last week that this involved a lot of DFA transiTons at every step – not O(n). Winter 2013 UW CSE 401 (Michael Ringenburg) 10 5 1/23/13 S ::= aABe A ::= Abc | b B ::= d Trace Stack Input $ abbcde$ $a bbcde$ $ab bcde$ $aA bcde$ accept S$ start 8 B 1 a 2 A b b 3 6 e c 9 S ::= aABe 7 A ::= Abc d 4 5 A ::= b B ::= d •  Consider what happens before and aOer a shiO … Winter 2013 11 UW CSE 401 (Michael Ringenburg) S ::= aABe A ::= Abc | b B ::= d Trace Stack Input $ abbcde$ $a bbcde$ $ab bcde$ $aA bcde$ accept S$ start 8 B 1 a 2 b A 3 b 6 e c 9 S ::= aABe 7 A ::= Abc d 4 A ::= b 5 B ::= d •  Consider what happens before and aOer a shiO … Winter 2013 UW CSE 401 (Michael Ringenburg) 12 6 1/23/13 S ::=...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online