1 / 11

CS 360 Programming Languages

CS 360 Programming Languages. Introduction Computability Turing Machines. Background. Some programming language Some assembly programming (CS 281) Regular Expressions (CS 270) Finite State Automata (CS 270, ECE 200). Topics. Computability What is a language? Interpreter vs. Compiler

alia
Télécharger la présentation

CS 360 Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 360Programming Languages Introduction Computability Turing Machines

  2. Background • Some programming language • Some assembly programming (CS 281) • Regular Expressions (CS 270) • Finite State Automata (CS 270, ECE 200)

  3. Topics • Computability • What is a language? • Interpreter vs. Compiler • Semantics • Operationally

  4. What is a language? A programming language is a notational system for describing computation in a machine-readable and human-readable form. - Kenneth Louden • So, what do we use them for? • What does it mean to be computable?

  5. Turing Machine • Abstract machine • Consists of: • A tape • A set of symbols • A read/write head • A finite set of instructions • A state register q

  6. Turing Machine • One state is the start state • Instructions are pentuplets: qc, ac → qn, an, d • q is the state • a is the symbol read or written • d is the direction the head moves • The tape is infinite (one- or two-ended)

  7. Turing “programs” • See http://ironphoenix.org/tril/tm/ for a nice simulator from Suzanne Britton Hello World 1,_ 2,H,> 2, _ 3,E,> 3,_ 4,L,> 4,_ 5,L,> 5,_ 6,O,> 6,_ H,!,> Unary Subtraction 1,_ 1,_,> 1,1 1,1,> 1,- 1,-,> 1,= 2,_,< 2,1 3,=,< 2,- H,_,< 3,1 3,1,< 3,- 4,-,< 4,_ 4,_,< 4,1 1,_,> • Now you try: • Unary addition • Copy a string • Reverse a string

  8. Church-Turing Thesis • Alonso Church was also exploring what was computable, using lambda calculus • The Turing Machine can simulate the logic of any computer algorithm • May be less efficient • May use more instructions/memory • But, no less powerful • Anything that is effectively calculable can be decided by a Turing Machine

  9. Turing Complete • The Turing machine is universal • It can be used to implement a Turing Machine • Any language that can be used to simulate a Turing Machine is Turing complete • So, HTML might be a language, but it is not a programming language

  10. Halting Problem • There are problems that are not decidable • It is not possible to write a program that can always determine if a given program (along with some input) would halt • I could sketch a proof here, but I’d be plagarising and there are some nice discussions out there • See http://www.cgl.uwaterloo.ca/~csk/halt/ , from Prof. Kaplan at Waterloo

  11. Busy Beaver • A game • Given n states, write a Turing program that makes a maximum number of marks on the tape, but still halts • Number gets large quickly • Undecidable (for some n) • If we could compute the busy beaver value, we could solve the halting problem

More Related