Due: Wednesday, April 20, 12:30 pm.
In this assignment you will extend the initial MiniJava scanner with the extensions described in the course project description handout. Specifically, MiniJava's lexical structure should be extended as follows:
<![if !supportLists]>· <![endif]>Comments are now allowed, and ignored. Two styles of comment are supported: “//” to end of line, and /*...*/ unnested block comments.
<![if !supportLists]>· <![endif]>Underscores (“_”) are now allowed in identifiers wherever letters are allowed.
<![if !supportLists]>· <![endif]>Floating-point literals are allowed. A floating-point literal is an integer part followed by either a fractional part, or an exponent part, or both. If both, then the fractional part precedes the exponent part. The integer part is one or more digits. A fractional part is a decimal point followed by one or more digits. An exponent part is the letter E or e, followed by an optional + or -, followed by one or more digits. (This is a restricted version of full Java's floating-point literal syntax.)
<![if !supportLists]>· <![endif]>"double", "for", "break", and "length" are new reserved words.
<![if !supportLists]>· <![endif]>"||" is a new operator.
In this assignment, you should only extend the scanner. You do not need to check for syntactic or typechecking errors, nor do you need to extend the parser or any other parts of the MiniJava compiler.
Do the following:
You can use the -scan -printTokens options to the MiniJava compiler to just run the scanning phase and print out the tokens that it scans. See the test_scanner target in the Makefile for an example, and feel free to make your own target(s) to make running the tests you like easier and more mechanical.
Turn in the following:
Submit the above files using the turnin command. The project name is proj1. See the man page for details on turnin.