Lecture 1:Wherefore CS655? CS 655: Programming Languages

advertisement
CS 655: Programming Languages
Lecture 1:Wherefore CS655?
The use of <???> cripples the mind;
its teaching should, therefore, be
regarded as a criminal offence.
Edsger W.Dijkstra, 1975
David Evans
University of Virginia
Computer Science
Office 236A, 982-2218
evans@cs.virginia.edu
http://www.cs.virginia.edu/~evans
Menu
• Course Logistics: details on Syllabus
• Goals for the Course
• Course Overview, Programming Language
Design
Don’t leave until I take your picture!
Send registration email by tomorrow
Position Paper 1 due Monday.
20 Jan 2000
CS 655: Lecture 1
2
Resources
• Staff:
– Instructor: David Evans
evans@cs.virginia.edu
Office Hours (?): Monday 1:302:30,Thursdays after class
– TA: John Haskins, Jr.
predator@cs.virginia.edu
• Email: cs655-staff@cs.virginia.edu
• Web: http://www.cs.virginia.edu/~cs655
20 Jan 2000
CS 655: Lecture 1
3
Assignments
• Assigned Readings
• Position Papers (6 or 7)
• Problem Sets (4)
– Technical questions, short answers, not much
coding
• Project
– Work in groups (2-4, solo projects only in unusual
circumstances)
– List of ideas (projects/ideas.html)
– Start thinking about this now – request teammates
on registration survey
• Oral Final Exam
20 Jan 2000
CS 655: Lecture 1
4
Position Papers
• Not book reports
• Be provocative and interesting
– Should make claims reasonable people could
disagree with
– Support your claims with technical arguments
• Writing clearly matters, writing clearly matters
• Not longer than the Declaration of
Independence (see ~cs655/papers/papertemplate.html)
20 Jan 2000
CS 655: Lecture 1
5
Position Papers Grading
grade  0
{ grade.value = 0 }
|  modifiers { grade.value = modifiers.value }
modifiers   { modifiers.value = 1 }
| + modifiers { modifiersL.value = modifiersR.value * 2 }
| - modifiers {modifiersL.value = modifiersR.value * 1/2 }
• Hard to get + (few per assignment), really
hard to get ++ (few per term), etc.
• If unhappy with grade, can submit 1 page
response. Grade can go up or down as a
result.
20 Jan 2000
CS 655: Lecture 1
6
Position Papers Logistics
• Use HTML template
• Turn in by emailing URL and copy of
contents to cs655-staff@cs.virginia.edu
• Pay attention to weird due times:
First Position Paper is due Monday at
11:59pm.
20 Jan 2000
CS 655: Lecture 1
7
How to get an A in CS655
• “Easy” way: Convince an established
language designer to make a substantive
change to a programming language
• “Hard” way
Course Project (30%) Position papers (30%)
Exam (20%)
Problem Sets (20%)
Class Participation (0%, but important)
20 Jan 2000
CS 655: Lecture 1
8
Honor Code, Schmonor Code
• Learn from your fellow students – they are
your best resource!
• Everything you turn in should be your own
• Write down who you discussed assignments
with, all external sources you used
• Be honest – you know what cheating is and
isn’t
20 Jan 2000
CS 655: Lecture 1
9
Logistics
Questions
Next: My Goals for the Course
20 Jan 2000
CS 655: Lecture 1
10
Goal #1
When you need to invent
a language (and most of
you will at some point in
your career) you will
design it, not just make it
up.
20 Jan 2000
CS 655: Lecture 1
11
What’s the difference?
Designed
Just Made Up
Examples
Esperanto, CLU English, C++
Properties
Predictable
Unpredictable
Ways to do
something
One
Many
Users
~1M, 2.5
~1B, ~1M
Moral? A bigger army beats good design every time
But, good designs can influence people with armies
20 Jan 2000
CS 655: Lecture 1
12
Goal #2
When you design your
language, you will have
sufficient knowledge of other
languages not to repeat their
mistakes, and solid enough
theory background to describe
your language well.
20 Jan 2000
CS 655: Lecture 1
13
Goal #3
You will become better at
programming and building
systems. You will think more
clearly and maybe even write
better.
A language that doesn't affect the way you think
about programming, is not worth knowing.
Alan Perlis
20 Jan 2000
CS 655: Lecture 1
14
Goal #4
Some of you will do projects
that lead to conference
papers or thesis topics. All
of you will be able to
understand nearly all PLDI
papers and many POPL
papers.
20 Jan 2000
CS 655: Lecture 1
15
Goal #5
20 Jan 2000
CS 655: Lecture 1
16
Disclaimer
• Sorry, no refunds if not all goals
are satisfied.
• Tell me your goals on the
survey.
20 Jan 2000
CS 655: Lecture 1
17
Course Overview
•
•
•
•
What is a programming language?
What makes a language important?
Design Tradeoffs
Contents of the course
20 Jan 2000
CS 655: Lecture 1
18
What is a language?
Webster:
A systematic means of communicating ideas or
feelings by the use of conventionalized signs,
sounds, gestures, or marks having understood
meanings.
Nerdy Linguist’s Definition:
A description of pairs (S, M), where S stands for
sound, or any kind of surface forms, and M stands
for meaning. A theory of language must specify the
properties of S and M, and how they are related.
20 Jan 2000
CS 655: Lecture 1
19
What is a Programming Language?
• Bruce MacLellan’s definition:
A language that is intended for the expression
of computer programs and that is capable of
expressing any computer program.
• Ravi Sethi’s definition:
Notations used for specifying, organizing, and
reasoning about computations.
• Liberal definition:
A language (according to the nerdy linguist’s
definition) intended to be read and written by
humans and processed by machines
20 Jan 2000
CS 655: Lecture 1
20
What makes a PL important?
20 Jan 2000
CS 655: Lecture 1
21
Lots of People Learn It
100
Java
HTML
1000
Eiffel
Pascal
Ada
Lisp
FORTRAN
COBOL
Tcl
C++
C
Basic
10000
No books in print:
Algol60, CLU, Simula
100000
Amazon.com sales rank for best-selling book related to language
(30 November 1999)
20 Jan 2000
CS 655: Lecture 1
22
You Can Get a Job
1000
HTML
Basic
Java
C++
100
Pascal
FORTRAN
No job listings:
Algol60, CLU, Simula
Tcl
Ada
COBOL
10
1
Monster.com job listings in Virginia matching language
20 Jan 2000
CS 655: Lecture 1
(30 November 1999)
23
Changes How Programmers Think
Influences other Languages
•
•
•
•
•
FORTRAN - use a high level language
Algol60 - program in a structured way
Simula - use classes
CLU - use data abstraction
FP - program without state
20 Jan 2000
CS 655: Lecture 1
24
Language Design as Engineering
Safety
Performance
Java, CLU
FORTRAN, BLISS, C
Ease of Use
BASIC, CLU
Ease/size of Implementation
Forth, C
Orthogonality
Safety, Simplicity
Algol68
Pascal
Simplicity
Expressiveness
Scheme
Common LISP
20 Jan 2000
CS 655: Lecture 1
25
Example:
Is assignment an expression?
• Wulf (BLISS): Of course, everything is
• Richie (C): Yes, why not
• Wirth (Pascal): No, only math-like things
are expressions
Who’s right?
What were their design tradeoffs?
20 Jan 2000
CS 655: Lecture 1
26
Language Design as Art
• Aesthetics matter
• Readability is usually more important
than Writability
– CLU vs. APL
• Intuitive meaning more important than
formal semantics
– But formal semantics necessary to make
sure we agree on intuitive meaning
20 Jan 2000
CS 655: Lecture 1
27
Language as Art: Example
HELLO: PROCEDURE
OPTIONS (MAIN);
FLAG = 0;
LOOP:
DO WHILE (FLAG = 0);
PUT SKIP DATA
('HELLO WORLD!');
END LOOP;
END HELLO;
20 Jan 2000
start_up = proc()
outstream:stream := primary_output()
for s:string in get_hello_world() do
stream$putl(outstream,s)
end
end
get_hello_world = iter() yields(string)
while (true) do yield ("Hello, World!")
end
end
CS 655: Lecture 1
28
Interaction of Art & Engineering
Example: C
void test (int x) {
while (x = 1) {
printf (“I’m an imbecile!”);
x = x + 1;
}
}
Art: use = for assignment (not :=)
Engineering: make assignments expressions,
no Boolean type, weak types, etc.
20 Jan 2000
CS 655: Lecture 1
29
Structure of the Course
• Balance between:
– History: analyze programming languages
according to design principles
– Theory: tools for analyzing and describing
what programs mean
– Research: look at current research and
discuss open problems
• Class as good as you make it:
– Come to lecture prepared to discuss
readings
20 Jan 2000
CS 655: Lecture 1
30
Course Overview
• This course is not
– A humanities course (though at times it
may seem like one)
– A theory course (though at times it may
seem like one)
– A “ripping on C++” course (though at times
it may seem like one)
• It is really about design
20 Jan 2000
CS 655: Lecture 1
31
Charge
• Don’t leave until I take your picture
• Think about projects and teams
• Send me your registration survey by
tomorrow
• Turn in position paper by Monday
midnight - be bold!
• Next time: Intro to Semantics
20 Jan 2000
CS 655: Lecture 1
32
Download