l13 - Lecture 13: Context-free Grammars. David Dill...

Info iconThis preview shows pages 1–7. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 13: Context-free Grammars. David Dill Department of Computer Science 1 Outline Context-free grammars Derivations and parse trees ambiguity CF Pumping Lemma 2 Context-Free Languages Regular languages have many wonderful properties, but not all languages are regular. Next, well study a more powerful class of languages, the context-free languages . Context-free languages were identified in the 1950s by linguist Noam Chomsky, as a natural place in a hierarchy of languages, which included the regular languages. 3 Formal Definition of Context-Free Grammars A context-free grammar (CFG) is a 4-tuple ( V,T,P,S ) V is a finite set of non-terminal symbols , T is a finite set of variables (AKA terminal symbols ), P V ( V T ) * is a finite set of productions , and S V is the Sentence symbol V and T must be disjoint sets. Productions are written A aBc . A is the left-hand side (LHS), also called the head , and aBc is the right-hand side (RHS), also called the body. 4 Notation a,b,c, , 1 ,... are terminals A,B,S,... are non-terminals w,x,y,z are terminal strings ( T * ) ,, are strings of terminals and/or non-terminals ( ( V T ) * ). Several productions with common heads can be combined: A a | Aa | bAb 5 Derivations The language of a given CFG, G = ( V,T,P,S ) , can be characterized using the concept of a derivation ....
View Full Document

This note was uploaded on 01/12/2010 for the course CS 154 at Stanford.

Page1 / 16

l13 - Lecture 13: Context-free Grammars. David Dill...

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

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