Compiler Construction

CSC/CPE 430 Programming Languages I

Summer 2023

Lecture:

Wednesday, 10:00-11:30,R 0.058

Lab:

1 Tuesday, 13:30-15:00,R 2.012
2 Tuesday, 15:15-16:45,R 2.012
3 Wednesday, 13:30-15:00,R 3.026

Lab Software:

We will use a Linux system.

Most of the software is already installed by default. You need to have the following packages:

For the lab work, you can use a devbox as described below.

The devbox setup

If you do not have a dev box, do the following: To set up the devbox virtual linux box in the lab do the following: The software should be all in the current base system.
  • 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 shut down your Linux machine use "mit ACPI-Event herunterfahren" or otherwise you might loose the changes you made.

    Lab Schedule:

    March 21/22 Introduction to PostScript
    March 28/29 Introduction to lex/flex
    April 4/5 Introduction to yacc/bison: Keywords
    April 18/19 Numbers
    April 25/26 Make see: Sample Code
    May 2/3 Arithmetic
    May 9/10 Union declaration and Floating Point Numbers
    May 16/17 Variables see: Video Sommer 2022
    May 23/24 Control Structures see: Sample Code
    June 6/7 Local Variables
    June 13/14 Procedures
    June 20/21 Testat/Final Project
    June 27/28 Testat/Final Project
    July 4/5 Testat/FinalProject

    There are videos available from the summer semester 2022 implementing the programming language KLX.

    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

    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.

    The final goal is to develop your own language and your own compiler for Turtle Graphics. For more details on the Lab assignment read this page on "A Programming Language for Turtle Graphics.

    Some Remarks on Turtle Graphic

    Turtle graphic was originally part of the programming language LOGO, a programming language designed for children. Recently this idea led Microsoft to implement the Turtle App, a Windows app that lets kids drag and drop commands to create their own turtle programs. Check it out!

    An Introduction (in Deutsch) can be found on the Code your Life: TurtleCoder site. You will find there also the TurtleCoder as a Web-App

    A big collection of possible turtle programs with an image gallery is found at the Turtle Art site. You find more information on turtle graphic on wikipedia

    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.

    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.