FAQ HW1


Q.  The LexicalStructurePico.doc file mentions 'int' as a keyword, whereas the Token.java file contains '_int' as a keyword. Could you please let me know which version of int should I be using?

A.  The keyword is int, so this is what would appear in the program source, but you can't use it as an enum value because it is a java keyword.

horizontal rule

Q.  Is it okay if operators are right next to each other?e.g. would this <<><!>!==== be scanned as LSHIFT, GT, LT, NOT, GT, NEQ, EQ, BECOMES instead of an
error?


A.  Yes, that is right.

horizontal rule


Q.  I have a question about the scanner implementation.  Could you possibly provide further details about how you (and the TA's) will be testing the scanner?  More specifically, I am a little confused as to where the actual reading in of the file (creating the InputStream etc.) needs to take place: does this need to happen in the scanner class (in the'getch()' method from the class outlines) or will the test program be responsible for reading the file?

A. The test program will pass a Reader object to the scanner's constructor, so the scanner just needs to call the Reader's read method to get the next character.

horizontal rule