CS152: Assignments

Note: All assignments should be submitted via the turnin system. The turnin program always keeps the most recent version of the program submitted.

Assignment 1

Assigned: Wednesday, June 28, 2006, in class
Due: Wednesday, July 5, 2006, 23:59
Late submission accepted until: Friday, July 7, 2006, 23:59.


[picture taken from slides by Peter H. Froelich]

Goal: Write the lexical-analysis specification for
JFlex for the MiniJava language.

Steps: Output format: The output of your lexer should be the list of tokens (numbered in the order they are matched) printed on the screen (one token per line) with semantic values placed in parantheses next to the tokens where applicable. Following the list of tokens, your lexer also needs to report the line and character count of the input file. Sample output is shown below:
	1. SOME_TOKEN
	2. ANOTHER_TOKEN
	3. TOKEN_WITH_SEMANTIC_VALUE(5)
	...
	...
	Total number of lines: <the line count of the input file goes here>
	Total number of chars: <the char count of the input file goes here>
Submission guidelines: You should only submit your MiniJava.jflex file. No directories, compressed files, nor any test or other script files should be submitted. We will be taking off points if your submission fails to follow this guideline.

Sample MiniJava programs:

Assignment 2

To Be Assigned: Wednesday, July 5, 2006, in class
Due: Tuesday, July 11, 2006, 23:59
Late submission accepted until: Wednesday, July 12, 2006, 23:59.


[picture taken from slides by Peter H. Froelich]

Goal: Generate a parser for the modified (check Assignment #1)
MiniJava language using the CUP parser generator .

Steps: Output format: Expected output of your parser is a print out of the production rules reduced in order upon parsing a given MiniJava source file. The actual values of identifier names, integer and string literals should be printed on the output rather than the token names that correspond to the respective token classes. A sample output snippet is shown below:
	exp -> num
	exp -> 1
	exp -> exp < exp
	exp -> 1
	statement -> num_aux = exp ;
	exp -> num
	exp -> this
	exp -> num
	exp -> 1
	exp -> exp - exp
Submission guidelines: You should only submit your MiniJava.jflex and MiniJava.cup files. No compressed files, nor any test or script files should be submitted. Points will be taken off from your grade if your submission fails to follow this guideline.

Assignment 3

To Be Assigned: Wednesday, July 12, 2006, in class
Due: Monday, July 17, 2006, 23:59
Late submission accepted until: Tuesday, July 18, 2006, 23:59.

Goal: Add semantic actions to your parser to produce an abstract syntax tree for lexically and syntactically correct
MiniJava programs.

Steps: Submission guidelines: You should only turn-in your: files. No compressed files, nor any test or other script files should be submitted. We will be taking off points if your submission fails to follow this guideline.

Assignment 4

To Be Assigned: Monday, July 17, 2006, in class
Due: Monday, July 24, 2006, 23:59
Late submission accepted until: Tuesday, July 25, 2006, 23:59.

Goal: Design a set of visitors to type-check any given MiniJava program for the
MiniJava language.

Steps: Submission guidelines: You should only submit the following files:
	MiniJava.jflex
	MiniJava.cup 
 	BuildSymbolTableVisitor.java
 	TypeCheckVisitor.java
, along with your updated Makefile. No compressed files, nor any test or other script files should be submitted. We will be taking off points if your submission fails to follow this guideline.

Assignment 5

To Be Assigned: Monday, July 24, 2006, in class
Due: Saturday, July 29, 2006, 23:59
Late submission accepted until: Sunday, July 30, 2006, 23:59.

Goal: Integrate all previous assignments (scanner, parser, AST generation, type checking) and write additional code to produce a working interpreter for the
MiniJava language.

Steps: