Top Banner
CS 581: Programming Language I Course Introduction Fall 2019 1 / 24
24

CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Jun 25, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

CS 581: Programming Language ICourse Introduction

Fall 2019

1 / 24

Page 2: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Introduce yourself!

Rough estimate in class• Taken CS 381?• Experience with Haskell or other functional language?

By Monday, 5pmSubmit a PDF (through TEACH) containing:• Name, year/status, research group (if applicable)• Photo, ideally with a view of your face• Answers to a few questions• An interesting fact

2 / 24

Page 3: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Outline

About this course

Why study programming languages?Languages are at the heart of computer scienceGood languages really matter

How to study programming languages

Course logistics

3 / 24

Page 4: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

About this course

Functional programming

Syntax

Denotational semantics

Lambda calculus

CS 381:

CS 581:

About this course 4 / 24

Page 5: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Outline

About this course

Why study programming languages?Languages are at the heart of computer scienceGood languages really matter

How to study programming languages

Course logistics

Why study programming languages? 5 / 24

Page 6: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

What is computer science?

Computer science is no more about computers thanastronomy is about telescopes.

—Edsger Dijkstra

Computer Science = the science of computation

Why study programming languages? 6 / 24

Page 7: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

What is computation?

Computation = systematic transformation of representation• Systematic: according to a fixed plan• Transformation: process that has a changing effect• Representation: abstraction that encodes particular features

Languages play a central role:• The “fixed plan” is an algorithm, which is described in a language• The “representation” is data, which is also often described in a language

Why study programming languages? 7 / 24

Page 8: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

What about software engineering?

Science vs. EngineeringScience: tries to understand and explainEngineering: applies science to build stuff

Science Engineeringphysics structural engineering, . . .chemistry chemical engineering, . . .“computing” software engineering, . . .

Both are part of “computer science”

Why study programming languages? 8 / 24

Page 9: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Central role of PL in CS

PL supports both aspects of CS:

• to understand and explain (science)we need languages to describe and reason about computations for ourselves

• to build cool stuff (engineering)we need languages to describe computations for a computer to execute

Why study programming languages? 9 / 24

Page 10: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Outline

About this course

Why study programming languages?Languages are at the heart of computer scienceGood languages really matter

How to study programming languages

Course logistics

Why study programming languages? 10 / 24

Page 11: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Why good languages matter: preventing bugs

Good languages can help prevent bugs

• Mars Climate Orbiter failure, 1998• caused by mismatched units between ground and spacecraft• lost $327.6 million + years of effort

• Heartbleed bug in SSL, 2012–2014• caused by missing bounds check• huge violations of privacy, including 4.5 million medical records• estimated $500 million in damage

• Steam’s Linux client deletes root, 2015• caused by silent failure of a directory lookup operation• offending line commented by “Scary!”. . . :–/

Why study programming languages? 11 / 24

Page 12: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Why good languages matter: managing complexity

Large-scale software systems are complex!

Good languages can help us manage this complexity

• “Structured programming”, 1950–1960s• problem: “spaghetti code” caused by GOTOs• solution: subroutines, conditionals, loops

• Rust programming language, Mozilla, 2010s• problem: managing memory in low-level, concurrent systems code• solution: ownership system

Why study programming languages? 12 / 24

Page 13: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Why good languages matter: medium of thought

The languages we use . . .• influence our perceptions• guide and support our reasoning• enable and shape our communication

• What problems do we see? How dowe reason about and discuss them?

• How do we develop, express, andshare solutions?

By relieving the brain of all unnecessary work, a good notation sets it free toconcentrate onmore advanced problems, and in effect increases themental powerof the race.

—Alfred North Whitehead via Kenneth Iverson’sACM Turing Award Lecture, “Notation as a Tool of Thought”

Why study programming languages? 13 / 24

Page 14: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Example: Positional number system

In the 13th century, this is how numbers were represented in Europe:

MMCDXXXI ÷ XVII = ? :-(

. . . even basic arithmetic is hard!

Fibonacci popularized the Hindu-Arabic notation• didn’t just make arithmetic much more convenient . . .• completely changed the way people thought about numbers,revolutionizing European mathematics

Why study programming languages? 14 / 24

14317

)2431170073168051510

Page 15: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Example: Symbolic logic

For over 2000 years the European study of logic focused on syllogisms

Every philosopher is mortal.Aristotle is a philosopher.Therefore, Aristotle is mortal.

Only 256 possible forms . . . field solved!

A couple of notational innovations in the 19th century cracked it wide open• George Boole – Boolean algebra• Gottlob Frege – Beggriffsschrift (symbolic predicate logic)

Why study programming languages? 15 / 24

Page 16: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Example: Feynman diagrams

Interactions of subatomic particles lead to brain-melting equations

• reasoning about interactions requires complex math• high overhead to communicating problems and solutions

Only a handful of people can do this stuff!

In 1948, Richard Feynman introduced a visual language for representing interactions

Raises level of abstraction• eliminates incidental complexity (math)• focus on essential complexity (interactions)• supports communication, collaboration(undergrads can do it)

Why study programming languages? 16 / 24

Page 17: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Domain-specific languages

Why study programming languages? 17 / 24

Page 18: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Outline

About this course

Why study programming languages?Languages are at the heart of computer scienceGood languages really matter

How to study programming languages

Course logistics

How to study programming languages 18 / 24

Page 19: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

One idea: just try out a bunch of languages

Not this course!

How to study programming languages 19 / 24

Page 20: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Our focus: programming language concepts and theory

Focus on how to define programming languages

For several toy languages, we will:• define the structure of its programs• define the meaning of its programs• identify the features that are common to many languages

How to study programming languages 20 / 24

Page 21: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Role of metalanguages

Metalanguage: a language to define the structure and meaning of another language!

In this course:• grammars• mathematics• inference rules• Haskell• English

How to study programming languages 21 / 24

Page 22: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Summary of our strategy

Focus mostly on programming language concepts1. define abstract syntax of languages2. define semantics of languages3. compare different language features4. in-depth study of lambda calculus

We use metalanguages for examining these concepts1. formal definitions using grammars, mathematics, and inference rules2. interpreters in Haskell

How to study programming languages 22 / 24

Page 23: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Outline

About this course

Why study programming languages?Languages are at the heart of computer scienceGood languages really matter

How to study programming languages

Course logistics

Course logistics 23 / 24

Page 24: CS 581: Programming Language I Course Introductionweb.engr.oregonstate.edu/~walkiner/teaching/cs581-fa19/slides/0.Introduction.pdfFocus mostly on programming language concepts 1.define

Learning strategy

“Learning pyramid”

In class• lectures• demonstrations / live coding• in-class exercises• peer-feedback/discussion ofhomework and exercises

On your own• outside reading• homework• study for quizzes, exams

Course logistics 24 / 24