This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Digital State Machines Context Free Grammars & Languages 2/11/12 Veton Këpuska 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 LeftMost Derivation n RightMost Derivation u Language of a CFG n Sentential Forms u Parse Trees 2/11/12 Veton Këpuska 3 ContextFree Grammars u The most commonly used mathematical system for modeling constituent structure in English and other natural languages is the ContextFree Grammar , or CFG . u Context free grammars are also called PhraseStructure Grammars , and the formalism is equivalent to what is also called BackusNaur 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 nonregular 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 Këpuska 4 2/11/12 Veton Këpuska 5 ContextFree Grammars u A contextfree 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. ContextFree Languages and ContextFree Grammars u Larger class of languages than regular languages: “contextfree languages” u Contextfree languages are described by “contextfree grammars”. n Parser implementation in compilers was simplified from adhoc, a time consuming, development task to a routine job that can be done in an afternoon. n Contextfree grammars more recently have been used to describe document formats via the socalled documenttype 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
 Fall '10
 Staff
 Formal language, Formal languages, Formal grammar, Contextfree grammar, Veton Këpuska

Click to edit the document details