labs explained
play

Labs Explained Wed Noon-1pm, Rice 423 Weimer Office Hours Any - PDF document

Labs Explained Wed Noon-1pm, Rice 423 Weimer Office Hours Any questions on the course material or problem sets, but also grade change requests, etc. Wed 1pm-4pm, OLS 001 Main Lab Hours Sun 1pm-6pm, OLS 001 Main Lab Hours


  1. Labs Explained • Wed Noon-1pm, Rice 423 Weimer Office Hours – Any questions on the course material or problem sets, but also grade change requests, etc. • Wed 1pm-4pm, OLS 001 – Main Lab Hours • Sun 1pm-6pm, OLS 001 – Main Lab Hours – You “must” be able to attend one of these two • Others – In Thornton Stacks or OLS 001 or similar: based on your availability ... #2 One Key To Happiness: Optional Textbooks Setting Expectations • “The Course Book” • I want to be more competent at computers, and I also hope to gain some skills that I can use in a – Uses “Scheme” as early language of instruction; competitive job market. we use “Python” • if i put in the work will you honestly help me in this • Udacity class and not blow me off because i dont understand – Uses “Python”, you watch videos and complete something. quizzes • I expect to learn the basics of computer science and • GEB – EGB whether or not I really want to major in it. – Does not describe any particular programming • I will never know the answer to a trivia question. language. It's more of a novel. #3 #4 Outline What is a language? • Languages and Formal Systems Webster: • BNF Grammars • Describing Languages A systematic means of • Learning New Languages communicating ideas or feelings • Evaluation Rules by the use of conventionalized signs, sounds, gestures, or marks having understood meanings. #5 #6

  2. What is a language? Linguist’s Definition (Charles Yang) Webster: A language is: A description of pairs ( S , M ), A systematic means of where S stands for sound, or any communicating ideas or feelings kind of surface forms, and M by the use of conventionalized stands for meaning. signs, sounds, gestures, or marks A theory of language must having understood meanings. specify the properties of S and M , and how they are related. #7 #8 What are languages made of? Languages and Formal Systems • Primitives (almost all languages have these) What is the difference between a – The simplest surface forms with meaning formal system and a language? • Means of Combination ( all languages have these) – Like Rules of Production for Formal Systems – Ways to make new surface forms from ones you With a language, the surface already have forms have meaning . • Means of Abstraction (all powerful languages have these) – Ways to use simple surface forms to represent complicated ones Caveat: computer scientists often use language to mean just a set of surface forms. #9 #10 Does English have these? Does English have these? • Primitives • Primitives – Words (?) – Words (?) • e.g., “antifloccipoccinihilipilification” – not a • Means of combination 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 #11 #12

  3. 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. #13 BNF Example Backus Naur Form Sentence ::= NP Verb symbol ::= replacement We can replace symbol with NP ::= Noun What are the replacement terminals ? Noun ::= Wes A ::= B means anywhere you have an Noun ::= Python How many A , you can replace it with a B . different things Verb ::= rocks can we express Verb ::= sucks nonterminal – symbol that appears on with this left side of rule language? terminal s – symbol that never appears on the left side of a rule #15 #16 BNF Example BNF Example Sentence ::= NP Verb Sentence ::= NP Verb NP ::= Noun NP ::= Noun What are the Noun ::= Wes terminals ? NP ::= Noun and NP How many Wes , Python , rocks , sucks different things Noun ::= Python Noun ::= Wes How many can we express different things Verb ::= rocks Noun ::= Python with this can we express language? Verb ::= sucks Verb ::= rocks with this Verb ::= sucks language? 4, but only 2 are true. #17 #18

  4. BNF Example Liberal Arts Trivia: Art History Sentence ::= NP Verb • Q. Name the type of painting in which NP ::= Noun pigment is mixed with water on a thin layer of mortar or plaster. Because of the chemical NP ::= Noun and NP How many makeup of the plaster, a binder is not different things Noun ::= Wes required, as the pigment mixed solely with can we express Noun ::= Python the water will sink into the intonaco, which with this itself becomes the medium holding the language? Verb ::= rocks pigment. The technique was popular during Verb ::= sucks Infinitely many! the European Renaissance. Recursion is powerful. #19 #20 Most Essential Python Liberal Arts Trivia: Music Statement ::= function ( CommaExprs ) Statement ::= if Expr : • Q. This Hong Kong singer is one of the original four cantopop Heavenly Kings ( 四大天王 ), and Statements possesses a rich baritone/tenor. He is else: sometimes called the God of Songs ( 歌神 ). His Statements most famous work is perhaps Goodbye Kiss Statement ::= return Expr ( 吻别 ) – one of the best-selling albums of all Statement ::= variable = Expr time, with over 3 million copies sold in 1993 Expr ::= Number | variable | String alone. Give the English or Romanized name of Expr ::= Expr BinOp Expr this singer. BinOp ::= + | * | == | <= | ... #21 #22 Trickier Python CommaExprs ::= Expr CommaExprs ::= Expr , CommaExprs Start Reading Here Statements ::= Statement Statements ::= Statement Statements Expr ::= [ CommaExprs ] Statement ::= def function ( CommaExprs ): Statements Statement: ::= for variable in Expr : Statements #23 #24

  5. ENIAC : Electronic Numerical Integrator and Computer • Early WWII computer – But not the world’s first (PS4) Rules of • Built to calculate Evaluation bombing tables & Memory size: twenty 10 decimal digit accumulators = 664 bits People ENIAC (1946): 3 mm Apollo Guidance Computer (1969): 1 inch You: 2.2 miles #26 Directions for Getting 6 1. Choose any regular accumulator (ie. Accumulator #9). 2. Direct the Initiating Pulse to terminal 5i . 3. The initiating pulse is produced by the initiating unit's Io terminal each time the Eniac is started. This terminal is usually, by default, plugged into Program Line 1-1 (described later). Simply connect a program cable from Program Line 1-1 to terminal 5i on this Accumulator. 4. Set the Repeat Switch for Program Control 5 to 6. 5. Set the Operation Switch for Program Control 5 to ADD . 6. Set the Clear-Correct switch to C. 7. Turn on and clear the Eniac. 8. Normally, when the Eniac is first started, a clearing process is begun. If the Eniac had been previously started, or if there are random neons illuminated in the accumulators, the ``Initial Clear'' button of the Initiating device can be pressed. 9. Press the ``Initiating Pulse Switch'' that is located on the Initiating device. 10.Stand back. #27 Code written by humans Compiler translates from code in a high- Compiler level language to machine code Code machine can run DrScheme uses an interpreter . An interpreter is like a compiler, except it runs quickly and quietly on small bits of code at a time. #30

  6. John Backus IBM 704 Fortran manual, 1956 • Chemistry major at UVA (entered 1943) • Flunked out after second semester • Joined IBM as programmer in 1950 • Developed Fortran, first commercially successful programming language and compiler #31 #32 Describing Languages Recall: Backus Naur Form • Fortran language was described using English symbol ::= replacement – Imprecise We can replace symbol with – Verbose, lots to read replacement – Ad hoc A ::= B means anywhere you have an DO 10 I=1.10 A , you can replace it with a B . Assigns 1.10 to the variable DO10I DO 10 I=1,10 Loops for I = 1 to 10 (Often incorrectly blamed for loss of Mariner-I) nonterminal – symbol that appears on • Wanted a more precise way of describing a left side of rule language terminal s – symbol that never appears on the left side of a rule #33 #34 Pages in Revised 5 Language Elements Report on the Algorithmic Language When learning a foreign language, which Scheme elements are hardest to learn? • Primitives: lots of them, and hard to learn real meaning • Means of Combination Primitives – Complex, but, all natural languages have similar ones [Chomsky] SOV (45% of all languages) Sentence ::= Subject Object Verb (Korean) Means of SVO (42%) Sentence ::= Subject Verb Object Combination VSO (9%) Sentence ::= Verb Subject Object (Welsh) “Lladdodd y ddraig y dyn.” Means of (Killed the dragon the man.) Abstraction OSV (<1%): Tobati (New Guinea) Schemish: Expression ::= ( Verb Object ) 48 pages • Means of Abstraction: few of these, but tricky to learn differences total (includes across languages formal English: I, we specification Tok Pisin (Papua New Guinea): mi (I), mitupela (he/she and I), and mitripela (both of them and I), mipela (all of them and I), yumitupela examples) (you and I), yumitripela (both of you and I), yumipela (all of you and I) #35 #36

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend