CS6202: Advanced Topics in Programming Languages and Systems Lecture 0 : Overview

Similar documents
CSE Lecture 7: Polymorphism and generics 16 September Nate Nystrom UTA

CSCI-GA Scripting Languages

INF 212/CS 253 Type Systems. Instructors: Harry Xu Crista Lopes

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

CS558 Programming Languages

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University

Pierce Ch. 3, 8, 11, 15. Type Systems

CS558 Programming Languages

Polymorphism and Type Inference

INF 212 ANALYSIS OF PROG. LANGS Type Systems. Instructors: Crista Lopes Copyright Instructors.

Scope and Introduction to Functional Languages. Review and Finish Scoping. Announcements. Assignment 3 due Thu at 11:55pm. Website has SML resources

What Is Computer Science? The Scientific Study of Computation. Expressing or Describing

Subtyping. Lecture 13 CS 565 3/27/06

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming

CS 430 Spring Mike Lam, Professor. Data Types and Type Checking

CS 11 Haskell track: lecture 1

Lecture 7: Data Abstractions

Programming Languages Lecture 15: Recursive Types & Subtyping

Chapter 1. Introduction

G Programming Languages - Fall 2012

CCured. One-Slide Summary. Lecture Outline. Type-Safe Retrofitting of C Programs

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?

CompSci 220. Programming Methodology 12: Functional Data Structures

Subtyping (cont) Formalization of Subtyping. Lecture 15 CS 565. Inversion of the subtype relation:

Static Analysis in C/C++ code with Polyspace

Polymorphism and Type Inference

Information Flow Analysis and Type Systems for Secure C Language (VITC Project) Jun FURUSE. The University of Tokyo

Lecture 13: Subtyping

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler.

The Mezzo case. Jonathan Protzenko. François Pottier FSFMA'13. Why design a new programming language?

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

18-642: Code Style for Compilers

Next: What s in a name? Programming Languages. Data model in functional PL. What s in a name? CSE 130 : Fall Lecture 13: What s in a Name?

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

COS 320. Compiling Techniques

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming

School of Computer & Communication Sciences École Polytechnique Fédérale de Lausanne

News. Programming Languages. Recap. Recap: Environments. Functions. of functions: Closures. CSE 130 : Fall Lecture 5: Functions and Datatypes

Programming Languages

Types and Type Inference

Type Theory meets Effects. Greg Morrisett

CSE341: Programming Languages Lecture 11 Type Inference. Dan Grossman Spring 2016

Subtyping (cont) Lecture 15 CS 565 4/3/08

CS558 Programming Languages

301AA - Advanced Programming [AP-2017]

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking

'Safe' programming languages

Programming Languages

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Advances in Programming Languages

Type Checking and Type Inference

Type Systems. Today. 1. Organizational Matters. 1. Organizational Matters. Lecture 1 Oct. 20th, 2004 Sebastian Maneth. 1. Organizational Matters

Introduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming

Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages. Corky Cartwright Mathias Ricken October 20, 2010

Types. What is a type?

CMSC 330: Organization of Programming Languages. Functional Programming with OCaml

Introduction to OCaml

Mutation. COS 326 David Walker Princeton University

Programming Languages

cs242 Kathleen Fisher Reading: Concepts in Programming Languages, Chapter 6 Thanks to John Mitchell for some of these slides.

Languages and Compilers

Practical Affine Types and Typestate-Oriented Programming

Object Oriented Paradigm

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1

CS558 Programming Languages

Lecture 11: Subprograms & their implementation. Subprograms. Parameters

Some Advanced ML Features

Overview. Elements of Programming Languages. Another example. Consider the humble identity function

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

CS-XXX: Graduate Programming Languages. Lecture 17 Recursive Types. Dan Grossman 2012

Programming Languages

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

Simply-Typed Lambda Calculus

Types, Type Inference and Unification

5. Semantic Analysis!

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6]

Announcements. CSCI 334: Principles of Programming Languages. Lecture 5: Fundamentals III & ML

The design of a programming language for provably correct programs: success and failure

Mini-ML. CS 502 Lecture 2 8/28/08

Generic programming POLYMORPHISM 10/25/13

18-642: Code Style for Compilers

Semantic Analysis. How to Ensure Type-Safety. What Are Types? Static vs. Dynamic Typing. Type Checking. Last time: CS412/CS413

Software System Design and Implementation

A Type is a Set of Values. Here we declare n to be a variable of type int; what we mean, n can take on any value from the set of all integer values.

Subtyping and Objects

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

Some instance messages and methods

Programming language design and analysis

Introduction to Prof. Clarkson Fall Today s music: Prelude from Final Fantasy VII by Nobuo Uematsu (remastered by Sean Schafianski)

Dialects of ML. CMSC 330: Organization of Programming Languages. Dialects of ML (cont.) Features of ML. Functional Languages. Features of ML (cont.

Adam Chlipala University of California, Berkeley ICFP 2006

Java Inheritance. Written by John Bell for CS 342, Spring Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources.

Front-end Technologies for Formal-Methods Tools

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 6

Notes from a Short Introductory Lecture on Scala (Based on Programming in Scala, 2nd Ed.)

Advances in Programming Languages

Note 3. Types. Yunheung Paek. Associate Professor Software Optimizations and Restructuring Lab. Seoul National University

Transcription:

CS6202: Advanced Topics in Programming Languages and Systems Lecture 0 : Overview Advanced Language Features and Foundations Lecturer : Chin Wei Ngan Email : chinwn@comp.nus.edu.sg Office : S15 06-01 CS6202 Introduction 1

Administrative Matters - mainly via Web-page + IVLE - Reading Materials : various papers/books Robert Harper : Foundations of Practical Programming Languages. Free PL books : http://www.cs.uu.nl/~franka/ref - Lectures + Term Paper (100% CA) - Assignment (30%) - Take-Home Tests (20%) - Term Paper and Miniproject (50%) CS6202 Introduction 2

Course Objectives - graduate-level course with research focus - languages as tool for programming/research - foundations for reasoning about programs - explore research frontiers CS6202 Introduction 3

Course Outline Lecture Topics (10 weeks) Advanced Language (Standard ML) http://www.cs.cmu.edu/~rwh/smlbook/online.pdf Type System for Lightweight Analysis http://www.cs.cmu.edu/~rwh/plbook/book.pdf Genericity for OO (Java 5) http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf https://java-generics-book.dev.java.net/ Formal Reasoning Separation Logic + Theorem Provers Term Paper Project (7 weeks) Read, Present, Research, Critique, Evaluate CS6202 Introduction 4

Possible Term Paper Topics Dependent types and sized analysis. Types for security. Language support for XML processing. Security Vulnerability analysis. Automatic ProgramVerification. Domain-specific languages (e.g. sensor programming). Real-time Languages Resource Analysis for Embedded Devices Reasoning about Program Concurrency. OO Genericity. Others : (you propose and let me know) CS6202 Introduction 5

Advanced Language - ML Strongly-typed with polymorphism Higher-order functions Mostly pure except for mutable references. Algebraic data types + records Exceptions Strong module system - components Advantages : concise, abstract, reuse Why use ML? productivity CS6202 Introduction 6

Example - ML Program Apply a function to every element of a list. a type variable datatype a list = Nil Cons of a * ( a list) type is : ( a b) * ( a list) ( b list) fun map (f, Nil) = Nil map (f, Cons(x,xs)) = Cons (f(x), map(f,xs)) map(inc,cons(1,cons(2,cons(3,nil)))) ==> Cons(2,Cons(3,Cons(4,Nil)))) CS6202 Introduction 7

Type System Lightweight Analysis Abstract description of code + genericity Compile-time analysis that is tractable Guarantees absence of some bad behaviors Issues expressivity, soundness, completeness, inference? How to use, design and prove type system. Why? detect bugs CS6202 Introduction 8

Java 5 mainstream language with generic types sophisticated subtyping mechanism F-bounds polymorphism with use-site variance Why? generic code + type safety CS6202 Introduction 9

Example Java 4 Inclusion polymorphism safe during upcast but may fail during downcast. generic container class Cell { Object val; Object get() { return val; } void set(object x ) { val = x; } } Cell c; c.set(new Integer(3)}; Integer y = (Integer) c.get(); safe upcast downcast may fail CS6202 Introduction 10

Background to OO Genericity Why not adopt FL s type polymorphism? Covariance for container List<Int> <: List<Num> but requires immutability while OO has mutable objects Solutions GJ,Pizza : Parametric type Eiffel, Scala, C# : Declaration-site variance Java 5 : Use-site variance CS6202 Introduction 11

Example Java 5 Bounded parametric polymorphism with variance type parameter class Cell<T> { T val; } <T> Cell<? extends T> T get() { return val; } <T> Cell<? super T> void set(t x ) { val = x; } Cell<Integer> c; <Integer> c.set(new Integer(3)}; Cell<? extends Number> d; d = c; (?) c.get(); (?) d.get(); d.set(new Float(1.0)); d.set(null); reading/writing for reading mainly illegal due to writing CS6202 Introduction 12

Separation Logic and Theorem Proving Is sorting algorithm correct? Any memory leaks? Any null pointer dereference? Any array bound violation? What is the your specification/contract? How to verify program correctness? Issues mutation and aliasing Why? sw reliability CS6202 Introduction 13