Compiler HWK#1 Due date: 2:20pm, March 24, 2005 Write a LEX program to do the following: a. Input: an ASCII text file containg a C program code. b. Output: a stream of the following tokens after striping white spaces, i.e., tab and space. Note tab and space are also tokens, but not reported. identifier valid C variable name int-const integer constant (unsigned) float-const floating point constant (unsigned) string a valid C-string, e.g., "xyz" equal == assign = plus + minus - left-paren ( right-paren ) left-{ { right-} } comma , semi-colon ; new-line \n others a character that is not tab, space, new line or EOF and matches none of the above c. if there are conflicts between definitions of tokens, use standard LEX tie-breaking scheme. Example: Input: main(){ int i; @123 i = i+1; } Output: identifier left-paren right-paren left-{ new-line identifier identifier semi-colon new-line others int-const new-line identifier assign identifier plus int-const semi-colon new-line right-} new-line Note: (a) put a space in-between tokens (b) put "\n" after new-line, there is no leading/tailing spaces in each line (c) watch out floating-point constants (d) <> can be used to match end of file, yyterminate() can be used to stop the scanner. (e) To submit your homework, send an email to comp05@csie.ntu.edu.tw subject: HWK1: your student number and name eg: "HWK1 - B91922xxx ¤ý¤p©ú" attachments: one file: B91922xxx.tar.gz files must contain in the current dir after uncompression and untar This homework MUST execute on Linux or FreeBSD workstations in our department. Submitting files include a lex file, a Makefile, and optional C codes. The Makefile MUST supports "make clean" and "make all" for cleaning, and building the homework. An example of the Makefile can be obtained from the course web. Do not use the samples without proper changes. The name of your executable after "make all" must be "hw1" and takes input from standard input and writes to standard output.