David Evans CS150: Computer Science University of Virginia Computer Science Lecture 2: Formal Systems and Languages MU!

Slides:



Advertisements
Similar presentations
Class 3: Rules of Evaluation David Evans cs1120 Fall 2009.
Advertisements

ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
How to find and remove unproductive rules in a grammar Roger L. Costello May 1, 2014 New! How to find and remove unreachable rules in a grammar.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 39: Lambda Calculus.
Introduction to phrases & clauses
Chapter Chapter Summary Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output Language Recognition Turing.
Lecture 8 Recursively enumerable (r.e.) languages
CS 330 Programming Languages 09 / 13 / 2007 Instructor: Michael Eckmann.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
A basis for computer theory and A means of specifying languages
Slide 1 Chapter 2-b Syntax, Semantics. Slide 2 Syntax, Semantics - Definition The syntax of a programming language is the form of its expressions, statements.
II–2 DC Circuits I Theory & Examples.
CSC 160 Computer Programming for Non-Majors Introduction Prof. Adam M. Wittenstein
Normal forms for Context-Free Grammars
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
30-Jun-15 BNF. Metalanguages A metalanguage is a language used to talk about a language (usually a different one) We can use English as its own metalanguage.
Describing Syntax and Semantics
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 2: Formal Systems and Languages MU!
David Evans CS200: Computer Science University of Virginia Computer Science Class 31: Universal Turing Machines.
Context Free Grammars Reading: Chap 12-13, Jurafsky & Martin This slide set was adapted from J. Martin, U. Colorado Instructor: Paul Tarau, based on Rada.
REPORTED SPEECH Unit 11 – English 12 Instructor: Nguyễn Ngọc Vũ
Chpater 3. Outline The definition of Syntax The Definition of Semantic Most Common Methods of Describing Syntax.
计算机科学概述 Introduction to Computer Science 陆嘉恒 中国人民大学 信息学院
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 2: Orders of Growth
Representations Floyd Nelson A.D 2009 December 28.
Winter 2007SEG2101 Chapter 71 Chapter 7 Introduction to Languages and Compiler.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
CSE 143 Lecture 11 Maps Grammars slides created by Alyssa Harding
Languages, Grammars, and Regular Expressions Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 18: Think Globally, Mutate Locally.
Copyright © Curt Hill Languages and Grammars This is not English Class. But there is a resemblance.
Lecture 8: The Meaning of Life, Searching for Truth and The Stuff Primitives are Made Of (and a smattering of Quantum Physics) David Evans
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 3: Rules of Evaluation.
Game Maker – Getting Started What is Game Maker?.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 16: Universality and Undecidability.
Lecture 2: Formal Systems and Languages MU! CS150: Computer Science
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 19: Environments.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 15: Intractable Problems (Smiley.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
CSC312 Automata Theory Lecture # 26 Chapter # 12 by Cohen Context Free Grammars.
David Evans Class 15: P vs. NP (Smiley Puzzles and Curing Cancer) CS150: Computer Science University of Virginia Computer.
Lecture 17 Undecidability Topics:  TM variations  Undecidability June 25, 2015 CSCE 355 Foundations of Computation.
Thursday, September 16, Announcements Movie night, Friday September 25, at 6:00 pm. Bring your family and friends. There will be vocabulary review.
Types and Programming Languages Lecture 3 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Lecture 3: Rules of Evaluation CS150: Computer Science
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
7.2 Programming Languages - An Introduction to Informatics WMN Lab. Hye-Jin Lee.
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 2: Formal Systems and Languages MU!
Cs3102: Theory of Computation (aka cs302: Discrete Mathematics II) Spring 2010 University of Virginia David Evans.
Active vs. Passive Voice. Active versus Passive Voice Many people are confused by whether they are using the active or passive voice when writing, and.
(Thunking about Thunks)
Lecture 6: Lambda Calculus
Lecture 2: Schreme David Evans
Lecture 4: Evaluation Rules Recursion CS200: Computer Science
Class 27: Universal Turing Machines CS150: Computer Science
Lambda Calculus Revisited
Class 19: Think Globally, Mutate Locally CS150: Computer Science
Lecture 2: Formal Systems and Languages MU! CS200: Computer Science
What did I google to find this picture?
Lecture 25: Metalinguistics > (meval '((lambda (x) (* x x)) 4)
Lecture 24: Metalinguistics CS200: Computer Science
slides created by Alyssa Harding
Class 31: Universal Turing Machines CS200: Computer Science
Lecture 3: Rules of Evaluation CS200: Computer Science
Discrete Maths 13. Grammars Objectives
Lecture 23: Computability CS200: Computer Science
Presentation transcript:

David Evans CS150: Computer Science University of Virginia Computer Science Lecture 2: Formal Systems and Languages MU!

2 Lecture 2: Language Menu Nuclear Weapons Questions from Lecture 1 Notes Survey Summary Formal Systems –MIU-system Languages –English –Scheme

3 Lecture 2: Language Megabytes vs. Megatons Computing: 30,000,000 times increase in power since 1969 Nuclear weapons?

4 Lecture 2: Language Tsar Bomba 50 Megaton explosion, island in Arctic Sea, 1961

5 Lecture 2: Language If Nuclear Weapons followed Moore’s Law... 30M * 50 Megatons = 1.5 Teratons 1 Megaton TNT = * Joules 1.5 Teratons TNT = 6.3 * Joules Energy from Sun to Earth = 4 x Joules/ Year One bomb today ~ all the energy to reach the Earth from the Sun since 400 AD

6 Lecture 2: Language Actual Nuclear Weapons Hiroshima (12kt), Nagasaki (20kt) First H-Bomb (10Mt) Tsar Bomba (largest ever) B83 (1.2Mt), largest in currently active arsenal

7 Lecture 2: Language If it takes 60 seconds to compute a photomosaic for Problem Set 1 today on a typical PC, estimate how long it will take CS150 students in 2010 to compute the same photomosaic? How long will it take in 2013? > (/ (* ( ) 12) 18) 2 > (/ 60 (* 2 2)) 15 > (/ (* ( ) 12) 18) 4 > (/ 60 (* )) 15/4 > (exact->inexact (/ 60 (* ))) 3.75 Difference in years * 12 = number of months Number of months / 18 = number of doublings according to Moore’s Law 60 seconds today, 2 doublings by seconds in seconds today, 4 doublings by seconds in 2013 Reality check: Moore’s “law” is just an “observation”. We’ll see one reason later today why it won’t continue forever.

8 Lecture 2: Language Are there any non-recursive natural languages? What would happen to a society that spoke one? Not for humans at least. They would run out of original things to say. Chimps and Dolphins are able to learn non- recursive “languages” (some linguists argue they are not really “languages”), but only humans can learn recursive languages.

9 Lecture 2: Language Running out of Ideas “Its all been said before.” Eventually true for a non-recursive language. Never true for a recursive language. There is always something original left to say!

10 Lecture 2: Language Post Production Systems

11 Lecture 2: Language Production Systems Set of symbols –Primitives Set of rules for manipulating symbols –Hofstadter: Rules of Production, Rules of Inference –Also: Rules of Combination

12 Lecture 2: Language The MIU System Symbols: M, I, U Rules of Production: –Rule I: If you have a string ending in I, you can add a U at the end. –Rule II: Suppose you have M x. Then you may add M xx to your collection. –Rule III: If III occurs in one of the strings in your collection you may make a new string with U in place of III. –Rule IV: If UU occurs inside one of your strings, you can drop it.

13 Lecture 2: Language MIU System Example Start with MUI, produce MIU Rules of Production: Rule I: If you have a string ending in I, you can add a U at the end. Rule II: Suppose you have M x. Then you may add M xx to your collection. Rule III: If III occurs in one of the strings in your collection you may make a new string with U in place of III. Rule IV: If UU occurs inside one of your strings, you can drop it.

14 Lecture 2: Language Survey Summary 53 Responses –63 are registered Problem Set Partners –If you selected “Yes” for the question about wanting to be assigned a partner for PS1, you should have received an from me telling you who your partner is –For PS2 everyone will be assigned a partner –For others, some you will choose, others you may be assigned

15 Lecture 2: Language Very Diverse Class Years: 12 First, 15 Second, 18 Third, 7 Fourth+ Majors: –19 Computer Science –11 Undecided –7 Cognitive Science –3 Economics, Math –2 Psychology –1 Anthropology, Architecture, Commerce, Foreign Affairs, Media Studies, Music, Philosophy, Systems Engineering

16 Lecture 2: Language Survey Responses Continued Previous programming: 19 None, 32 Some Food: 28 Bodos, 11 Krispy Kreme, 10 pizza, 1 Korean Food, 1 Outback, 1 Paccino’s, 1 Arch’s, 1 Dunkin Donuts Topic: 18 Google Maps, 16 Facebook, 5 Second Life, 5 Java See course website (by Monday) for my responses to questions and survey summary

17 Lecture 2: Language Languages

18 Lecture 2: Language What is a language? Webster: A systematic means of communicating ideas or feelings by the use of conventionalized signs, sounds, gestures, or marks having understood meanings.

19 Lecture 2: Language Linguist’s Definition A description of pairs (S, M), where S stands for sound, or any kind of surface forms, and M stands for meaning. A theory of language must specify the properties of S and M, and how they are related. (Charles Yang)

20 Lecture 2: Language Languages and Formal Systems What is the difference between a formal system and a language? With a language, the surface forms have meaning. Caveat: computer scientists often use language to mean just a set of surface forms.

21 Lecture 2: Language What are languages made of? Primitives (almost all languages have these) –The simplest surface forms with meaning Means of Combination (all languages have these) –Like Rules of Production for Formal Systems –Ways to make new surface forms from ones you already have Means of Abstraction (all powerful languages have these) –Ways to use simple surface forms to represent complicated ones

22 Lecture 2: Language Does English have these? Primitives –Words (?) e.g., “antifloccipoccinihilipilification” – not a primitive –Morphemes – smallest units of meaning e.g., anti- (“opposite”) Means of combination –e.g., Sentence ::= Subject Verb Object –Precise rules, but not the ones you learned in grammar school Ending a sentence with a preposition is something up with which we will not put. Winston Churchill

23 Lecture 2: Language Does English have these? Means of abstraction –Pronouns: she, he, it, they, which, etc. –Confusing since they don’t always mean the same thing, it depends on where they are used. The “these” in the slide title is an abstraction for the three elements of language introduced 2 slides ago. The “they” in the confusing sentence is an abstraction for pronouns.

24 Lecture 2: Language How should we describe languages?

25 Lecture 2: Language Backus Naur Form symbol ::= replacement We can replace symbol with replacement nonterminal – symbol that appears on left side of rule terminals – symbol that never appears on the left side of a rule A ::= B means anywhere you have an A, you can replace it with a B.

26 Lecture 2: Language BNF Example Sentence ::= NP Verb NP ::= Noun Noun ::= Dave Noun ::= Scheme Verb ::= rocks Verb ::= sucks How many different things can we express with this language? What are the terminals? Dave, Scheme, rocks, sucks 4, but only 2 are true.

27 Lecture 2: Language BNF Example Sentence ::= NP Verb NP ::= Noun NP ::= Noun and NP Noun ::= Dave Noun ::= Scheme Verb ::= rocks Verb ::= sucks How many different things can we express with this language? Infinitely many! Recursion is powerful.

28 Lecture 2: Language Most Essential Scheme Expr ::= PrimitiveExpr PrimitiveExpr ::= Number PrimitiveExpr ::= + | * | <= |... Expr ::= Name Expr ::= ApplicationExpr ApplicationExpr ::= (Expr MoreExprs) MoreExprs ::= MoreExprs ::= Expr MoreExprs This is enough for everything you need to write for PS1

29 Lecture 2: Language Charge Problem Set 1: due Monday Lab Hours: posted on website –Now and Sunday 4-5:30, 8-9:30 –Take advantage of them! –If you can, follow us to lab now