Programming Languages winter term 2010/11

Slides:



Advertisements
Similar presentations
Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
Advertisements

1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
Functional Programming. Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Chapter 15 Other Functional Languages. Copyright © 2007 Addison-Wesley. All rights reserved. Functional Languages Scheme and LISP have a simple syntax.
Programming Language Theory Leif Grönqvist The national Graduate School of Language Technology (GSLT) MSI.
Dr. Ken Hoganson, © August 2014 Programming in R STAT8030 Programming in R COURSE NOTES 1: Hoganson Programming Languages.
There are only 10 types of people in the world, those who understand binary and those who don't.
0 PROGRAMMING IN HASKELL An Introduction Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
By Neng-Fa Zhou1 Evolution of programming languages –Machine language –Assembly language –Sub-routines and loop (Fortran) –Procedures and recursion (Algol,
0 REVIEW OF HASKELL A lightening tour in 45 minutes.
1 Programming Language History and Evolution In Text: Chapter 2.
1 COMP313A Functional Programming (1). 2 Main Differences with Imperative Languages Say more about what is computed as opposed to how Pure functional.
Dan Johnson.  Functional language that started development in  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after.
CS112: Structure of Programming Languages A smorgasbord of topics in programming languages including programming paradigms and syntax, semantics, implementation.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 8.
TIVDM2Functional Programming Language Concepts 1 Concepts from Functional Programming Languages Peter Gorm Larsen.
Principles of Programming Languages Lecture 1 Slides by Yaron Gonen, based on slides by Daniel Deutch and lecture notes by Prof. Mira Balaban.
The Software Development Process
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
COMP313A Functional Programming (1)
CS5205Introduction1 CS5205: Foundation in Programming Languages Lecture 0 : Overview Lecturer : Chin Wei Ngan Office : COM2.
Cs1321 December 6, 2001 Review. What is computer science? What's an algorithm? Processes and programs Overview of some programming language concepts Functional.
First Order Haskell Neil Mitchell York University λ.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
CS 152: Programming Language Paradigms March 12 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
Haskell Chapter 5, Part II. Topics  Review/More Higher Order Functions  Lambda functions  Folds.
서울대한양대 ( 안 산 ) 충남대 1년1년 컴퓨터기초 (C) 컴퓨터프로그래밍 (C, Java) 컴퓨터프로그래밍 (C) 2. 봄 프로그래밍 원리 (Scheme, ML) Structure & Interpretation of Computer Programs 프로그래밍 방법론.
1 PROGRAMMING IN HASKELL An Introduction Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
Language Paradigms CS655.
Functional Programming
Programming Language History and Evolution
Programming Languages 2nd edition Tucker and Noonan
Functional Programming
The language focusses on ease of use
CSC 222: Computer Programming II
Midterm recap Total was 80 points Distribution range
IAG0582 Introduction.
Concepts of Programming Languages
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Why study programming languages?
Basic 1964 PC general purpose Imperative Small Easy to use.
CS 326 Programming Languages, Concepts and Implementation
Programming Language Design Concepts
CS 326 Programming Languages, Concepts and Implementation
A lightening tour in 45 minutes
Functional Programming (MTAT )
Introduction to Functional Programming Course Summary and Future
Programming Language History and Evolution
Evolution of programming languages
Programming Languages
FP Foundations, Scheme In Text: Chapter 14.
CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures Zach Tatlock Winter 2018.
Programming Languages 2nd edition Tucker and Noonan
Pattern Matching Pattern matching allows us to do things like this:
Lisp, Then and Now.
Introduction to Functional Programming in Racket
PROGRAMMING IN HASKELL
Announcements Quiz 5 HW6 due October 23
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Programming Languages
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Functional Programming and Haskell
PROGRAMMING IN HASKELL
Brett Wortzman Summer 2019 Slides originally created by Dan Grossman
Functional Programming and Haskell
Presentation transcript:

Programming Languages winter term 2010/11 Jörg Kreiker, I2+I7

Getting started What is your favorite PL? Do you know any functional language? Logic programming? Expectations? Implement the joke in your favorite PL

Popular languages: langpop.com

Most talked about languages

Meet Haskell: a straight bat Download interpreter (hugs/ghci) and compiler (ghc) from haskell.org Pure, lazy, functional language Use declarative languages only As opposed to imperative Freely available books and tutorials Printing 500 lines in Haskell

Haskell.org

realworldhaskell.org

Organization Lectures: Thursday, 12 noon – 1.30pm, 00.08.038 Mostly theory Tutorials: Thursday, 2pm-3.30pm, tbd First tutorial: next week Mostly programming Online problem solving Discussion and comparison of languages and paradigms Website: www2.in.tum.de/hp/Main?nid=142

Grading Written exam, 40 points, 90 minutes Programming project “Exen” Implement a Haskell interpreter in Haskell Earns you up to 4 bonus points Due before xmas “Exen” Small tests during tutorials Earn you 1 (>50%) or 2 (>75%) bonus points

Code of conduct Interaction, interaction, interaction Buzz votes and polls Ask questions (English or German) No cell phones, no eating 1 or 2 breaks of 5-10 minutes per lecture Laptops for online programming Coffee is fine

http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/

Learning goals

1 To write short error-free programs, without testing, for tasks such as binary search, and to use a formal system such as Hoare logic to verify them.

2 To use language features such as higher-order functions and continuations to implement tasks such as backtracking and memoization.

Some modern features and techniques Continuations Polymorphism First-class functions (closures, lambda) Pattern matching Software transactional memory Memoization and backtracking Exceptions Monads

3 To write concurrent programs using shared variables or message-passing, and to give rigorous informal arguments for their lack of errors.

4 To specify precisely and implement correctly a simple programming language.

5 To estimate the time and space requirements of basic operations on widely used data representations.

6 To write a clear and error-free program of sufficient complexity – say a syntax-directed editor – that it must be structured carefully.

Content Haskell Prolog Laziness State I/O Continuations Lambda calculus Types and semantics Prolog Programming by search Backtracking

Clarify and define formally… Syntax vs semantics Types Scope and binding Functions vs procedures Call-by-value, call-by name, call-by need Identifiers vs variables State Modularity Polymorphism

The factorial function П fac(n) = i=1 n i implement the factorial function in your favorite language discuss with your neighbor 3 minutes

Haskell freshman fac n = if n == 0 then 1 else n * fac (n-1)

Haskell sophomore fac = \n -> if (==) n 0 then 1 else (*) n (fac ((-) n 1))

Haskell junior fac 0 = 1 fac n = n * fac (n-1)

Haskell senior fac n = foldr (*) [1..n] fac n = foldl (*) [1..n]

Memoizing Haskell programmer facs n = scanl (*) 1 [1..] fac n = facs !! n

Continuation-passing style facCPS k 0 = k 1 facCPS k n = facCPS (k . (n *)) (n-1) fac = facCPS id

Accumulating programmer facACC a 0 = a facACC a n = fac (a*n) (n-1) fac = facACC 1

Haskell boy scout y f = f (y f) fac = y (\f n -> if n==0 then 1 else n * f (n-1))

Pure madness s f g x = f x (g x) k x y = x b f g x = f (g x) c f g x = f x g y f = f (y f) cond p f g x = if p x then f x else g x fac = y (b (cond ((==) 0) (k 1)) (b (s (*)) (c b pred)))

http://www.willamette.edu/~fruehr/haskell/evolution.html

Conclusion Learning goals, organization, content Haskell primer Currying Pattern matching List combinators (foldr, foldl, scanl) Iteration vs recursion Accumulators and tail calls Continuations S, K, B, C, Y combinators

Outlook Next time: more on Haskell Lists and trees Types More language features