5. I will not use electronic devices such as
laptops, phones, or tablets during lectures.
Experimental exception: laptop for taking notes at last row
6. I will not enter the lecture hall
once the lecture has started.
7. My answers to assignments and exams will
be my own work (except for assignments
that explicitly permit collaboration).
http://en.wikipedia.org/wiki/File:Plagiarism_vs_Copyright_Infringement.png
8. I will not make solutions to assignments and
exams available to anyone else. This includes
both solutions written by me, as well as any
official solutions provided by the course staff.
http://ucblibraries.colorado.edu/about/images/Xerox5135.jpg
9. I will not engage in any other activities that
will dishonestly improve my results or
dishonestly improve/hurt the results of
others.
11. Course Grade
Your final grade G for the course will be
computed as follows:
G = (E * 0.6) + (GA * 0.4)
where E is your grade for the exam an GA is
your grade for the graded assignments.
12. Graded Assignments
There will be four Graded Assignments.
For each you need to get at least a 4.0 to pass.
GA is the average of the four grades.
13. Exams
You can pass the exam in two ways:
Pass the midterm Q3 exam on April 9 with at least a
6.0 and then pass the Q4 exam on June 26 also with a
6.0. E is the average of two exams.
Pass the Q3+Q4 exam on June 26 with at least a 6.0
Pass the August resit with at least a 6.0
14. All assignments for this course are provided
via WebLab and should be submitted via
WebLab, including the exams.
15. Exam/Lab Grades from 2011-2012
Partial result from 2011-2012?
Discuss with me offline
(but not today)
16. Warning!
This course moves from first year to
second year in new curriculum
TI1220 will not be taught in
2013-2014
Lab & exams will be repeated,
no lectures
My advice: pass the course this year!
18. Course Staff
Instructors
• Eelco Visser Assistants
• Jeff Smits
• Vlad Vergu
• Victor Spiridon
• Tim de Jong
• Bastiaan Reijm
http://eelcovisser.org/wiki/about/officehours
27. Turing Machines
Turing/Church Thesis: Every effective
computation can be carried out by a Turing
machine (IN2505)
Corollary: All (Turing Complete) programming
languages can express all effective computations
Why bother with new programming languages?
29. Programming Languages in TI @ TUD
TI1200: Object-Oriented Programming
• Java
TI1400: Computer Systems
• Assembly
TI1500: Web- and Database Technology
• HTML, PHP, SQL, JavaScript
TI1600: Multi-Agent Systems
• Prolog, GOAL
30. “A programming language is low level when its
programs require attention to the irrelevant”
Alan J. Perlis. Epigrams on Programming. SIGPLAN Notices, 17(9):7-13, 1982.
31. From Instructions to Expressions
mov &a, &c c = a
add &b, &c c += b
mov &a, &t1 t1 = a c = (a + b) & (a - b)
sub &b, &t1 t1 -= b
and &t1,&c c &= t1
Source: http://sites.google.com/site/arch1utep/home/course_outline/translating-complex-expressions-into-assembly-language-using-expression-trees
32. From Calling Conventions to Procedures
calc:
push eBP ; save old frame pointer
mov eBP,eSP ; get new frame pointer
sub eSP,localsize ; reserve place for locals
.
. ; perform calculations, leave result in AX
.
mov eSP,eBP ; free space for locals
pop eBP ; restore old frame pointer
ret paramsize ; free parameter space and return
push eAX ; pass some register result
push byte[eBP+20] ; pass some memory variable (FASM/TASM syntax)
push 3 ; pass some constant
call calc ; the returned result is now in eAX
http://en.wikipedia.org/wiki/Calling_convention
def f(x)={ ... } f(e1)
function definition and call in Scala
33. From Malloc to Garbage Collection
/* Allocate space for an array with ten elements of type int. */
int *ptr = (int*)malloc(10 * sizeof (int));
if (ptr == NULL) {
/* Memory could not be allocated, the program
should handle the error here as appropriate. */
} else {
/* Allocation succeeded. Do something. */
free(ptr); /* We are done with the int objects,
and free the associated pointer. */
ptr = NULL; /* The pointer must not be used again,
unless re-assigned to using malloc again. */
}
http://en.wikipedia.org/wiki/Malloc
int [] = new int[10];
/* use it; gc will clean up (hopefully) */
34. Linguistic Abstraction
design abstraction
language A language B
use new abstraction
identify pattern
35. Domains of Computation
Application domains
Systems programming
Embedded software
Web programming
Enterprise software
Database programming
...
36. Why So Many Programming Languages?
Linguistic abstraction: better
understanding of the general domain of
computation
Specialization to domain: different
requirements from different application
domains
37. Why Study Programming Languages?
Language shapes thought: understand the
languages that you are using
Choosing the right language for the job
Learning to learn new languages
Understanding implementation: what’s
under the hood?
38. Topics in this Course
Syntax and Semantics
Names, Bindings, and Scopes
Storage
Data Types
Functional Programming
Type Systems 1: Polymorphism
Type Systems 2: Type Parameterization
Parsing and Interpretation
Control Abstraction
Data Abstraction / Modular Programming
Functional Programming Redux
Concurrency
Concurrent Programming
Domain-Specific Languages
41. Syntax
syntax |ˈsinˌtaks|
noun
the arrangement of words and phrases to create well-formed sentences in
a language: the syntax of English.
• a set of rules for or an analysis of this: generative syntax.
• the branch of linguistics that deals with this.
ORIGIN late 16th cent.: from French syntaxe, or via late Latin from
Greek suntaxis, from sun- ‘together’ + tassein ‘arrange.’
42. Syntax
“The syntax of a programming language is
the form of its expressions, statements,
and program units.”
Sebesta Ch3
43. Lexical vs Context-free Syntax
lexical syntax
• words made from letters
• structure not relevant
• regular expressions
context-free syntax
• sentences made from words
• structure relevant
• context-free grammars
• Backus-Naur Form
• Extended Backus-Naur Form
44. Lexemes & Tokens
Lexemes are the words that make a sentences
Tokens are the categories of lexemes
52. Syntax in this Course
You should be able to determine whether a
program is syntactically correct according to a
context-free grammar (BNF, railroad diagram)
(There will be exercises on WebLab)
57. Semantics
semantics |səәˈmantiks|
pluralnoun [ usu. treated as sing. ]
the branch of linguistics and logic concerned with meaning. There are a
number of branches and subbranches of semantics, including formal
semantics, which studies the logical aspects of meaning, such as sense,
reference, implication, and logical form, lexical semantics, which studies
word meanings and word relations, and conceptual semantics, which
studies the cognitive structure of meaning.
• the meaning of a word, phrase, sentence, or text: such quibbling over
semantics may seem petty stuff.
DERIVATIVES
semantician |ˌsēmanˈtiSHəәn|noun,
semanticist noun
58. Semantics
“The semantics of a programming language
is the meaning of its expressions,
statements, and program units.”
Sebesta Ch3
59. Static vs Dynamic Semantics
Static Semantics: (context-senstive)
restriction of the set of valid programs
Dynamic Semantics: run-time
behaviour of a program
60. Operational Semantics
Operational semantics: describe the
meaning of a statement or program by
specifying the effects of running it on a
machine
In second part of course (Q4): write
interpreter for small functional language
61. Denotational Semantics
a denotational semantics defines a mapping
from the syntactic domain to a semantic
domain of mathematical objects
<bin> -> ‘0’ | ‘1’ | <bin> ‘0’ | <bin> ‘1’
M(‘0’) = 0
M(‘1’) = 1
M(<bin> ‘0’) = 2 * M(<bin>)
M(<bin> ‘1’) = 2 * M(<bin>) + 1
63. Semantics in this Course
Informal operational semantics:
Reasoning about the operational behavior of
programs
Comparative/translational semantics:
Explaining the semantics of construct/concept
by translating it to another language
64. Reading & Programming in Week 1
Reading: Sebesta
Chapter 1: Preliminaries
Chapter 2: Evolution of the major
programming languages (read)
Chapter 3: Describing Syntax and
Semantics
WebLab: Scala Tutorial
Week 2: Names, Bindings, and Scope (Chapter 5)