Programming Languages

Similar documents
Hi! My name is Sorin. Programming Languages. Why study PL? (discussion) Why study PL? Course Goals. CSE : Fall 2017

Hi! My name is Sorin. Programming Languages. Why study PL? (discussion) Why study PL? Course Goals. CSE 130 : Fall 2014

Programming Languages

Hi! My name is Sorin. Programming Languages. Why study PL? (discussion) Why study PL? Course Goals. CSE 130 : Fall 2013

A Programming Language. A different language g is a different vision of life. CSE 130 : Fall Two variables. L1: x++; y--; (y=0)?

So what does studying PL buy me?

A Programming Language. A different language g is a different vision of life. CSE 130 : Spring Two variables. L1: x++; y--; (y=0)?

Programming Languages. So why study PL? A Programming Language. A different language is a different vision of life. CSE 130 : Fall 2015

Programming Languages. So why study PL? A Programming Language. A different language is a different vision of life. CSE 130 : Spring 2015

CSE 130 [Spring 2014] Programming Languages

Any questions. Say hello to OCaml. Say hello to OCaml. Why readability matters. History, Variants. Plan (next 4 weeks)

CSE 130 : Fall Programming Languages. Lecture 11: Ranjit Jhala UC San Diego. programming

Programming Languages 2nd edition Tucker and Noonan"

CS240: Programming in C

Monday Feb 16, 5pm. solve these equalities. Midterm Thursday Feb 12. covers only ocaml part of the course, assignments 1 through 3.

Concepts of Programming Languages

Key components of a lang. Deconstructing OCaml. In OCaml. Units of computation. In Java/Python. In OCaml. Units of computation.

CSE 341: Programming Languages

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

Programming Languages

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

CSc 372 Comparative Programming Languages

Seminar in Programming Languages

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen

Back to OCaml. Summary of polymorphism. Example 1. Type inference. Example 2. Example 2. Subtype. Polymorphic types allow us to reuse code.

Introduction to Nate Foster Spring 2018

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

CS 241 Data Organization using C

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

CS 241 Data Organization. August 21, 2018

Course outline. CSE 341: Programming Languages. Why study programming languages? Course motivation and objectives. 1 lecture: Concepts

What is a programming language?

INF3380: Parallel Programming for Natural Sciences

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

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

CS 6371: Advanced Programming Languages

15-411/ Compiler Design

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10

CSC 326H1F, Fall Programming Languages. What languages do you know? Instructor: Ali Juma. A survey of counted loops: FORTRAN

Lecture 1 - Introduction (Class Notes)

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2014 Euiseong Seo

Why study Programming Language Concepts? Chapter One. Language Evaluation Criteria. Programming Domains. Readability Writability Reliability Cost

Programming Languages

Programming (Econometrics)

Programming Languages, Summary CSC419; Odelia Schwartz

Lecture 1: Course Introduction

Today. An Animated Introduction to Programming. Prerequisites. Computer programming

Comp 333: Concepts of Programming Languages Fall 2016

News. Programming Languages. Complex types: Lists. Recap: ML s Holy Trinity. CSE 130: Spring 2012

8/27/17. CS-3304 Introduction. What will you learn? Semester Outline. Websites INTRODUCTION TO PROGRAMMING LANGUAGES

What is programming? Elements of Programming Languages. From machine code to programming languages. What is a programming language?

The Environment Model

CSCI 3136 Principles of Programming Languages

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Principles in Programming: Orientation & Lecture 1. SWE2004: Principles in Programming Spring 2015 Euiseong Seo

Programming Language Design and Implementation. Cunning Plan. Your Host For The Semester. Wes Weimer TR 9:30-10:45 MEC 214. Who Are We?

Programming Languages

CSC 172 Data Structures and Algorithms. Fall 2017 TuTh 3:25 pm 4:40 pm Aug 30- Dec 22 Hoyt Auditorium

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

NOTE: Answer ANY FOUR of the following 6 sections:

CS 3304 Comparative Languages. Lecture 1: Introduction

Introduction. A. Bellaachia Page: 1

1: Introduction to Object (1)

Recap from last time. Programming Languages. CSE 130 : Fall Lecture 3: Data Types. Put it together: a filter function

G Programming Languages - Fall 2012

Com S 541. Programming Languages I

The Environment Model. Nate Foster Spring 2018

Object Oriented Programming

Creating and Running Your First C# Program

Lecture 1: Course Introduction

Computer Science Seminar. Whats the next big thing? Ruby? Python? Neither?

COSE212: Programming Languages. Lecture 0 Course Overview


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

Languages and Compilers

CS252 Advanced Programming Language Principles. Prof. Tom Austin San José State University Fall 2013

CS 3110 Lecture 1 Course Overview

CMSC 330: Organization of Programming Languages. Memory Management and Garbage Collection

UNIT I Programming Language Syntax and semantics. Kainjan Sanghavi

Language Translation, History. CS152. Chris Pollett. Sep. 3, 2008.

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Plan (next 4 weeks) 1. Fast forward. 2. Rewind. 3. Slow motion. Rapid introduction to what s in OCaml. Go over the pieces individually

Programming Languages

CS 3813/718 Fall Python Programming. Professor Liang Huang.

CMSC 330: Organization of Programming Languages

Welcome to CS 241 Systems Programming at Illinois

The Future of Programming Languages. Will Crichton CS /28/18

Programming Languages and Techniques (CIS120)

CSC 533: Organization of Programming Languages. Spring 2005

Usually, target code is semantically equivalent to source code, but not always!

OCaml. History, Variants. ML s holy trinity. Interacting with ML. Base type: Integers. Base type: Strings. *Notes from Sorin Lerner at UCSD*

TA hours and labs start today. First lab is out and due next Wednesday, 1/31. Getting started lab is also out

Closures. Mooly Sagiv. Michael Clarkson, Cornell CS 3110 Data Structures and Functional Programming

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

CMSC 330: Organization of Programming Languages. Administrivia

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Transcription:

CSE 130 : Fall 2016 Programming Languages Sorin Lerner UC San Diego

Hi! My name is Sorin

Why study PL? (discussion)

Why study PL? A different language is a different vision of life - Fellini - Hypothesis: Programming language shapes programming thought - Characteristics of a language affect how ideas can be expressed in the language

Course Goals Free your mind -Morpheus You will learn several new - languages and constructs - ways to describe and organize computation Yes, you can do that in Java/Assembly but

So what does studying PL buy me? Enables you to create software that is Readable Correct Extendable Modifiable Reusable

So what does studying PL buy me? Will help you learn new languages There was no Java (C#) 15 (10) years ago Will learn the anatomy of a PL Fundamental building blocks of languages reappear in different guises in different languages and different settings Re-learn the languages you already know

So what does studying PL buy me? Enables you to design new languages who, me? Buried inside any extensible system is a PL Emacs: E-Lisp Word, Powerpoint: VBScript Quake: QuakeC Facebook: FBML, FBJS SQL, Renderman, LaTeX, XML

So what does studying PL buy me? Enables you to design new languages who, me? Companies develop general purpose PLs/paradigm! Google: MapReduce Mozilla: Rust RedHat: Ceylon Nvidia: CUDA

So what does studying PL buy me? Enables you to better choose the right language but isn t that decided by libraries, standards, and my boss? Yes. Chicken-and-egg. My goal: educate tomorrow s tech leaders & bosses So you ll make considered, informed choices

So what does studying PL buy me? Makes you look at things in different ways, think outside of the box Knowing language paradigms other than traditional ones will give you new tools to approach problems, even if you are programming in Java

PL Dimensions Wide variety of programming languages How do they differ? along certain dimensions... What are these dimensions?

PL Dimensions (discussion)

Dimension: Syntax Languages have different syntax But the difference in syntax can be superficial C# and Java have different syntax, but are very similar In this class, will look beyond superficial syntax to understand the underlying principles

Dimension: Computation model Functional: Lisp, OCaml, ML Imperative: Fortran, Pascal, C Object oriented: Smalltalk, C++, Java, C# Constraint-based: Prolog, CLP(R)

Dimension: Memory model Explicit allocation-deallocation: C, C++ Garbage collection: Smalltalk, Java, C# Regions: safe versions of C (e.g. Cyclone) allocate in a region, deallocate entire region at once more efficient than GC, but no dangling ptrs

Dimension: Typing model Statically typed: Java, C, C++, C# Dynamically typed: Lisp, Scheme, Perl, Smalltalk Strongly typed (Java) vs. weakly typed (C, C++)

Dimension: Execution model Compiled: C, C++ Interpreted: Perl, shell scripting PLs Hybrid: Java Is this really a property of the language? Or the language implementation? Depends...

So many dimensions Yikes, there are so many dimensions! How to study all this! One option: study each dimension in turn In this course: explore the various dimensions by looking at a handful of PLs

Course material Outline: 1. Functional, OCaml, 4 weeks 2. OO, Python, 4 weeks 3. Logic, Prolog, 1 weeks No recommended Text: Online lecture notes Resources posted on webpage Pay attention to lecture and section!

Course Mechanics www.cs.ucsd.edu/classes/fa16/cse130-a/ (Google Sorin Lerner, follow Teaching Now ) Nothing printed, everything on Webpage! Piazza: sign-up using link on web page TAs: Mario Alvarez, Valentin Robert, Dan Ricketts, John Sarracino, Zijian Tao Tutors: TBD

Requirements and Grading Prog. Assignments (7): 30% Midterm (only cheat-sheet): 35% Final (only cheat-sheet): 35%

Weekly Programming Assignments Schedule up on webpage Deadline Extension: Four late days, used as whole unit 5 mins late = 1 late day Plan ahead, no other extensions PA #1 online, due Oct 30th

Academic Integrity Programming Assignments done ALONE We use plagiarism detection software Have code from all previous classes Have code from public repos MOSS is fantastic, plagiarize at your own risk Make your repo private, or you will be found responsible Cases referred to AI office Please see UCSD academic integrity stmt

Weekly Programming Assignments Unfamiliar languages + Unfamiliar environments Start Early!

Weekly Programming Assignments Forget Java, C, C++ other 20 th century PLs Don t complain that Ocaml is hard that Ocaml is @!#@%

Immerse yourself in new language It is not. Free your mind.

Enough with the small talk?

Say hello to OCaml void sort(int arr[], int beg, int end){ if (end > beg + 1){ int piv = arr[beg]; int l = beg + 1; int r = end; while (l!= r-1){ if(arr[l] <= piv) l++; else swap(&arr[l], &arr[r--]); } if(arr[l]<=piv && arr[r]<=piv) l=r+1; else if(arr[l]<=piv && arr[r]>piv) {l++; r--;} else if (arr[l]>piv && arr[r]<=piv) swap(&arr[l++], &arr[r--]); else r=l-1; swap(&arr[r--], &arr[beg]); sort(arr, beg, r); sort(arr, l, end); } } Quicksort in C let rec sort l = match l with [] -> [] (h::t) -> let(l,r)= List.partition ((<=) h) t in (sort l)@h::(sort r) Quicksort in Ocaml

Why readability matters sort=:(($:@(<#[),(=#[),$:@(>#[))({~?@#))^: (1:<#) Quicksort in J

Say hello to OCaml let rec sort l = match l with [] -> [] (h::t) -> let (l,r)= List.partition ((<=) h) t in (sort l)@h::(sort r) Quicksort in OCaml

Plan (next 4 weeks) 1. Fast forward Rapid introduction to what s in OCaml 2. Rewind 3. Slow motion Go over the pieces individually