CS 453 Programming Assignment #2 — MeggyJava Scanner

Due Thursday February 23th (by 11:59pm)

Introduction

PA2 is the first programming assignment for CS453 where you will be working in a team. Your team will extend a JLex based scanner to include all of the tokens in the MeggyJava language. An incomplete regression testing system is provided. This testing system iterates through all input files fname.in in a TestCases directory and compares output with corresponding fname.in.OK files. You are provided with a MJPA2Driver.java program that calls the scanner repeatedly and outputs each symbols that is read in. Example: The file plus.in contains:
+
+ + +
    + 
  +   + 
+       + 
 +     +
and scanning it will produce the following result:
symbol: #2  symbolValue:  [+  at: (1,1)  value: -1]
symbol: #2  symbolValue:  [+  at: (2,1)  value: -1]
symbol: #2  symbolValue:  [+  at: (2,3)  value: -1]
symbol: #2  symbolValue:  [+  at: (2,5)  value: -1]
symbol: #2  symbolValue:  [+  at: (3,5)  value: -1]
symbol: #2  symbolValue:  [+  at: (4,3)  value: -1]
symbol: #2  symbolValue:  [+  at: (4,7)  value: -1]
symbol: #2  symbolValue:  [+  at: (5,1)  value: -1]
symbol: #2  symbolValue:  [+  at: (5,9)  value: -1]
symbol: #2  symbolValue:  [+  at: (6,2)  value: -1]
symbol: #2  symbolValue:  [+  at: (6,8)  value: -1]
The symbol number "#2" corresponds to a constant for the PLUS token (see sym.java generated by the JLex / JavaCup tool). A Symbol object contains a token and a SymbolValue objects. SymbolValue objects contain a lexeme, line, position, and integer value. The default integer value is -1. This default value is used to indicate that no extra value is associated with a PLUS token, but a ColorLiteral, a ToneLiteral, or a number will have useful associated values. See the Meggy Java Tokens description in the Resources section of the website for a description of Symbols and their associated values.

The Assignment

To complete this assignment you must: You will start off by downloading this tar.gz file.

Provided Test Cases

You are provided with various test cases. This set is incomplete. For each token type: (Specials, Reserved Words, Reserved Phrases, Int-Literal, Id, Comments) create files fnm.in and fnm.in.OK, thoroughly testing that type, and provide files errfnm.in and errfnm,in.OK thoroughly testing incorrect tokens of that type, e.g. an errspec.in could contain ">@$" and more.

Submitting the Assignment

Late Policy

Late assignments will be accepted up to 48 hours past the due date for a 10% deduction. The assignment will not be accepted past this period. Late means anything after 11:59pm on the day the assignment is due, including 12 midnight.