next up previous
Next: From a Regular Language Up: No Title Previous: Lexical Analysis / Syntactic

Exercise

Assume you have

Write a function void readBinNumber() which reads a binary number.
\begin{program}
BinNumber~\==~BinDigit~\{~BinDigit~\}.
\\ BinDigit~~\\ gt=~''0''~$\vert$~''1''.\end{program}

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