// Regular Expression Parser Main Program Specification // // File: rep.sp // Assignment: 6 // Author: course // Version: 1 This file specifies the regular expression parser program, rep. (1) The sequence of inputs must be. (a) A regular expression. (b) A string. (c) A yes-no response (another string?). If yes, go to (b). (d) A yes-no response (another RE?). If yes, go to (a). If no, exit program. (2) If there is any error in parsing a regular expression, the program proceeds to (d). (3) Each input, regular expression, string, or yes-no response, must be on a complete line by itself. If there is an error parsing an RE, the next input must be the next line. (4) The regular expression must occupy the ENTIRE line it is on, and include NO space characters. Thus the line abc) is an erroneous RE even though it begins with the RE `abc'. (5) The answer to a yes-no question occupies the entire line and is yes if the line begins with `y' or `Y', and NO otherwise. The part of the line after the first character may be a comment. (6) If an end of file is encountered instead of a yes-no input, then it shall be interpreted as a `no' input. (7) If a parsing error is detected, an error function (see basic.h and error.cc) shall be called. This will perform a long jump, which shall be caught by a setjmp that shall print two newlines and proceed to (d) above. The error message shall identify the kind of parsing error and if appropriate include the next lexeme or the unparsed remainder of input line containing the RE. (8) The program must prompt for each input, so the program can be run interactively. (9) If the first UNIX argument to the rep program is "trace", the program shall print the state table for each RE, and the trace of each string-matching run. (10) When the rep program terminates, it must return EXIT_SUCCESS from the main function.