Download presentation

1
**CS 3240: Languages and Computation**

Course Overview

2
**Course Staff Instructor: Prof. Alberto Apostolico TA: Akshay Wadia**

Office: KLAUS 1310 Office Hours: Tue. & Thur. at 4-5pm Or by appointment TA: Akshay Wadia Office: KLAUS 2124 Tue. & Thur. at am,

3
Required Textbook Introduction to Automata Theory, Languages, and Computation (3rd Edition) by John E. Hopcroft , Rajeev Motwani , Jeffrey D. Ullman Hardcover Addison Wesley; 3 edition (July 8, 2006) ISBN-10: ISBN-13:

4
Required Textbook Introduction to Automata Theory, Languages, and Computation (3rd Edition) by John E. Hopcroft , Rajeev Motwani , Jeffrey D. Ullman Hardcover Addison Wesley; 3 edition (July 8, 2006) ISBN-10: ISBN-13: This book is complemented by an online resource found at Go to this site, register using the student access code provided with your copy of the book, then login and enter the following class token at the prompt: 71E4F530 PLEASE DO NOT DISTRIBUTE THIS TOKEN OUTSIDE THE CLASS

5
**Course Objectives Formal languages Theory of computation**

Understand definitions of regular and context-free languages and their corresponding “machines” Understand their computational powers and limitations Theory of computation Understand Turing machines Understand decidability Applications Basics Lexical Analysis & Compiler Text searching Finite state device design

6
**Outline Regular expressions, DFAs, NFAs and automata**

Limits on regular expressions, pumping lemma Practical parsing and other applications Context-free languages, grammars, Chomsky Hierarchy Pushdown automata, deterministic vs. non-deterministic Attribute grammars, type inferencing Context-free vs. context-sensitive grammars Turing machines, decidable vs. undecidable problems, reducibility

7
**Grading Homework: 20% Mini-project: 25% Tests: 30% Final: 25%**

Homework will try to exploit Gradiance resource with final version due in class No late homework or assignments without prior approval of instructor Homework should be concise, complete, and precise Tests will be in class. Closed book, closed notes, but one-page cheat-sheet allowed.

8
Collaboration Policy Students must write solutions to assignments completely independently General discussions are allowed on assignments among students, but names of collaborators must be reported

9
**Resources Check often for announcements and schedule changes.**

Class webpage GRADIANCE webpage Check often for announcements and schedule changes.

10
**Introduction & Motivation**

11
**Automata & Formal Languages**

Turing Machines Automata & Grammars Compilers Text & Web applications

12
**Compilers What is a compiler? Why compilers?**

A program that translates an executable program from source language into target language Usually source language is high-level language, and target language is object (or machine) code Related to interpreters Why compilers? Programming in machine (or assembly) language is tedious, error prone, and machine dependent Historical note: In 1954, IBM started developing FORTRAN (FORmula TRANslation) language and its compiler

13
**How Does Compiler Work? Scanner Start Parser**

Request Token Get Token Start Parser Front End: Analysis of program syntax and semantics Semantic Action Semantic Error Checking Intermediate Representation

14
**Parts of Compilers Focus of this class. 1. Lexical Analysis Front End**

2. Syntax Analysis 3. Semantic Analysis Synthesis Back End 4. Code Generation 5. Optimization

15
Basic Concepts Computational problems can be posed ultimately as decision (yes-no) problems Yes-No problems can be posed ultimately as language recognition problems A language is any set of strings over some alphabet Deciding a language means being able to discriminate the strings belonging to it against all others There are two basic ways to ‘’decide’’ a language: Automata & Grammars An Automaton discriminates whether a given input string is in the language or not A Grammar generates all and only the strings in the language There is a subtle correspondence between an automaton and a corresponding grammar Some languages are easy to decide, some are harder, some are ‘’impossible’’ We can build a hierarchy of automata , and a corresponding one of grammars based on the complexity of the languages we wish to decide

16
Limits of Computation Three easy functions defined on the decimal development of Greek Pi p … The ratio of the circumference to the diagonal of the unit circle f(n) = 1, if 4 appears before the nth decimal digit of p f(n) = 0 otherwise g(n) = 1, if 4 appears as the nth decimal digit of p g(n) = 0 otherwise h(n) = 1, if 4 appears after the nth decimal digit of p h(n) = 0 otherwise Do we have an algorithm for f? for g? for h?

17
**Computable, Undecidable, Untractable**

Questions of decidability revolve around whether there is an algorithm to solve a certain problem Questions of untractability revolve around whether there is a practically viable algorithm to solve a certain problem Most of the algorithms we design and use are have low computational complexity

18
**Proofs Deductive proofs Inductive proofs If-and-only-if proofs**

Proofs by contradiction Proofs by counterexample Etc.

19
Deductive Proofs A chain of statements implying each the next one, leading from the first one (hypothesis) to the last (thesis or conclusion) For integer x = 4 or higher 2x is not smaller than x2 Try for few values of parameter x, e.g., x=4 or x=6 What happens to the left side and right side when x becomes larger than 4? Left side doubles with unit increase, right side grows by not more than [(x+1)/x]2 , which is for x=4 Exercise 1: generalize to non-integers Exercise 2: give an inductive proof (see next)

20
Inductive Proofs Prove a basis statement and an inductive step providing a propagation rule Let S(n) be a statement about integer n Basis: prove S(i) for some fixed value i Inductive step: prove that for any m > i – 1, S(m) implies S(m+1)

21
Inductive Proofs Prove a basis statement and an inductive step providing a propagation rule Let S(n) be a statement about integer n Basis: prove S(i) for some fixed value i Inductive step: prove for m > i-1 S(m) implies S(m+1) E.g.1, prove that for any positive n the sum of the first n integers equals n(n+1)/2 (btw did you know how Pitagoras did it?) E.g. 2 Let a binary tree be defined as ‘a single node or a node with having two trees as its children . Prove that any binary tree with n leaves (nodes without children) has precisely n-1 internal nodes (nodes with children)

22
**The structure of Inductive Proofs**

Prove the basis statement : check the validity of the claim for initial values of the parameter Prove inductive step : assume statement is true for all values of the parameter up to n-1 providing a propagation rule Take instance associated with value n Decompose this instance into instances involving smaller values of the parameter Force inductive hypothesis on these instances Re-assemble the instance for value n Strange things happen when we are not careful E.g.: for any positive n, all horses in a group of n have the same mantel

23
**Additional Proofs Proofs by contradiction**

Assume the opposite of hypothesis, show thesis cannot follow Proofs by counterexample All primes are odd – Exhibit the even prime 2 (are there also proofs ‘’by example’’?) If-then-else proofs

24
**Automata Finite Automata model many design and analysis tasks, e.g.**

Lexical analyzer in a compiler Digital cicuit design Keywork searching in texts or on the web. Software for verifying finite state systems, such as communication protocols. Etc.

Similar presentations

OK

CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.

CPSC 388 – Compiler Design and Construction Lecture: MWF 11:00am-12:20pm, Room 106 Colton.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on magnets and springs Ppt on channels of distribution diagram Ppt on types of distribution channels Ppt on linux file system Ppt on organic farming in hindi Ppt on indian politics latest Ppt on main idea Ppt on barack obama leadership Ppt on hydrogen fuel cell vehicles bmw Chemistry ppt on hydrogen