(50 points) Design a multi-pass fully-optimizing compiler using a data-flow diagram. Label each component and each input and output. Describe the primary purpose of each component in one or two sentences.
Consider the following definition of the language Tiny-Ada:
Letter case is ignored. White space between tokens is insignificant.
The Ada reserved words: DECLARE, BEGIN, and END.
The Ada assignment operator: ":=".
The Ada operators: "+", "*", "and", "not", and "<".
The delimiters: "(", ")", ":", and ";".
Ada integer literals. An integer literal is a sequence of digits which may contain underscores provided that they are not adjacent and the literal must begin and end with a digit.
Ada identifiers. An identifier must start with a letter and may contain numbers, letters, and underscores provided the underscores are not adjacent and they must not appear at the front or the end of the identifier.
Statements include declare, assignment, and output.
Here is a string in this language.
declare
i:integer;
b:boolean;
Begin
b := true;
i := 100;
b := not (2_000*(i+3_456_789)<i) and b;
put(i);
End;
(50 points) Draw a transition diagram for a DFA which recognizes Tiny-Ada lexemes. (Hint: see section 3.4 of the text for examples, but your diagram will have only one initial state and don't use the backup like they did. Don't forget identifiers which have common prefixes with reserved words.) Give a table showing the token recognized for each accept state.
Submit your drawings and their annotations drawn neatly on one sheet of paper each. The token table should be on a third sheet of paper by itself. Place a title sheet on front of your homework with your name, student number, and ICS 142. Staple all sheets together with one staple in the upper left-hand corner.
REMINDER: late homework will not be accepted.
Note: make a photocopy of your transition diagram for yourself, because you will need it for the next homework assignment.