Compiler Construction
CSC/CPE 430 Programming Languages I
Summer 2022
Lecture:
Wednesday, | 10:00-11:30, | R 1.006 |
Lab:
1 | Tuesday, | 13:30-15:00, | R 2.009 |
2 | Tuesday, | 15:15-16:45, | R 2.009 |
3 | Tuesday, | 11:45-13:15, | R 2.009 |
Lab Software:
We will use the virtual Linux system installed on the Lab PC's.
In addition to the software already installed by default,
you need to install the following packages:
- text editor of your choice,
- C compiler, for example gcc,
- bison,
- flex,
- libfl, the flex library,
- PostScript viewer.
Lab Schedule:
March 22 | Introduction to PostScript | teil1.mp4 |
March 29 | Introduction to lex/flex | teil2.mp4 |
April 5 | Introduction to yacc/bison: Keywords | teil3.mp4 |
April 12 | Numbers | teil4.mp4 |
April 26 | Make | teil5.mp4 |
May 3 | Arithmetic | teil6.mp4 |
May 10 | Variables and Floating Point Numbers | teil7.mp4 |
May 17 | Control Structures | teil8.mp4 |
May 24 | Local Variables | teil9.mp4 |
June 14 | Procedures | teil10.mp4 |
June 20 | Testat/Final Project | |
June 27 | Testat/Final Project | |
July 4 | Testat/FinalProject | |
Lab Assignments:
Each lab class starts with an introduction by the instructor
giving you a distinct assignment for each class. Because of this
format, it is usually difficult for a student to catch up, if he
or she has missed one of the lab sessions. There are however
three different time slots available for the lab.
If you have to miss a lab class, let me know early, probably
I can assign you to a different time slot.
For the lab work, it is recommended to use the virtual Linux machine on
the lab computers. To set them up do the following:
- Read the Readme.pdf file under C:\\VB-Images\MWN-Linux.
- Use the CreateVM.bat file to create your own Linux machine.
- Start your new Linux machine.
- In the Menu select System->Sytemverwaltung->Synaptic-Paketverwaltung.
Use the Search field to find and select for installation the following
additional packets:
- flex and flex-doc
- bison
- ghostscript-x and ghostscript-doc
Click on Apply to install the selected software.
The base ghostscript, the gcc compiler, atril (a postscript viewer),
and pluma (an editor) are already present. This is all the software
we will need.
- You may want to mount your MWN network drive automatically by
editing /etc/fstab; if so, add the option cifsacl
which will help the system to tell executable files from non-executable
files. This part of the file system is a good place to store
your work. You can access this work remotely
(see MWN-Speicher verbinden).
- Now it's time to select in the Menu Maschine->Sicherungspunkt erstellen
to keep a snapshot of your new machine with everything installed and set
up.
- When you shout down your Linux machine use "mit ACPI-Event herunterfahren"
or otherwise you might loose the changes you made.
The lab sessions start always with an introduction that is available
live or as a recording on
BBB.
The final goal is
to develop your own language and your own compiler as described
in the following Problem:
Lab attendance certificate (Schein):
The lab attendance certificate (Schein) is a required prerequisite for taking
the final exam. You obtain this certificate (in spite of the name) not just
because you attended the lab sessions; to obtain it, you have to demonstrate
your ability to use lex/flex and yacc/bison to write and modify your compiler.
While you will write - during the lab sessions - your own compiler, it is
a misunderstanding to believe that the lab certificate is granted based on
the compiler you wrote. It is based on what you learned while you wrote it!
In practice, I will look at the compiler you wrote and give you a small challenge,
like "how about adding feature ... to your compiler?" From what you do to
implement the new feature, I can tell what you have learned.
Symboltable:
An implementation of the symbol table is found in the files:
symtab.h and
symtab.c.
LR(k) Parsing:
An example grammar illustrating the parsing of expressions
(including an example for reduce/reduce conflicts)
is found in
expression.zip.
Readings:
Skript (deutsch):
Es gibt zur Vorlesung ein unvollständiges Skript (deutsch), das hier
zu finden ist:
skript.pdf.
PostScript:
A First Guide to PostScript
by Peter J. Weingartner.
Thinking in PostScript
by Glenn C. Reid.
the ultimate PostScript Language Reference
by Adobe,
or a Short Summary of PostScript by me
(also available in German: Kurze Zusammenfassung von Postscript).
Regular Expressions:
An Introduction to regular Expressions from the gawk manual in
HTML or
PostScript.
Lexical Analyzer Generator flex:
The flex manual in
HTML or
PostScript.
Parser Generator bison:
The Bison Reference Manual in
HTML or
PostScript.
Further Manuals:
Many useful manuals for GNU/UNIX tools
(for example make)
you find at www.gnu.org/manual.
Last not Least...
The Dragon Book:
Aho,Sethi,Ullman,
Compilers, Principles,Techniques and Tools,
Addison Wesley.
|
|