AMP-Spring2010
From PLSwiki
This is the course page for Advanced Models and Programs (SASP), spring 2010.
Contents |
Practical and administrative matters
Teachers
- Peter Sestoft (PS)
- Joe Kiniry (JK)
Support
Questions about the course contents, particularly the second half focusing on dependable software development, should be asked in the AMP Blog.
Format
The course starts on Monday 25 January 2010 at 0830.
In the first week, we meet Monday 25 January 0830-1030 in room 2A18 and on Friday 29 January 1100-1300 in room 2A14. After that first week, the plan is as follows:
- Monday 0830-1030 in room 4A16 and 1045-1245 in room 2A52
- Friday 1100-1300 in room 2A14 and 1345-1545 in room 2A52
The course period is 16 weeks half time (15 ects). The course will consist of blocks, covering different themes, with weekly lectures and exercises; and a substantial six-week group project within one of the themes, resulting in a project report.
Week-to-week exercises
The weekly exercises must be handed in, and at least 8 of the 10 exercises must be approved to pass the course. You are allowed to work in groups to solve the exercises, but each individual student must write his/her solution up individually and hand it in by him/herself.
Here is the List of Approved Weekly Exercises.
Final project
The project must be done in groups (2-4 people in each group) and the project report must be presented in an oral exam, where questions may be asked in all themes of the course.
As stated above, and in keeping with the course learning outcomes, the project must be documented by a project report. Here is some advice on report writing.
For an explanation of how to hand in the final project, see the ITU Intranet.
Here is the List of Project Submissions.
Examination
UPDATE 2010-06-08 Here is the exam schedule version 3. The exam takes place in auditorium 4 on Tue 15 June and in room 3A18 on Wed 16 June. Both rooms have projector, a laptop, and blackboard.
The official course description says:
"The project report must be presented in an oral exam, where questions may be asked in all themes of the course. A single grade is given, based on the project and the oral exam."
and
"Ekstern censur, [7-trinsskala], B4: Mundtlig eksamen med skriftlige arbejder men uden forberedelsestid ved eksamen."
We allow a total of 15 minutes for project presentation (by the whole group) and feedback followed by 15 minutes of individual examinations of each student. The individual examinations will cover both the project and all other aspects of the course. The official explanation, found at the ITU intranet, says (in Danish):
"Projekter udarbejdet i gruppe afsluttes med en fælles præsentation umiddelbart før afholdelse af eksamen. Denne præstation er ikke en del af eksamen. I skal være opmærksom på at ved den efterfølgende eksamination eksamineres alle gruppemedlemmer i hele gruppeopgaven.
Hvis en mundtlig eksamen tager udgangspunkt i en rapport eller et skriftligt arbejde, som er udarbejdet af flere studerende, må hvert gruppemedlem først være til stede i eksamenslokalet, når gruppemedlemmet selv skal eksamineres."
UPDATE 2010-05-03 Here is the exam syllabus, or "pensum", the material in which we may ask questions in addition to the project:
For the meaning of the paper references below, see the Literature and Materials section of this course homepage.
- The Scala tutorial
- Overview of the Scala Programming Language
- Mogensen: Basics of compiler design, DIKU 2009, sections 2.1-2.9 and 3.1-3.6.
- Coco/R User Manual pages 1-17, 23-28
- Sestoft: Programming Language Concepts for Software Developers, chapters 1, 2, 3, 7, 8, 9, 10, 14
- Kernighan and Ritchie: The C programming language, chapter 5.
- Sestoft: Numeric performance in C, C# and Java, 2010
- Dybvig: The Scheme Programming Language, MIT 2003, sections 2.1-2.7, 6.1
- WaldenNerson94 chapters 1-8
- BurdyEtal02
- LeavensBakerRuby99
- LeavensEtAl00
- LeavensEtAl05
- CheonLeavens02
- KiniryCok04
- ChalinEtAl05
- KiniryZimmerman08
- KiniryZimmerman09
- Schwartzbach: Lecture notes on static analysis, chapters 1-6
- All lectures slides
- All mandatory exercises
- In addition the following materials are "kursorisk pensum", that is, relevant background material but not something we will be asking detailed questions about in the oral exam: PaigeOstroffFM99, PaigeOstroffUML99, JanotaGrigoreMoskal07, LeavensCheon06
Exam date
CHANGE The oral exam will take Tuesday 15 June and Wednesday 16 June 2010. This is to ensure that we can use the same external examiner as previous years.
Intended Learning Outcomes
The course has two parts as detailed under course form below - a regular course followed by a project.
After the course, the students are expected to be able to:
- describe relevant concepts within the themes of the course,
- account for the practical applications of the covered constructs, and
- compare selected techniques and constructions within a single of the course themes.
On the basis of the project, the student are expected to be able to:
- apply relevant methods and techniques in the chosen project
- argue for the overall design-decisions in the project, and
- relate project and theory.
See also the official course description.
Course content
Themes
The themes covered in the course include
- Programming language concepts
- C# and how it differs from Java
- Lexing, parsing and compilation: From source code to abstract syntax to stack machine code
- Functional programming in C#, Scala and Scheme
- Program generation, quasi quotations, program specialization
- Applied formal methods in practice
- Program specification and verification with BON, JML, and Java
- Static analysis; in particular, data-flow analysis
Plan
| Week | Date | Teacher | Topic | Materials | Assignments |
|---|---|---|---|---|---|
| 04 | Mon 25 Jan | PS | C# vs Java: non-virtual methods, properties, indexers, operator overloading, value types, enum types, reference parameters. Slides PS1 | Sestoft: C# Precisely, MIT Press 2005, or any later C# book, or online materials | Assignment 1 |
| Fri 29 Jan | PS | C# vs Java: iterator blocks, generic types and methods, anonymous methods, C# 3.0: inferred types, extension methods, ... Slides PS2 and Slides PS3 | Sestoft: C# Precisely, MIT Press 2005, or any later C# book, or online materials | ||
| 05 | Mon 1 Feb | PS | C# 3.0: anonymous objects, object and collection initializers, Linq; default parameters, named arguments, variance in type parameters, the type dynamic | C# 3.0 language specification, 2007 (MS Word format) | Assignment 2 |
| Fri 5 Feb | PS | Scala: object-oriented and functional programming combined, traits, ... Slides PS4 | Read the Scala tutorial and the Overview of the Scala Programming Language (links below), or, if you get really excited, get the book Odersky, Spoon, Venners: Programming in Scala, Artima 2008 | ||
| 06 | Mon 8 Feb | PS | Abstract syntax, interpretation and checking; lexing and parsing ... Slides PS5 | Mogensen sections 2.1-2.9 and 3.1-3.6. Sestoft PLCSD chapters 1-3. | Assignment 3 |
| Fri 12 Feb | PS | Grammar transformations, compilation and stack machines ... Slides PS6 | Coco/R User Manual pages 1-17, 23-29. Sestoft PLCSD chapters 1-3 and 8.2. | ||
| 07 | Mon 15 Feb | PS | Micro-C and pointers. Slides PS7 | Kernighan and Ritchie chapter 5. Sestoft PLCSD chapters 7-8. | Assignment 4 |
| Fri 19 Feb | PS | Bytecode, abstract machines, and real machines. Slides PS8 | Sestoft PLCSD chapters 9-10. Sestoft: Numeric performance in C, C# and Java. Ecma-335 CLI standard, partition I, section 12.3. | ||
| 08 | Mon 22 Feb | PS | Scheme, multi-stage programs Slides PS9 | Dybvig sections 2.1-2.7, 6.1. Sestoft PLCSD chapter 14. | Assignment 5 |
| Fri 26 Feb | PS | Partial evaluation, runtime code generation. Slides PS10 | Sestoft PLCSD chapter 14. | ||
| 09 | Mon 1 Mar | PS | Student presentations of several interesting languages: Python by Rasmus; and Erlang by Matyas; and F# by Sune; and Haskell by David. | Assignment 6 | |
| Fri 5 Mar | JK | Background, Business Object Notation, and Analysis (Example Projects, Effective Use of Formal Methods, The Business Object Notation, Dependable Systems Analysis) Slides JK1 | PaigeOstroffFM99, PaigeOstroffUML99, Chapters 1, 2, 6, 7, and 8 of WaldenNerson94 | ||
| 10 | Mon 8 Mar | JK | Specifications (Assertions and Specifications, Contracts and Specifications in BON and JML) Slides JK2 | Chapters 3, 4, 5 of WaldenNerson94, BurdyEtal02 | |
| Fri 12 Mar | JK | JML (Introduction to JML, Applying BON to Java and JML), Static Analysis (Code Standards and Metrics, Static Analysis for Software Construction) Slides JK3 Slides JK-JML | LeavensBakerRuby99, LeavensEtAl00, LeavensCheon06, LeavensEtAl05 | Assignment 7 | |
| 11 | Mon 15 Mar | JK | Validation (Testing, Types of Testing, Unit Testing, Testing in Practice, Testing with Specifications) Slides JK5 | CheonLeavens02 | |
| Fri 19 Mar | JK | Verification (Kinds of Verification, Details of a Verification Tool, Model Checking, Using Verification Effectively) Slides JK6 | KiniryCok04, ChalinEtAl05, JanotaGrigoreMoskal07, KiniryZimmerman08, KiniryZimmerman09 | Assignment 8 | |
| 12 | Mon 22 Mar | JK | Using ESC/Java2, Models in JML, Hints and Tips for Verification Slides JK7 JK8 JK9 | ||
| Fri 26 Mar | JK | No lecture, only lab session. | Assignment 9 | ||
| 13 | Mon 29 Mar | Easter | |||
| Fri 2 Apr | Easter | ||||
| 14 | Mon 5 Apr | Easter | |||
| Fri 9 Apr | JK | 1100-1125 Project proposal presentations. 1125- Undecidability, Static Analysis, Data-Flow Analysis, and Control-Flow Graphs. | Slides Lecture Notes Chapters 1, 2, and 5; i.e., pages 3-6 + 15-17. | ||
| 15 | Mon 12 Apr | JK | "Extraterrestrial Mathematics" (which we need for Data-Flow Analysis) | Slides How to solve recursive equations Lecture Notes Chapter 4; i.e., pages 11-15. | Assignment 10 |
| Fri 16 Apr | JK | Data-flow Analyses in practice; we'll study examples. | Slides Lecture Notes Chapter 6; pages 17-19 + 28-32. | ||
| 16 | Mon 19 Apr | Projects | |||
| Fri 23 Apr | Projects | ||||
| 17 | Mon 26 Apr | Projects | |||
| Fri 30 Apr | Projects | ||||
| 18 | Mon 3 May | Projects | |||
| Fri 7 May | Projects | ||||
| 19 | Mon 10 May | Projects | |||
| Fri 14 May | Projects | ||||
| 20 | Mon 17 May | Projects | |||
| Fri 21 May | Projects | ||||
| 21 | Mon 24 May | Project reports must be handed in no later than 15:00 on Tuesday 25 May | |||
Literature and materials
Lecture Recordings
Recordings of Joe's lectures are now being made available as podcasts via the temporary URL: http://www.itu.dk/stud/mediabase/public/podcast/2010/BON/index.html
On C# 3.0 and 4.0 and Scala
- To compile and run C# programs, you can use Visual C# Express 2008 or Visual C# Express 2010 beta or Mono (especially for Linux and MacOSX
- To compile and run Scala programs, Download and install Scala (you'll need a java runtime).
- To learn Scala, start with a Scala tutorial.
- Then read An Overview of the Scala Programming Language, which is a short but rather dense walkthrough of the features of Scala. But note that the paper is from 2006 and the syntax used in some examples is now outdated.
- Scala library documentation online
On compilation and abstract machines
- Torben Mogensen: Basics of compiler design
- Coco/R lexer and parser generator, User Manual pages 1-17, 23-28
- Peter Sestoft PLCSD: Programming Language Concepts for Software Developers, version 0.45, November 2009, PDF and PDF 2up.
- Here is a zip-file of all zip-files of example files for Programming Language Concepts.
- Expressions.ATG, lexer and parser specification for simple expressions
- Expressions.cs, interpreter, checker, compiler for simple expressions
- Machine.cs, stack machine to evaluate compiled expressions and execute compiled micro-C programs
- ex1.txt, a tiny "program" in the expression language
- A Makefile for Assignment 3 with Mono and Linux, thanks to Martin Kjeldsen.
- Kernighan & Ritchie: The C Programming Language, 1988, pages 93-110. (About pointers and pointer arithmetics). This will be handed out in paper form.
- MicroC.ATG, lexer and parser specification for micro-C
- MicroC.cs, interpreter, checker and compiler for micro-C
- test-c.zip, a bunch of micro-C test programs and an input file a.in
- Selsort.cs and Selsort.java, programs for Assignment 4
- GenericExample.cs and GenericExample.java, programs for Assignment 4
- Ecma-335 Common Language Infrastructure specification, the standardization of Microsoft CLR and Microsoft Intermediate Language, June 2006; the PDF file contains a detailed description of the .NET bytecode instructions
- Jeffrey Richter: CLR via C#, Microsoft Press 2006, pages 3-22.
- Lindholm and Yellin: The Java Virtual Machine specification, Addison-Wesley 1999
- Peter Sestoft: Numeric performance in C, C# and Java, ITU 2010.
- The Intel x86 machine code is described in two documents: Intel® 64 and IA-32 Architectures Software Developer's Manual 2009 Volume 2A: Instruction Set Reference, A-M and Volume 2B: Instruction Set Reference, N-Z. Warning: This is 1650 pages in total.
- A more compact description of x86 instructions is found in appendix B of the manual for the open source x86 assembler "nasm"
- Example assembly language programs (x86, Linux, Windows, MacOS): nasm-examples.zip
- x86-64 Machine-Level Programming notes by Bryant and O'Hallaron, CMU.
- The PLT Scheme/DrScheme system, available for multiple platforms. First time you use it, configure: Language > Choose language > Legacy Languages > Pretty Big. To time evaluation of expression e, evaluate (time e).
- The SCM system by Aubrey Jaffer. Neat and simple system, especially for Linux; slightly more complicated to install under Windows.
- R Kent Dybvig: The Scheme Programming Language, MIT Press 2003
- Jones, Gomard, Sestoft: Partial Evaluation and Automatic Program Generation, Prentice-Hall 1993.
- RTCG2D2.cs, an example of runtime bytecode generation in .NET
On program analysis
- Michael I. Schwartzbach: Lecture Notes on Static Analysis, BRICS research center, Uni. Aarhus.
- Claus Brabrand: How to Solve Recursive Equations (of monotone functions over lattices), ITU, April 3, 2008.
On the Business Object Notation
- [BonMethodWebsite] The BON Method website (http://www.bon-method.com/)
- [Walden98] Kim Waldén, Business Object Notation (BON). Chapter 10 of the Handbook of Object Technology, CRC Press, 1998.
- [PaigeOstroffFM99] Richard Paige and Jonathan Ostroff, Developing BON as an Industrial-Strength Formal Method. LNCS 1708, Proceedings of Formal Methods '99, 1999.
- [WaldenNerson94] Kim Waldén and Jean-Marc Nerson, Seamless Object-Oriented Software Architecture: Analysis and Design of Reliable Systems. Prentice-Hall, 1994.
- [PaigeOstroffUML99] Richard Paige and Jonathan Ostroff, A Comparison of the Business Object Notation and the Unified Modeling Language. LNCS 1723, Proceedings of UML'99---The Unified Modeling Language, 1999.
On the Java Modeling Language (JML) and Verification
- [BurdyEtal02] Lilian Burdy, Yoonsik Cheon, David Cok, Michael Ernst, Joe Kiniry, Gary Leavens, K. Rustan M. Leino, and Erik Poll, An overview of JML tools and applications. International Journal on Software Tools for Technology Transfer, 2005. (Available via SpringerLink in ITU's digital library.)
- [LeavensEtAl00] Gary Leavens, K. Rustan M. Leino, Erik Poll, Clyde Ruby, and Bart Jacobs. JML: notations and tools supporting detailed design in Java. Technical report #00-15, Iowa State University, 2000.
- [LeavensCheon06] Gary Leavens and Yoonsik Cheon. Design by Contract with JML.
- [LeavensEtAl05] Gary Leavens, Yoonsik Cheon, Curtis Clifton, Clyde Ruby, and David Cok. How the design of JML accommodates both runtime assertion checking and formal verification. Science of Computer Programming, vol. 55, issues 1-3, March 2005.
- [CokKiniry05] David Cok and Joe Kiniry. ESC/Java2: Uniting ESC/Java and JML. LNCS 3362, Proceedings of CASSIS'04, 2005.
- [LeavensBakerRuby99] Gary Leavens, Albert Baker, and Clyde Ruby. JML: A Notation for Detailed Design. Chapter 12 of Behavioral Specifications for Businesses and Systems, Kluwer Academic Publishers, 1999.
- [CheonLeavens02] Yoonsik Cheon and Gary Leavens. A simple and practical approach to unit testing: The JML and JUnit way. LNCS 2374, Proceedings of ECOOP'02, 2002.
- [KiniryCok04] Joseph Kiniry and David Cok. "ESC/Java2: Uniting ESC/Java and JML". Proceedings of CASSIS 2004.
- [ChalinEtAl05] Patrice Chalin, Joseph Kiniry, Gary T. Leavens, and Erik Poll. "Beyond Assertions: Advanced Specification and Verification with JML and ESC/Java2". The 4th International Symposium on Formal Methods for Components and Objects (FMCO 2005). Amsterdam, The Netherlands. November, 2006.
- [JanotaGrigoreMoskal07] Mikoláš Janota, Radu Grigore, and Michał Moskal. "Reachability Analysis for Annotated Code". The 6th International Workshop on the Specification and Verification of Component-based Systems (SAVCBS 2007). Dubrovnik, Croatia. September, 2007.
- [KiniryZimmerman08] Joseph Kiniry and Daniel Zimmerman. "Secret Ninja Formal Methods". The 15th International Symposium on Formal Methods (FM 2008). Turku, Finland. May, 2008.
- [KiniryZimmerman09] Joseph Kiniry and Daniel Zimmerman. "A Verification-centric Software Development Process for Java". The 9th International Conference on Software Quality (QSIC 2009). Jeju, Korea. August, 2009.
Course project proposals
Project proposals will be presented in the Friday 9 April lecture 1100-1125.
Proposed by Peter Sestoft:
- Project presentation slides from 9 April 2010
- Change the MicroC compiler to generate x86 code in the form of input for the NASM assembler.
- Extend the MicroC compiler to handle more of real C, such as struct types, switch, break, continue, malloc/free.
- Do a survey of Java or .NET virtual machine technology, for instance IBM JVM papers (Suganuma) and more recent work, Bak's contributions to Sun Hotspot, the Mono implementation, previous Smalltalk VM work and so on. Start with Aycock's survey from 2003.
- Write an interpreter -- in Scala, Standard ML, F#, Scheme, Java or C# -- for a substantial subset of the Icon language, or for SETL or another "unusual" language. See PLCSD chapter 11.
- Study garbage collectors for virtual machines, in particular Java and .NET; e.g. Bacon's recent work for the IBM JVM.
- Performance engineering for a managed platform (JVM, .NET) and modern x86 cpus. Consider either numeric intensive code (matrix multiplication), or object-intensive code such as the C5 collection library. Investigate bottlenecks using profiling, and experiment with alternative implementations and target platforms.
- Write a generator of specialized methods in C# (for instance, serialization and deserialization methods to XML or Json).
- Consider partial evaluation of spreadsheet-defined functions in the context described here (research).
- Here are some other project proposals, many of which are related to the course focus.
Proposed by Claus Brabrand:
- Make a Data-Flow Analysis and implement it such that it can analyze (and optimize) programs written in (a subset of) some familiar language (e.g., Java, C#, ...)
- Slide with proposal
Proposed by Joe Kiniry:
- See the Project Proposals section of my research group's website for the moment.
Proposed by Andrzej Wasowski:
- Project presentation slides from 9 April 2010
