COSC4307 Program-5 Recursive Descent Parser Due: Thursday, 11/12/2009. Consider the following Block-structured CFG: Source --> Program Block . Block ---> BEGIN Body END Body ---> Body ; S Body ---> S S ---> Block S ---> PRINT Elist S ---> READ Ilist S ---> IF E THEN S FI S ---> IF E THEN S ELSE S FI S ---> V = E S ---> INTEGER Ilist S ---> REAL Ilist Ilist ---> Ilist , I Ilist ---> I Ilist ---> I (Clist ) Ilist ---> Ilist , I (Clist) Clist ---> Clist , C Clist ---> C Elist ---> Elist , E Elist ---> E V ---> I V ---> I ( Elist ) E ---> E + T E ---> E - T E ---> T T ---> T * F T ---> F F ---> C F ---> V F ---> ( E ) NOTE: "I" Stands for an identifier which is a letter followed by zero or more letters and/or digits, and "C" an unsigned integer constant. Task: Write a recursive descent parser that does the following: 1. Read a source program and echo print it. 2. Convert the input source program into a sequence of token integers and print them out. 3. Output all the statements which your parser finds in the input source program in exactly the same order in which they are found. These statements may be output in either token integers or original character strings. For example, the given input program would yield the following statements in that order: a. REAL X(10,20), Y1234 b. INTEGER Longvariab, A, B, C, ABC, X123, ABC123 c. READ X123, ABC123 d. READ Longvariab, ABC e. ABC123 = ABC123 + 1 f. IF ABC123 - X123 THEN ABC123 = ABC123 + 1 FI g. Begin READ Longvariab, ABC; IF ABC123 - X123 THEN ABC123 = ABC123+1 FI End h. And, so on !!! 4. Print out the count of all the statements found. Input source program: Program BEGIN REAL X(10, 20), Y1234; INTEGER LongVariable, A, B, C, ABC, X123, ABC123; READ X123, ABC123; BEGIN READ LongVariab, ABC; IF ABC123-X123 THEN ABC123=ABC123+1 FI END ; BEGIN Real ABC123, X ; Read B, C, AbC123, X ; X123 = ABC + X123 * ABC123 + X End ; Begin Integer Y (10, 20, 30) ; READ Y, X, Long, Variab ; X ( 10, 10 ) = X(1, 10) + Y (1, 10, 10) * LongVariab End End .