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

Similar documents
Programming Languages

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

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.

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

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

Programming Languages

Concepts of Programming Languages

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

CSE 341: Programming Languages

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

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

CS240: Programming in C

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

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

What is a programming language?

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

Programming Languages

Programming Languages

Programming (Econometrics)

Seminar in Programming Languages

The Environment Model

CSCI 3136 Principles of Programming Languages

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

Programming Languages, Summary CSC419; Odelia Schwartz

Languages and Compilers

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

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

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

G Programming Languages - Fall 2012

The Environment Model. Nate Foster Spring 2018

Creating and Running Your First C# Program

EEE-425 Programming Languages (2013) 1

Lecture 1 - Introduction (Class Notes)

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

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

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

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

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

CSc 372 Comparative Programming Languages

UNIT I Programming Language Syntax and semantics. Kainjan Sanghavi

Python for Earth Scientists

Programming Languages

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

CS 3110 Lecture 1 Course Overview

Comp 333: Concepts of Programming Languages Fall 2016

Introduction to Nate Foster Spring 2018

1: Introduction to Object (1)

INF3380: Parallel Programming for Natural Sciences

Computers and programming languages introduction

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

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

CSC 015: FUNDAMENTALS OF COMPUTER SCIENCE I

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

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

Com S 541. Programming Languages I

BM214E Object Oriented Programming Lecture 4

Functions. Nate Foster Spring 2018

TYPES, VALUES AND DECLARATIONS

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

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

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

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

Object Oriented Programming

Lecture 1: Course Introduction

Introduction. A. Bellaachia Page: 1

CMSC 330: Organization of Programming Languages

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

ECE573 Introduction to Compilers & Translators

Introduction to Engineering Using Robotics Experiments. Dr. Yinong Chen

(0) introduction to the course. how to learn a programming language. (0) course structure

Introduction to Computer Science I

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

CSC 533: Organization of Programming Languages. Spring 2005

NOTE: Answer ANY FOUR of the following 6 sections:

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

Advanced Compiler Design. CSE 231 Instructor: Sorin Lerner

CS 242. Fundamentals. Reading: See last slide

CSC209. Software Tools and Systems Programming.

CMSC 330: Organization of Programming Languages. Administrivia

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

Programmiersprachen (Programming Languages)

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017

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

Grade Weights. Language Design and Overview of COOL. CS143 Lecture 2. Programming Language Economics 101. Lecture Outline

Transcription:

Hi! My name is Sorin CSE 130 : Fall 2013 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 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 PL Dimensions (discussion) Wide variety of programming languages How do they differ? along certain dimensions... What are these dimensions? 2

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 3

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/fa13/cse130-a/ Nothing printed, everything on Webpage! Lectures: Sorin Lerner Section: Don Jang Requirements and Grading Prog. Assignments (6-8): 35% Weekly Programming Assignments Schedule up on webpage Due on Friday midnight PM Midterm (open book): 30% Final (open book): 35% 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 4th 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 Weekly Programming Assignments Unfamiliar languages + Unfamiliar environments Start Early! Please see academic integrity statement 4

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 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 Say hello to OCaml sort=:(($:@(<#[),(=#[),$:@(>#[))({~?@#))^: (1:<#) Quicksort in J 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 5

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