COMPILER DESIGN

Project 1

Due on September 19th,2005.

  1. Read the Java mini language reference manual for mini Java in our text book. You may want to compare it with the full blown Java LRM In Postscript (local copy).

    A book by James Gosling, Bill Joy and Guy Steele, "The Java Language Specification" Addison Wesley describes the syntax and semantics of Java.

    A book by Tim Lindholm and Frank Yellin, "The Java Virtual Machine Specification", Addison Wesley describes virtual Macine.

  2. Write five sample Java programs which utilizes different features of the Java min language.

  3. Write a lexer program and parser program that takes any miniJava program that prints(reports) statistics about the program as well as cross references for the given Java Program. The statistics information includes
    1. Number of Keywords and how many of each type are used.
    2. Number of assignent statements.
    3. Number of conditional statements.
    4. Number of iteration (for, while) statements.
    5. Number of function calls.
    6. Nesting Depth of while statements.

    The cross reference includes
    1. Identifiers- which lines they are defined and which lines they are used.
    2. function names - which lines they are defined and where they are used.

    For hints: you may want to look at java beautifier programs . They can be found http://www.cs.rpi.edu/~moorthy/Courses/compiler/JB/.