1 / 18

CS5205: Foundation in Programming Languages Lecture 0 : Overview

CS5205: Foundation in Programming Languages Lecture 0 : Overview. “Language Foundation, Extensions and Reasoning. Lecturer : Chin Wei Ngan Email : chinwn@comp.nus.edu.sg Office : COM2 4-32. Course Objectives. - graduate-level course with foundation focus

stefan
Download Presentation

CS5205: Foundation in Programming Languages Lecture 0 : Overview

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. CS5205: Foundation in Programming LanguagesLecture 0 :Overview “Language Foundation, Extensions and Reasoning Lecturer : Chin Wei Ngan Email : chinwn@comp.nus.edu.sg Office : COM2 4-32 Introduction

  2. Course Objectives - graduate-level course with foundation focus - languages as tools for programming - foundations for reasoning about programs - explore various language innovations Introduction

  3. Course Outline • Lecture Topics (13 weeks) • Advanced Typed Language (Haskell) • http://www.haskell.org • Lambda Calculus (Core Language) • Interpreters • Untyped Scripting Language (Python) • http://www.python.org • Type System for Lightweight Analysis • http://www.cs.cmu.edu/~rwh/plbook/book.pdf • Semantics Introduction

  4. Administrative Matters - mainly IVLE - Reading Materials (mostly online): www.haskell.org Robert Harper : Foundations of Practical Programming Languages. Free PL books : http://freeprogrammingbooks.com - Lectures + Assignments + Paper Reading+ Exam - Assignment/Project (35%) - Paper Reading (10%) - Quiz (10%) - Exam (45%) Introduction

  5. Paper Presentation • Focus on Language Innovation/Application • Select A Paper (Week 2) • Give Presentation (Week 4/5) • Possible Topics • Concurrent and MultiCore Programming • Software Transaction Memory • GUI Programming • Testing with QuickCheck • IDE for Haskell • SELinks (OCaml) • etc • A List of Papers/Conferences will be given next week. Introduction

  6. Assignments/Project (35%) • Small Exercises • Mini-Project • List of possible projects (Week 5) • Your own project • A useful tool • Use advanced languages, such as • Haskell, Ocaml, F#, Python, Boo, etc • Evaluation • (i) presentation/demo • (ii) draft report/paper Introduction

  7. Why Study Foundations of PL? • Language used to organize programming thoughts. • Language can describe and organize computation. • Language features affect how ideas are expressed. • Foundation needed to support the design of good language features Introduction

  8. Benefits of Good PL Features • Readability • Extensible Software. • Modifiability. • Reusability. • Correctness. Introduction

  9. Benefits of Studying Foundations of PL • Design new languages for your work/research? • Inside any successful software system is a PL • Emacs : Elisp • Word, PPT : VBScript • Quake : QuakeC • Facebook : FBML, FBJS • Twitter : Ruby on Rails/Scala • Also: Latex, XML, SQL, PS/PDF Introduction

  10. Benefits of Studying Foundations of PL • Different language paradigm can support different approaches to a given problem. • Can choose a solution that is best (or good enough) for the given problem. • PL is the primary tool of choice for programmers. If properly selected, it can amplify your programming capability. • Era of domain-specific programming languages. Introduction

  11. Many Dimensions of PL • Syntax – verbose vs succint. prefix vs distfix. • Computational model : functional, imperative, OO or constraint-based. • Memory Model : explicit deallocation, garbage collection or region-based. • Typing : static vs dynamic typing; strong vs weak typing. • Execution Model : compiled (C/C++), interpreted (Perl), hybrid (Java). • Scoping : static vs dynamic scoping. Introduction

  12. Advanced Language - Haskell • Strongly-typed with polymorphism • Higher-order functions • Pure Lazy Language. • Algebraic data types + records • Exceptions • Type classes, Monads, Arrows, etc • Advantages : concise, abstract, reuse • Why use Haskell ? cool & greater productivity Introduction

  13. Some Applications of FP/Haskell • Hoogle – search in code library • Darcs – distributed version control • Programming user interface with arrows.. • How to program multicore? • map/reduce and Cloud computing • Bioinformatics • Cryptography Introduction

  14. type is : (a  b)  (List a) (List b) Example - Haskell Program • Apply a function to every element of a list. • data List a = Nil | Cons a (List a) • map f Nil = Nil • map f (Cons x xs) = Cons (f x) (map f xs) a type variable map sqr(Cons 1 (Cons 2 (Cons 3 Nil))) ==> (Cons 1 (Cons 4 (Cons 9 Nil))) Introduction

  15. Example - Haskell Program • Built-in List Type with syntactic sugar • data [a] = [] | a:[a] • map :: (a  b)  [a] [b] • map f [] = [] • map f (x:xs) = (f x):(map f xs) map sqr 1:(2:(3:[])) ==> 1:(4:(9:[])) map sqr [1,2,3] ==> [1,4,9] Introduction

  16. Paradigm : Functional Expression • Problem : sum the square of a list of numbers • sumsq [1,2,3,4] = 1*1 +2*2 +3*3 + 4*4. • Problem : sum the square of a list of numbers • sumsq [] = 0 • sumsq (x:xs) = (sqr x) + (sumsqxs) Introduction

  17. Paradigm : Imperative Loop • Problem : sum the square of a list of numbers • sumsq [1,2,3,4] = 1*1 +2*2 +3*3 + 4*4. • In F# (Ocaml dialect) • sumsq :: [Int] = Int • sumsqxs = let s = ref 0 in • for x in xs • s := !s + x ; • s Introduction

  18. Paradigm : Function-Level Composition • Sum a list: sum [] = 0 sum (x:xs) = x + (sum xs) • Square a list: square xs = map sqr xs • Sum a square of list: square = sum o (map sqr) square = (map sqr) | sum square xs = xs |> (map sqr) |> sum Introduction

More Related