TDDB44 Compiler Construction
Rules for examination of computer lab assignments at IDA
You are expected to do lab assignments in group or individually, as instructed for a course. However, examination is always based on individual performance.
It is not allowed to hand in solutions copied from other students, or from elsewhere, even if you make changes to the solutions. If there is suspicion of such, or any other form of cheating, teachers are obliged to report it to the University Disciplinary Board.
Be prepared to answer questions about detailes in specific code and its connection to theory. You may also be asked to explain why you have chosen a specific solution. This applies to all group members.
If you foresee problems meeting a deadline, contact your teacher. You can then get some help and maybe the deadline can be set to a later date. It is always better to discuss problems, instead of, e.g., to cheat.
Any kind of academic dishonesty, such as cheating, e.g. plagiarism or use of unauthorized assistance, and failure to comply with university examination rules, may result in the filing of a complaint to the University Disciplinary Board. The potential penalties include suspension, warning.
Policy for handing in computer lab assignments at IDA
For all IDA courses having computer lab assignments there will be one deadline during or at the end of the course. If you fail to make the deadline, you must retake the, possibly new, lab course the next time the course is given.
If a course deviates from this policy, information will be given on the course web pages.
The laboratory exercises are performed in groups of two students, 8 groups per Sun-laboratory. Last date for sign up is 11/11 - 2012. The lab material is quite extensive and will not be presented on these web pages. See the course literature section on the start page.
To be able to solve the laboratory assignments on time you must be well prepared for every laboratory exercise. Past experience has shown that the amount of work involved is often underestimated.
There are 7 separate parts of the compiler to complete in 11x2 hours in the computer laboratories.
The Laboratory Compendium
The TDDB44 Laboratory compendium is available at Bokakademin.
The aim of this laboratory assignment is to implement a compiler for a simple imperative language (DIESEL) in C++, using modern tools to help generate parts of the code. The work is estimated to take about 80 hours (based on statistics from 1998). The compiler is to be written in the following order and to comprise the following parts:
- Scanner - manages lexical analysis.
- Symtab - administrates the symbol table.
- Parser - manages syntactic analysis, builds internal form.
- Semantics - checks static sematics.
- Optimizer - optimizes the internal form.
- Quadruples - generates quadruples from the internal form.
- Codegen - expands quadruples to assembler.
The parser, semantic, quads and codegen parts are the ones likely to take the most time, so try to get the scanner and symbol table labs done the first week. Skeleton code will be provided for all the labs, and in most cases you will simply keep on adding code to what you wrote in the previous lab. The skeleton contains declarations of central data-structures and support routines; in other words, a lot of the boring work has already been done for you. The aim is to let you concentrate on the essential details.
xxgdb can be recommended for fault-finding; it is window-based and very useful. There are other debuggers available as well.
This compendium starts by describing DIESEL 4.0 in the way it would be presented to a fictitious user. Then an overview of the compiler follows which hopefully gives an idea of what the various phases do. After this come the various parts of the lab work, where each phase is described in a section of its own. These are usually introduced by some theory from the lectures, which it is generally a good idea to read up on before starting the lab work. When a phase has been completed and tested, report to the assistant and then continue with the next one.
The deadline for the labs is the end of the lecture period 13/12 - 2012. You will get 3 exam points if your labs are completed by this date.
While it will still be possible to submit your lab report to your lab assistant afterwards, we then cannot guarantee that your lab points will be counted as a 2012 result, as we have to prioritize the correction of the exam.
Page responsible: Sergiu Rafiliu
Last updated: 2012-10-31