In this lab I want you to do a bit of text processing yourself. (Not quite a compiler for sure.) You can use your standard input, or if you wish to read ahead in your book and process the input from a file. Both approaches are fine. Extra credit will be given if you take the "UNIX" approach of looking on the command line for a file name, and if it exists use it, otherwise use the standard input (keyboard or redirected input).
Write a program that process an input stream doing the following:
This output should be in the following format:This has a comment; And the comment is discarded. 101010010010 A hidden binary number 9991999; Of 1 1010109AAAA10; The last binary number is decimal 2
No Binary Number 15 Letters 0 Digits
1 19 Letters 7 Digits
2 4 Letters 9 Digits
3 Lines --------------------------------------------
3 38 Letters 16 Digits
Test your program with the following sample data set.
It is available by anonymous ftp at
; This is the test date for the lab "Stream"
; Louis Taber 3/29/98
; CSC130 Pima Community College
; Blank Line
ABCDEFGHIJKLMNOPQRSTUVWXYZ ; Uppercase letters
abcdefghijklmnopqrstuvwxyz ; Lower case letters
1234567890 ; Digits - binary number: 0
11111111 ; Binary number 255
1000000000000000 ; This may give you
; a negative number (OK)
; Do you know why?
10101010a10101010b111 ; Last binary number: 7
[]|--+=*#@ ; Some special symbols
The last Line
Turn in a copy of your program and its output when used with the above test data marked with: