Compiler HWK#1 Due date: 2:20pm, March 18, 2004 1. Read LEX man pages and find out the meanings of the following special characters. ^ ? . ( ) $ { } % < > 2. Write a LEX program to do the following: a. Input: an ASCII text file b. Output: Copy the file with the following two modifications. (1) replace an integer spelled out in English into Arabic numbers if this number is between 0 and 99. (2) replace an integer in Arabic form into its English equivalent. The English equivalent are lower cases separated by one blank if needed. (3) No token contains a newline. Each token is spearated by blank or newline. The file is ended with a newline. Example: Input: Output: Note: (a) "<" and ">" are not part of the input and output. (b) Arabic numbers have no leading zeros, ie, 012 is illegal. (c) English words are separated by either a single blank (no tabs) or a newline. Characters can be uppercase/lower cases or mixing. (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 comp04@csie.ntu.edu.tw subject: HWK1: your student number and name eg: "HWK1 - B90902xxx 王小明" attachments: two files first file: your first homework in TEXT, PS or PDF format second file: .tar.gz format files must contain in the current dir after uncompression and untar (f) 一個擺在工作站上簡單的script, 可以讓同學測試 測試的方法是在工作站上執行 /home/course/comp04/hw1/test.sh YOUR_EXECUTABLE 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", "make all", and "make test" for cleaning, building, and testing the homework. An example of the Makefile can be obtained from the course web.