Chapter2Section1_F11

Chapter2Section1_F11 - 91.304 Foundations of (Theoretical)...

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

View Full Document Right Arrow Icon
91.304 Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.1: Context-Free Grammars) David Martin m@cs uml edu dm@cs.uml.edu With some modifications by Prof. Karen Daniels, Fall 2011 This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by- 1 sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Chapter 2: CFGs, CFLs, PDAs e introduce our next programming model with a ± We introduce our next programming model with a grammatical formulation: more like REX than DFA ± A context-free grammar (CFG) is a list of permitted substitution rules may be rewritten as S ε S may be rewritten as ε S 0 S 1 ...or as 0 S 1 ± The variables are the substitutable things, written in PPER CASE, sometimes called onterminals UPPER CASE, sometimes called nonterminals ± The terminals are the nonsubstitutable characters ± Each rule has a single variable on the left of and a list of terminals and variables on the right ± The language generated by a CFG is the set of all (terminal) strings that can be found by starting from S and repeatedly substituting until no variables main. 2 remain.
Background image of page 2
Language generated by example ± So in S ε S 1 S 0 S 1 e can generate the strings 01 We can generate the strings ε , 01, 0011, 000111, etc. In other words, the language {0 n 1 n | n 0} -- which is non-regular 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Formal definition is a ontext Free Grammar FG) if ± G is a Context Free Grammar (CFG) if G = (V, Σ , R, S) where 1. V is a finite set of variables
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CS 91.304 taught by Professor Staff during the Fall '11 term at UMass Lowell.

Page1 / 16

Chapter2Section1_F11 - 91.304 Foundations of (Theoretical)...

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

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