| CS 331 Spring 2009 > Additional Lecture Notes for Wednesday, February 4, 2009 |
The following material was covered in class, in addition to the material from the text.
We began writing a lexical analyzer to analyze according to the scheme on the handout.
Some design decisions.
States needed, after skipping of whitespace and comments is handled.
States that result in returning a lexeme do not need to be listed; the lexeme can simply be returned (and thus the states “Read other operator&rdquo and “Read illegal character” may be unnecessary). Other combinations of characters will result in one of the above states being entered. For example, reading “+3” sends us to the “Digit” state, while reading “.9” sends us to the “Read digit followed by decimal-point” state.
| CS 331 Spring 2009: Additional Lecture Notes for Wednesday, February 4, 2009 / Updated: 4 Feb 2009 / Glenn G. Chappell / ffggc@uaf.edu |
|