Ch3-Context-Free Grammars and Languages

Ch3-Context-Free Grammars and Languages - Digital State...

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: Digital State Machines Context Free Grammars & Languages 2/11/12 Veton Kpuska 2 Chapter Outline u Introduction of Context Free Grammars n Context Free Grammars and Context Free Languages n Informal Definition of CFG n Regular Languages revisited n Palindrome u Formal Definition of CFG u CFG and Regular Expressions u Derivations of CFG n Recursive Inference n Left-Most Derivation n Right-Most Derivation u Language of a CFG n Sentential Forms u Parse Trees 2/11/12 Veton Kpuska 3 Context-Free Grammars u The most commonly used mathematical system for modeling constituent structure in English and other natural languages is the Context-Free Grammar , or CFG . u Context free grammars are also called Phrase-Structure Grammars , and the formalism is equivalent to what is also called Backus-Naur Form or BNF . u The idea of basing a grammar on constituent structure dates back to the psychologist Wilhelm Wundt (1900), but was not formalized until Chomsky (1956) and, independently, Backus (1959). Limitations of Regular Languages u Regular Languages are effective in describing certain simple patterns. u Regular Languages are limited in their ability to describe for example Programming Languages. n L ={anbn: n0} is example of a non-regular language. u Assume that n a = (, and n b = ) u (), ((())) are in L, and u ((()) and ()) are not in L. n This simple language is important to describe nested structures in programming languages. u Context Free Grammars and Languages are develop to brige the limitations of regular languages. 2/11/12 Dr. Veton KepuskaDr. Veton Kpuska 4 2/11/12 Veton Kpuska 5 Context-Free Grammars u A context-free grammar consists of n a set of rules or productions , each of which expresses the ways that symbols of the language can be grouped and ordered together, and n a lexicon of words and symbols. Context-Free Languages and Context-Free Grammars u Larger class of languages than regular languages: context-free languages u Context-free languages are described by context-free grammars. n Parser implementation in compilers was simplified from ad-hoc, a time- consuming, development task to a routine job that can be done in an afternoon. n Context-free grammars more recently have been used to describe document formats via the so-called document-type definition (DTD) that is used in the XML. n In English language, the following productions express that a NP (or noun phrase ), can be composed of either a ProperNoun or a determiner ( Det ) followed by a Nominal ; a Nominal can be one or more Noun s....
View Full Document

This note was uploaded on 02/10/2012 for the course ECE 3541 taught by Professor Staff during the Fall '10 term at FIT.

Page1 / 103

Ch3-Context-Free Grammars and Languages - Digital State...

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