L ncodes what l do given urrent state symbol eg shio

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: cs •  ObservaTon ourse Mechanics the contents of the ML Variable Bindings ML the handle are the stack prior to Variable Bindingssame as before. AOer that, new stack will contain a san Grossman ingle non- terminal. D –  Scanning the nDansGrossman uFall 2011 the same ew tack will take s through Fall 2011 transiTons up to the beginning of the handle. Then, one more transiTon for the new non- terminal. –  Can record state numbers on the stack with each symbol, and go directly to the appropriate state when we pop the handle from the stack Winter 2013 UW CSE 401 (Michael Ringenburg) 26 13 1/23/13 New Stack CSE341: Programming CSE341: Programming Languages Languages •  Change the stack to contain pairs of states and symbols from ecture 1 Lecture 1 Lthe grammar $s0 X1 s1 X2 ourse n sn Course Mechanics C s2 … X Mechanics ML –  State sMiL tVariablestate Variable Bindings 0 s he start Bindings –  When we add a symbol to the stack, push the symbol plus new FA Dan Grossman Dan Grossman state Fall 2011 Fall 2011 –  If Xi is the beginning of the handle that we reduce, popping it will reveal si- 1, which is precisely the state the FA was in prior to reading the handle. •  OpTmizaTon: in an actual parser, only the state numbers need to be pushed, since they implicitly contain the symbol informaTon (actually, items). Winter 2013 27 UW CSE 401 (Michael Ringenburg) S ::= aABe A ::= Abc | b B ::= d Trace accept Stack Input $s1 abbcde$ 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 ShiO first symbol on to stack. Winter 2013 UW CSE 401 (Michael Ringenburg) 28 14 1/23/13 S ::= aABe A ::= Abc | b B ::= d Trace Stack Inpu...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online