DOC PREVIEW
UW CSE 341 - Course Introduction

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE 341:Programming LanguagesAlan BorningAutumn 2005Lecture 1 — Course IntroductionCSE 341 Autumn 2005, Lecture 1 1Welcome!We have 10 weeks to learn different paradigms and fundamentalconcepts of programming languages.With diligence, patience, and an open mind, this course makes you amuch better programmer (in languages we won’t use).Today in class:• Course mechanics• Course overview and a rain-check on motivation• Dive into ML (homework 1 available on the course we b)In the next 24 hours:• Join the class mailing listhttp://www.cs.washington.edu/education/courses/cse341/05auCSE 341 Autumn 2005, Lecture 1 2CreditsThis version of the course is heavily based versions by Dan Grossman,Hal Perkins, Keunwoo Lee, Larry Ruzzo, and others. Look at previouscourse webs for a good idea of where we’re going.CSE 341 Autumn 2005, Lecture 1 3Who and What• 3 class meetings (slides, code, and questions)– Material on-line (subject to change), but take notes.• 1 section (Jonah Cohen)– Essential material on tools, style, examples, language-features,...• Office hours (Jonah, Chester, me)– Use them!!!• Course “dictionary” online– To help with terminology; feedback welcomeCSE 341 Autumn 2005, Lecture 1 4Homeworks• Approximately 6–8 total• Doing the homework involves:1. Understanding the concepts being addressed2. Writing code demonstrating understanding of the concepts3. Testing your code to ensure you understand4. “Playing around” with variations, incorrect answers, etc.You turn in only (2), but focusing on (2) makes the homeworkharderCollaboration: The Gilligan’s Island RuleExtra Credit: Terrible use of your time grade-wise, but great otherwiseCSE 341 Autumn 2005, Lecture 1 5Exams• Midterm: Nov 2, in class• Final: 8:30-10:20 a.m. Thursday, Dec 15, 2005 (comprehensive)Same concepts, but very different format from homework. Open bookand notes.CSE 341 Autumn 2005, Lecture 1 6Now where were we?Meetings, homeworks, and exams. . . about what?Programming languages:• Essential concepts relevant in any language• Specific examples “in natural setting” using ML, Scheme, andSmalltalk• Focus on “functional languages” because they are simpler, verypowerful, and teach good practicesFirst half of course uses ML:• Gives us time to build knowledge before “starting over”• But we need to get comfortable with the basics and environmentas soon as possible• “Let go of Java” for now (we will return to it)CSE 341 Autumn 2005, Lecture 1 7A strange environmentThe ML part of the course uses:• The emacs editor• A read-eval-print loop for evaluating programs• Available on Windows and UNIX in the lab, but remotely viaUNIX — also can be installed on your own Windows, Linux, or OSX machineWe have prepared “getting started” materials, but leave plenty of timefor the content of homework 1.• Read the materials• Attend section• Then ask questions fast (wasted hours are wasted hours)Adjusting to new environments is a “CS life skill”CSE 341 Autumn 2005, Lecture 1 8Before we dive inWe’ll return to the course goals and “why learn something other thanC/C++/Java/Perl” next week or so.(There are many good reasons, too important for the first day.)CSE 341 Autumn 2005, Lecture 1 9ML, from the beginning• Two key concepts: bindings & environment• A program is a sequence of bindings• One kind of binding is a variable bindingval x = e ; (semicolon optional in a file)• A program is evaluated by evaluating the bindings in order• A variable binding is evaluated by:– Evaluating the expression in the environment created by theprevious bindings. This produces a value.– Extending the (top-level) environment to bind the variable tothe value.Much easier to understand with an example...CSE 341 Autumn 2005, Lecture 1 10That was a lot at once• Values so far: integers, true, false, ()• Non-value expressions so far: addition, subtraction, less than,conditionals• Types: every expression has a type. So far, int, bool, unit• The read-eval-print loop:– Enter a sequence of bindings. For each, it tells you the valueand type of the new binding– If you just enter e;, then that is the same as val it = e;– use "foo.sml" enters the bindings in a file, and then bindsit to (), which has type unit– Ignore messages like “GC #0.0.0.0.1.18: (0 ms)”– Expressions that don’t type-c heck lead to (bad) error messagesand no change to the environmentCSE 341 Autumn 2005, Lecture 1 11Parts worth repeatingOur very simple program demonstrates many critical languageconcepts:• Expressions have a syntax (written form)– E.g.: A constant integer is written as a digit-sequence– E.g.: Addition expression is written e1 + e2• Expressions have types given their context– E.g.: In any context, an integer has type int– E.g.: If e1 and e2 have type int in the current context, thene1+e2 has type int• Expressions evaluate to values given their environment– E.g.: In any environment, an integer evaluates to itself– E.g.: If e1 and e2 evaluate to c1 and c2 in the currentenvironment, then e1+e2 evaluates to the sum of c1 and c2CSE 341 Autumn 2005, Lecture 1 12More expression formsWhat are the syntax-rules, typing-rules, and evaluation-rules for:• variables• less-than comparisons• conditional expressionsCSE 341 Autumn 2005, Lecture 1 13Lots more to doWe have many more types, expression forms, and binding forms tolearn before we c an w rite “anything interesting”.Must develop resilience to mistakes and bad messages. Examplegotcha: x = 7 instead of val x = 7.For homework 1: functions, pairs, lists, options, and local bindings(earlier problems require less)But there are some things we will not add:• mutation (a.k.a. assignment): changing the value of anenvironment binding– make a new binding instead• statements: expressions will do just fine, thank you• loop-constructs: recursive functions are more powerfulCSE 341 Autumn 2005, Lecture 1 14What is a programming language?Here are separable concepts for defining and evaluating a language:• syntax: how do you write the various parts of the language?• semantics: what do programs mean? (One way to answer: whatare the evaluation rules?)• idioms: how do you typically use the language to expresscomputations?• libraries: does the language provide “standard” facilities such asfile-access, hashtables, etc.? How?• tools: what is available for manipulating programs in thelanguage? (e.g.,


View Full Document

UW CSE 341 - Course Introduction

Documents in this Course
Macros

Macros

6 pages

Macros

Macros

6 pages

Macros

Macros

3 pages

Mutation

Mutation

10 pages

Macros

Macros

17 pages

Racket

Racket

25 pages

Scheme

Scheme

9 pages

Macros

Macros

6 pages

Load more
Download Course Introduction
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Course Introduction and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Course Introduction 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?