COSC 4342 Assignment #1

Due date: January 26, 2010 by 5pm in JBWN 223.

Your first assignment is to modify a simple hand-coded scanner which currently scans tokens that are part of a very small, simple language named Tiny. You are to modify this scanner so that it scans tokens for the language described in the text book, simpleJava. Appendix A.1 gives a complete description of the language tokens in simpleJava. Just so that you understand the scanner you are MODIFYING, here are some sample programs written in the Tiny language:

The current working scanner for the Tiny language is located on the CS system in the following directory/filename:

      ~lbaker/www/HTML/cosc4342/TinyScanner.java

You may copy the file to your directory from the CS system or download it.

To use the current scanner (try it out) you must compile it:
    javac TinyScanner.java
then to execute the program you must give the name of the file (the tiny program) that you want to scan as a command line argument:
    java TinyScanner sample.tny

You are to rewrite this scanner program so that it outputs (scans) tokens in the simpleJava language. The output should be very similar to the current scanner output. Hand in:

  1. Script file of the execution of your newly written scanner using a few sample programs written in simpleJava that test your scanner. (At least two programs, be sure you test every token and various comment forms, especially nested comments.)
  2. Your java code (all files) of your simpleJava scanner (well documented).
  3. A cover sheet with your name, course number, assignment number.
  4. Please staple all pages.