CST 8152 Compilers - Assignment #3Due: 08:45am Monday, February 10, 1997
This assignment builds on Assignment #2. It gives practice designing and implementing Transition Tables to recognize tokens, and begins the process of classifying lexemes into tokens.
1. Design and draw separate Deterministic Finite Automata (DFA), composed of state circles and edges representing state transitions on input characters, that recognize each of the following classes of tokens:
1. a DFA for pseudo-C-style strings, as described in Assignment #1
2. a DFA for unsigned integer constants (digits only, no decimals)
3. a DFA for identifiers (starting with a letter, containing letters or digits)
2. Merge the above three DFA into one single DFA by using a common Start state. (You may or may not decide to use a single common Accept state at the end of all the merged DFA. You can do it either way -- think it over and decide.)
3. Turn the single merged DFA into a two-dimensional Transition Table of states vs. input characters.
4. Design, write, and thoroughly test a C Language program that will read an input file and, using your Transition Table, produce as output a list of each recognized tokens classification type and lexeme value, similar to the following output:
Your program will use a function implementing the above merged Transition Table to recognize the three different token types: INTEGER, IDENTIFIER, STRING. Characters in the file not belonging to any of these three types shall be ignored.
As in Assignment #2, use #define statements to give all states meaningful names.
Your DFA scanner function will recognize a single lexeme, classify it, and return to main() two things: the token type, and the actual lexeme value of the token. Your main() program will print the token type and its value, and will keep calling your DFA scanner function repeatedly until no more tokens are found in the input file.
Part of your evaluation is based on the thoroughness of your program testing.