Next: From a Regular Language
Up: No Title
Previous: Lexical Analysis / Syntactic
Assume you have
Write a function
which reads a binary number.
- 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.
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?