Next: From a Regular Language
Up: No Title
Previous: Lexical Analysis / Syntactic
Assume you have
- a variable ch, which contains the current character.
This variable is called lookahead .
- a function void nextCh()
which sets the variable ch to the next input character.
- a function error() which quits with an error message.
Write a function
void readBinNumber()
which reads a binary number.
At the beginning the first character is already in ch. After the
function returns, the first character after the binary
number should be in ch.
Did the grammar for numbers help you in writing the function?
Christoph Zenger
3/23/2000