Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lecture 8: Context-Free Languages and Grammars - Prof. David Evans, Study notes of Discrete Mathematics

A transcript of lecture 8 from the theory of computation course at the university of virginia, computer science department. The lecture covers context-free languages and grammars, including deterministic and nondeterministic machine models, finite states automata, pushdown automata, and turing machines. The lecture also discusses the origins of these models and their relationship to human intellect.

Typology: Study notes

Pre 2010

Uploaded on 03/19/2009

koofers-user-5ns
koofers-user-5ns 🇺🇸

10 documents

1 / 6

Toggle sidebar

Partial preview of the text

Download Lecture 8: Context-Free Languages and Grammars - Prof. David Evans and more Study notes Discrete Mathematics in PDF only on Docsity! 1 David Evans http://www.cs.virginia.edu/evans cs302: Theory of Computation University of Virginia Computer Science Lecture 8: Context-Free Languages 2Lecture 8: Language Menu • Review Machine Models of Computing • Linguistic Model of Computing • Challenge Problem Near-Solution - Liuyi (Eric) Zhang • Context-Free Grammars 3Lecture 8: Language Deterministic Machine Models 010110101101010101 “Yes” or “No” Memory Machine Languages Finite States DFA Regular + Stack DPDA [this week] + Tape TM [later] 4Lecture 8: Language 010110101101010101 “Yes” or “No” Nondeterministic Machine Models Memory Machine Languages Finite States NFA Regular + Stack NDPDA [this week] + Tape NDTM [later] 5Lecture 8: Language Where did these models come from? 6Lecture 8: Language Modeling Human Intellect • Turing Machine (Alan Turing, 1936) – Modeling Human Computers • DFAs – McCulloch and Pitts, “A logical calculus of the ideas immanent in nervous activity”, 1943 – S. C. Kleene, Representation of Events in Nerve Nets and Finite Automata, 1956 – Claude Shannon and John McCarthy, Automata Studies, 1956 2 7Lecture 8: Language Out theoretical objective is not dependent on the assumptions fitting exactly. It is a familiar strategem of science, when faced with a body of data too complex to be mastered as a whole, to select some limited domain of experiences, some simple situations, and to undertake to construct a model to fit these at least approximately. Having set up such a model, the next step is to seek a thorough understanding of the model itself. S. C. Kleene, Representation of Events in Nerve Nets and Finite Automata, 1956 8Lecture 8: Language Language-Based Models of Computation 9Lecture 8: Language Noam Chomsky (born 1928), MIT Linguistics Professor and Leftist Political Activist 10Lecture 8: Language Hugo Chávez at the United Nations (20 Sept 2006) 11Lecture 8: Language I don’t know anybody who’s ever read a Chomsky book, He does not write page turners, he writes page stoppers. There are a lot of bent pages in Noam Chomsky’s books, and they are usually at about Page 16. Alan Dershowitz 12Lecture 8: Language “I must admit to taking a copy of Noam Chomsky’s Syntactic Structures along with me on my honeymoon in 1961. During odd moments, while crossing the Atlantic in an ocean liner and while camping in Europe, I read that book rather thoroughly and tried to answer some basic theoretical questions. Here was a marvelous thing: a mathematical theory of language in which I could use a computer programmer’s intuition! The mathematical, linguistic, and algorithmic parts of my life had previously been totally separate. During the ensuing years those three aspects became steadily more intertwined; and by the end of the 1960s I found myself a Professor of Computer Science at Stanford University, primarily because of work that I had done with respect to languages for computer programming.” Donald Knuth 5 25Lecture 8: Language Continue • Sort till the last bit • Bottom-up 26Lecture 8: Language Memory 27Lecture 8: Language Compare • Heap Sort –Requires ~ n log2 n comparisons –4 bytes to store integer • Bit Sort: –Requires ~ 32n comparisons –Memory to store (up to 33) memory addresses that separate the 1s and 0s 28Lecture 8: Language Challenge Recap 29Lecture 8: Language Language Classes Finite Described by a finite set, DFA with no cycles, Regular grammar with no recursion Regular Described by a DFA, NFA, Regular grammar Context-Free Described by a NDPDA, Context-Free Grammar 30Lecture 8: Language Context-Free Grammar A → αγβ One variable Any sequence of variables and terminals Why is it called “Context-Free”? 6 31Lecture 8: Language Example 1 S → 0S0 S → 1S1 S → ε 32Lecture 8: Language Example 2 Define a CFG that generates the language: { w | w ∈ {0, 1}* and w has an equal number of 0s and 1s } 33Lecture 8: Language Review Questions • How do you prove a grammar is context-free? • How do you prove a grammar is not context-free? • How do you prove a language is context-free? • How do you prove a language is not context-free? 34Lecture 8: Language Charge • Return PS2 and PS2 Comments now • PS3 is posted on the course site (Due in 1 week, Feb 19) • Thursday: –Equivalence of NDPDAs and CFGs (sketch) –Non-Context-Free Languages
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved