Programming Languages John Mitchell CS 242 Course web site:

Slides:



Advertisements
Similar presentations
8/25/2009 Sofya Raskhodnikova Intro to Theory of Computation L ECTURE 1 Theory of Computation Course information Overview of the area Finite Automata Sofya.
Advertisements

Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
CS150 Introduction to Computer Science 1 Professor: Chadd Williams.
Welcome to Introduction to Java Programming At J.D.O’Bryant Science & Mathematics Chonho Lee Department of Computer Science University of Massachusetts.
June 13, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
COMS W1004 Introduction to Computer Science June 25, 2008.
1 CS1001 Lecture Overview Java Programming Java Programming Midterm Review Midterm Review.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Computability (Chapter 2) ICS 535 Design and Implementation.
CS 101 Course Summary December 5, Big Ideas Abstraction Problem solving Fundamentals of programming.
January 12, Compiler Design Hongwei Xi Comp. Sci. Dept. Boston University.
CS 330 Programming Languages 09 / 06 / 2007 Instructor: Michael Eckmann.
CSC 171 – FALL 2004 COMPUTER PROGRAMMING LECTURE 0 ADMINISTRATION.
Type Systems and Object- Oriented Programming John C. Mitchell Stanford University.
1 CS150 Introduction to Computer Science 1 Professor: Chadd Williams
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
July 16, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
Slide 1 Vitaly Shmatikov CS 345 Programming Paradigms.
ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
CS 415: Programming Languages Course Introduction Aaron Bloomfield Fall 2005.
Introduction to Programming (in C++) Introduction Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
COP4020/CGS5426 Programming languages Syllabus. Instructor Xin Yuan Office: 168 LOV Office hours: T, H 10:00am – 11:30am Class website:
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
Foundations of Programming Languages – Course Overview Xinyu Feng Acknowledgments: some slides taken or adapted from lecture notes of Stanford CS242
314450: PROGRAMMING PARADIGMS Teaching scheme: Examination Scheme: Lectures: 3 Hours/Week Theory: 100 Marks OBJECTIVE: To understand the basic building.
CS 2104 Prog. Lang. Concepts Dr. Abhik Roychoudhury School of Computing Introduction.
Programming Languages and Design Lecture 1 Introduction to Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern University,
Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)
COMP Introduction to Programming Yi Hong May 13, 2015.
CS 103 Discrete Structures Lecture 01 Introduction to the Course
EECE 310 Software Engineering Lecture 0: Course Orientation.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Lecture 1: Introduction CS 6903: Modern Cryptography Spring 2009 Nitesh Saxena Polytechnic Institute of NYU.
CS 330 Programming Languages 09 / 04 / 2008 Instructor: Michael Eckmann.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Programming Languages
1 Overview CO3225 Programming Language: Theory and Practice Low Aim is a Crime, but not high ambition.
CS 390 Introduction to Theoretical Computer Science.
1 CSC 533: Organization of Programming Languages Spring 2010 See online syllabus at: Course goals:  understand issues in designing,
1 Programming Languages Marjan Sirjani Course web site:
CS3518 Languages and Computability Kees van Deemter Lectures Monday14:00New King’s 14 Tuesday11:00KC T2 Tutorials/Practicals Tuesday13:00-15:00.
CNS 4450 Syllabus. Context Language is a tool of thought. We rarely think without words. In solving problems by computer, we eventually get to the point.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
CS 140 Computer Programming (I) Second semester (3 credits) Imam Mohammad bin Saud Islamic University College of Computer Science and Information.
INF 212 ANALYSIS OF PROG. LANGS LECTURE 1 Instructors: Crista Lopes Copyright © Instructors.
Introduction to computers and programming Instructor: Alex Iskold.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
Programming Languages John Mitchell CS 242 Course web site:
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
CSCD 330 Network Programming Winter 2015 Lecture 1 - Course Details.
Computable Functions John Mitchell CS 242 Reading: Chapter 2.
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
Programming Languages John Mitchell CS 242 Course web site:
Programming Language History and Evolution
CS16: Introduction to Algorithms and Data Structures
Programming Languages
INF 212 Analysis of Prog. Langs Final Lecture
Programming Language Design Concepts
Programming Language History and Evolution
Foundations of Programming Languages – Course Overview
Programming Languages
Foundations of Programming Languages – Course Overview
Introduction to CS II Data Structures
Organization of Programming Languages
CSE 341 Programming Languages Autumn 2001
CSE 341 Programming Languages Autumn 2003
CSE 341 Programming Languages Autumn 2002
CSE 341 Programming Languages Spring 2003
CSE 341 Programming Languages Autumn 2003
Programming Languages
Presentation transcript:

Programming Languages John Mitchell CS 242 Course web site:

All about me … John C. Mitchell Professor of Computer Science Research Interests: Computer security: access control, cryptographic protocols and mobile code security. Programming languages, type systems, object systems, and formal methods. Applications of logic to CS. B.S. Stanford University; M.S., Ph.D. MIT. uHow I spend my time Working with graduate students Writing papers, going to conferences, giving talks Departmental committees (hiring, curriculum, …) Teaching classes Conferences, journals, consulting, companies, …

Goals uProgramming Language Culture A language is a “conceptual universe” (Perlis) –Learn what is important about various languages –Understand the ideas and programming methods Understand the languages you use (C, C++, Java) by comparison with other languages Appreciate history, diversity of ideas in programming Be prepared for new problem-solving paradigms uCritical thought Properties of language, not documentation uLanguage and implementation Every convenience has its cost –Recognize the cost of presenting an abstract view of machine –Understand trade-offs in programming language design

Transference of Lang. Concepts uParable I started programming in 1970’s –Dominant language was Fortran; no recursive functions My algorithms and data structure instructor said: –Recursion is a good idea even though inefficient –You can use idea in Fortran by storing stack in array Today: recursive functions everywhere uMoral World changes; useful to understand many ideas uMore current example: function passing Pass functions in C by building your own closures, as in STL “function objects”

Alternate Course Organizations uLanguage-based organization Algol 60, Algol 68, Pascal Modula, Clu, Ada Additional languages grouped by paradigm –Lisp/Scheme/ML for functional languages –Prolog and Logic Programming –C++, Smalltalk and OOP –Concurrency via Ada rendez-vous My opinion: Algol/Pascal/Modula superseded by ML Lisp/Scheme ideas also in ML OOP deserves greater emphasis For comparison, see Sethi’s book...

Alternate Course II uConcept-based organization Use single language like Lisp/Scheme Present PL concepts by showing how to define them uAdvantages: uniform syntax, easy to compare features uDisadvantages Miss a lot of the culture associated with languages Some features hard to add –Type systems –Program-structuring mechanisms –Works best for “local” features, not global structure Examples: Abelson/Sussman, Friedman et al.

Organization of this course uProgramming in the small Cover traditional Algol, Pascal constructs in ML –Block structure, activation records –Types and type systems,... Lisp/Scheme concepts in ML too –higher-order functions and closures, tail recursion –exceptions, continuations uProgramming in the large Modularity and program structure Specific emphasis on OOP –Smalltalk vs C++ vs Java –Language design and implementation

Course Organization (cont’d) uConcurrent and distributed programming General issues in concurrent programming Actor languages: an attempt at idealization Java threads But what about C? Important, practical language But, most of you think C all the time We discuss other languages, you compare them to C in your head as we go (and in homework)

C Programming language toolsets Other languages If all you have is a hammer, then everything looks like a nail.

Digression uCurrent view from carpentry “A hammer is more than just a hammer. It's a personal tool that you get used to and you form a loyalty with. It becomes an extension of yourself."

First half of course uLisp (2 lectures) uFoundations (2 lectures) Lambda Calculus Denotational Semantics Functional vs Imperative Programming uConventional prog. language concepts (6 lectures) ML/Algol language summary (1 lecture) Types and type inference (1 lecture) Block structure and memory management (2 lectures) Control constructs (2 lectures) Midterm Exam

Second half of course uModularity and data abstraction (1 lecture) uObject-oriented languages (6 lectures) Introduction to objects (1 lecture) Simula and Smalltalk (2 lectures) C++ (1.5 lectures) Java (1.5 lectures) uConcurrent and distributed programming(1 lecture) uConclusions and review(1 lecture) Final Exam

General suggestions uRead ahead Some details are only in HW and reading uThere is something difficult about this course May be hard to understand homework questions Thought questions: cannot run and debug May sound like there is no right answer, but some answers are better than others Many of you may be used to overlooking language problems, so it takes a few weeks to see the issues

Mitchell, Autumn This is a fun course and its not too hard. Some of the homework questions take a lot of thought. Beware. Fundamentals and theory bog down the class a bit, but overall an interesting class and Mitchell an interesting and funny teacher. Not too tough, can be tricky. … the material is interesting and makes you think about things in a different way... Take it it's very useful. Now it's much easier for me to figure out what is going in my program or trace the errors of a program and choose the right language for certain tasks.

Course Logistics uHomework and Exams HW on Tuesdays Midterm and Final: dates are set Honor Code, Collaboration Policy uTA’s, Office hours, policy, … uSection Thursday 7-8 PM Optional discussion and review; no new material –Not broadcast but notes may be available electronically (?) uReading material Book on order. Let’s hope it arrives. Look at web site…

Foundations: Partial,Total Functions uValue of an expression may be undefined Undefined operation, e.g., division by zero –3/0 has no value –implementation may halt with error condition Nontermination –f(x) = if x=0 then 1 else f(x-2) –this is a partial function: not defined on all arguments –cannot be detected at compile-time; this is halting problem These two cases are –“Mathematically” equivalent –Operationally different

Partial and Total Functions Total function: f(x) has a value for every x Partial function: g(x) does not have a value for every x x g(x) f(x)

Functions and Graphs Graph of f = {  x,y  | y = f(x) } Graph of g = {  x,y  | y = g(x) } Mathematics: a function is a set of ordered pairs (graph of function) x g(x) f(x)

Partial and Total Functions uTotal function f:A  B is a subset f  A  B with For every x  A, there is some y  B with  x,y   f (total) If  x,y   f and  x,z   f then y=z (single-valued) uPartial function f:A  B is a subset f  A  B with If  x,y   f and  x,z   f then y=z (single-valued) uPrograms define partial functions for two reasons partial operations (like division) nontermination f(x) = if x=0 then 1 else f(x-2)

Halting Problem Entore Buggati: "I build cars to go, not to stop." Self-Portrait in the Green Buggati (1925) Tamara DeLempicka

Computability uDefinition A function f is computable if there is a program P that computes f, i.e., for any input x, the computation P(x) halts with output f(x) uTerminology Partial recursive functions = partial functions (integers to integers) that are computable

Halting function uDecide whether program halts on input Given program P and input x to P, Halt (P,x) = Fact: There is no program for Halt yes if P(x) halts no otherwise Clarifications Assume program P requires one string input x Write P(x) for output of P when run in input x Program P is string input to Halt

Unsolvability of the halting problem uSuppose P solves variant of halting problem On input Q, assume P(Q) = uBuild program D D(Q) = uDoes this make sense? What can D(D) do? If D(D) halts, then D(D) runs forever. If D(D) runs forever, then D(D) halts. CONTRADICTION: program P must not exist. yes if Q(Q) halts no otherwise run forever if Q(Q) halts halt if Q(Q) runs forever

Main points about computability uSome functions are computable, some are not Halting problem uProgramming language implementation Can report error if program result is undefined due to division by zero, other undefined basic operation Cannot report error if program will not terminate

Announcements uHomework grader? Send to cs242 list uSomething for fun Nominate theme song for programming language or course topic uQuestions???