CS403: Programming Languages

Pretty Printer Module

Version 2
Printable Version

Building a pretty printer

This is your fifth module for your Designer Programming Language assignment. You may develop your code using any of the allowed procedural language, but you must ensure it runs correctly under Linux before submission.

Your task is to write a pretty printer for your language. A pretty printer reformats a source code file in a pleasing manner. For this task, however, your pretty printer output can be quite ugly, as long as it is correct. Start be reading this.

Note: unlike the other milestones, this milestone will be worth up to 2 extra credit points added to your final percentage.

Coding Standards

Coding standards are as before.


Specifically, you are to write a pretty printer for your language. One should be able to run the pretty printer on a file consisting of a single program by typing in the command:
    $ pp FFFF
where FFFF is the name of the file to be reformated.

You should supply a three short test cases. Your README file should specify which test cases result in which outputs. One should be able to run the tests with the makefile targets: test1, test2, and test3.
Each target should do something like this:
    test1 : pp
        @echo Original file:
        @cat test1.mylang
        @echo Pretty Printed version of the original:
        @pp test1.mylang > test1.pp.1
        @cat test1.pp.1
        @echo Pretty Printed version of the pretty printed version:
        @pp test1.pp.1 > test1.pp.2
        @cat test1.pp.2
        diff -s -q test1.pp.1 test1.pp.2

Submitting the assignment

To submit your assignment, delete all object or class files from your working directory, leaving only source code, a makefile, a README file, and any test cases you may have. Then, while in your working directory, type the command:
  submit proglan lusth pretty
The submit program will bundle up all the files in your current directory and ship them to me. This includes subdirectories as well since all the files in any subdirectories will also be shipped to me.

You may submit as many times as you want before the deadline; new submissions replace old submissions.

Make sure you that I will be able to call your pretty printer with the command named pp. The command pp must take a filename as a command line argument.

You must supply a makefile that will compile your pretty printer when responding to the commands make and make run. The make run command should test your implementation on your own test files.

Change log

Version 2 : Thu Feb 14 10:34:45 : corrected references to recognizer.