SaM I/O FAQ
The SaM package provides several classes for dealing with I/O. CS212 requires
the use of these to parse code in the Bali compiler written as part of the
class. Before asking questions about SamTokenizer, please check the
following sources and the list of frequently asked questions below.
Sources
- Tokenizer Javadoc information. There you will find information on the various token types and the methods available for use.
Frequently Asked Questions
- SamTokenizer ate all my whitespace. How do I detect it?
- Whitespace is generally not needed by a compiler and so
it is automatically remove by SamTokenizer. If you need whitespace in
a word enclose it in quotation marks.
- How do we detect comments in the code?
- SamTokenizer automatically removes all comments starting with //, so
you will not have to worry about this. There is actually a way to
keep all comments as seperate tokens, however, this feature is not used
for the CS212 project.
- Why don't I get any negative numbers?
- The tokenizer splits negative numbers into the operator - and
the number in order to avoid ambiguous situations.