That generate the same f language may be

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: ducQons A =>* αMf tVariableaBindings f p Bindings i L here is chain o –  derives •  starQng with A that generates α Dan Grossman Dan Grossman –  transiQve closure Fall 2011 Winter 2013 Fall 2011 UW CSE 401 (Michael Ringenburg) 35 DerivaQon RelaQons (2) CSE341: Programming CSE341: Programming Languages Languages •  w A γ =>lm w β γ iff A ::= β in P •  Lecture 1 Course Mechanics α A w =Mrm Variable iBindingsβ in P > L α β w ML Variable Bindings ff A ::= Lecture 1 –  derives legmost Course Mechanics –  derives rightmost Dan Grossman Fall 2011 Dan Grossman Fall 2011 •  We will only be interested in legmost and rightmost derivaQons – not random orderings Winter 2013 UW CSE 401 (Michael Ringenburg) 36 Languages CSE341: Programming CSE341: Programming Languages Languages •  For A in N, L(A) = { w | A =>* w } Lecture 1 Lecture 1 •  If S is the start sMechanicsgrammar G, define ymbol of Mechanics Course Course L(G ) = LML)Variable Bindings Bindings (S ML Variable –  Nonterminal on leg of first rGrossman ule is taken to be the Dan Dan Grossman start symbol if one is not specified explicitly Fall 2011 Fall 2011 Winter 2013 UW CSE 401 (Michael Ringenburg) 37 Reduced Grammars CSE341: Programming Languages CSE341: Programming •  Grammar G is reduced Languages iff for every producQon ALecturen G tLectures a derivaQon ::= α i 1 here i 1 Course Mechanics S =>* x C z => xMechanics yz Bindings Aourse α z =>* x ML Variable ML Variable Bindings –  i.e., no producQon is useless Dan Grossman Dan Grossman –  E.g., S ::= hello, Y::=goodbye is not reduced (no Fall 2011 Fall 2011 derivaQon starQng at S will ever use the Y producQon) •  ConvenQon: we will use only reduced grammars Winter 2013 UW CSE 401 (Michael Ringenburg) 38 Ambiguity CSE341: Programming CSE341: is unambiguous iff every Languages •  Grammar GProgramming Languagesw in L(G ) has a unique...
View Full Document

This document was uploaded on 04/04/2014.

Ask a homework question - tutors are online