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

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

Programming Languages

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

Programming Languages

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

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

So what does studying PL buy me?

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

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

Programming Languages 2nd edition Tucker and Noonan"

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

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

CS240: Programming in C

Programming Languages

Concepts of Programming Languages

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

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

CSE 341: Programming Languages

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

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

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

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

CS 3304 Comparative Languages. Lecture 1: Introduction

CS 6371: Advanced Programming Languages

Programming (Econometrics)

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

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

What is a programming language?

Programming Languages

Programming Languages

Introduction to Nate Foster Spring 2018

Seminar in Programming Languages

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

CS 3110 Lecture 1 Course Overview

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

INF3380: Parallel Programming for Natural Sciences

CSCI 3136 Principles of Programming Languages

The Environment Model

CS 241 Data Organization using C

Programming Languages, Summary CSC419; Odelia Schwartz

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

Lecture 1 - Introduction (Class Notes)

CS 241 Data Organization. August 21, 2018

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

Languages and Compilers

Creating and Running Your First C# Program

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

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

CSc 372 Comparative Programming Languages

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

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

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

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

15-411/ Compiler Design

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

EEE-425 Programming Languages (2013) 1

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

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

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

Data Types (cont.) Administrative Issues. Academic Dishonesty. How do we detect plagiarism? Strongly Typed Languages. Type System

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

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

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

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

ECE573 Introduction to Compilers & Translators

UNIT I Programming Language Syntax and semantics. Kainjan Sanghavi

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

Comp 333: Concepts of Programming Languages Fall 2016

Python for Earth Scientists

Programming Languages

CSC 261/461 Database Systems. Fall 2017 MW 12:30 pm 1:45 pm CSB 601

Introduction. A. Bellaachia Page: 1

1: Introduction to Object (1)

COSE212: Programming Languages. Lecture 0 Course Overview

Computers and programming languages introduction

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

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

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

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

CMSC 330: Organization of Programming Languages. Administrivia

CSC 015: FUNDAMENTALS OF COMPUTER SCIENCE I

Programming Languages and Techniques (CIS120)

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

Functions. Nate Foster Spring 2018

BM214E Object Oriented Programming Lecture 4

TYPES, VALUES AND DECLARATIONS

Welcome to CS 241 Systems Programming at Illinois

Programming Languages

Project. there are a couple of 3 person teams. a new drop with new type checking is coming. regroup or see me or forever hold your peace

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

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

Object Oriented Programming

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

Transcription:

Hi! My name is Sorin CSE 130 : Fall 2014 Programming Languages Sorin Lerner UC San Diego 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 Enables you to create software that is Readable Correct Extendable Modifiable Reusable 1

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 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 Enables you to design new languages who, me? Companies develop general purpose PLs/paradigm! Google: MapReduce Mozilla: Rust RedHat: Ceylon Nvidia: CUDA 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 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? 2

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 Dimension: Memory model Explicit allocation-deallocation: C, C++ Imperative: Fortran, Pascal, C Garbage collection: Smalltalk, Java, C# Object oriented: Smalltalk, C++, Java, C# Constraint-based: Prolog, CLP(R) 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... 3

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/fa14/cse130-a/ Requirements and Grading Prog. Assignments (6-8): 30% Nothing printed, everything on Webpage! Piazza: sign-up using link on web page Midterm (open book): 35% TAs: Dimo Bounov, Valentin Robert, Vineel Pokala Tutors: Lucas Cycon, Arden Liao, Eduardo Ramirez Final (open book): 35% Weekly Programming Assignments Schedule up on webpage Due on Friday midnight PM 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 10th Word from our sponsor Programming Assignments done ALONE We use plagiarism detection software Have code from all previous classes MOSS is fantastic, plagiarize at your own risk Zero Tolerance offenders punished ruthlessly Please see academic integrity statement 4

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 retarded Immerse yourself in new language Enough with the small talk It is not.? Free your mind. 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 5

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 6