javac Proj2.java
.
java Proj2
< lexically-bad.sl
, and compared the output against the output of the
solution set.
Here is lexically-bad.sl
:
java Proj2 < lexically-good.sl
, and
compared the output against the output of the solution set.
lexically-good.sl
is the same as lexically-bad.sl
, except
that it's missing the quote character.
Proj2.java
class (i.e. calling it prog2.java
or something else)
lexically-good.sl
,
lexer prints additional output (like the contents of
the symbol table) after the list of (token, lexeme)
lexically-bad.sl
,
lexer does not print an informative error message containing the line number
(5, in this case) where the input is bad.
main
contain some of the lexer
functionality, then it'll be difficult to use your code in another setting. You
want main
to do as little as possible: initialize the lexer,
repeatedly call getToken()
, and print the result. When you write
the parser, you'll be writing an entirely new main
. If you have
any "real code" in main
, you'll lose that when you transplant the
lexer code into your parser. More importantly, lexer-related code should be in
the lexer: that's the idea of object-oriented programming.