



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Name: (Please print) Put the answers on these sheets. Use additional sheets when necessary. Show how you derived your answer when applicable (this is required for full credit and helpful for partial credit). You can collect 100 points in total for this exam. A bonus question for an additional 15 points is included. If the total number of points for this exam exceed 100, the excess points are carried over to the next exams.
(1) preprocessor (9) lexeme (2) attribute (10) lexical analysis (3) back end (11) syntax analysis (4) front end (12) token (5) nonterminal (13) terminal (6) NFA (14) DFA (7) regular expressions (15) grammar (8) regular definitions (16) translation rules
(a) The of a compiler produces intermediate code. (b) Syntax errors are detected in the phase of a compiler. (c) In a typical compiler, the of a token of an identifier is a pointer to the identifier’s symbol table entry containing a pointer to the of the identifier. (d) The time complexity of lexical analysis using a representation of lexical pat- terns is linear in the size of the input. (e) A lex/flex specification consists of three parts. The second part defines.
1 5
2
3
4 a
b
ε
ε
ε
b
convert the NFA to a DFA using the subset construction algorithm (do not attempt to minimize the DFA). Express your answer as a transition graph and identify the start and final states. (15 points)
State Input a b 0 1 2 1 3 4 2 1 2 3 4 - 4 3 -
(a) Draw the transition graph. (5 points) (b) Minimize the DFA using the algorithm in the book and illustrated in class. Identify the start and final states of the minimized DFA. (15 points) (c) Write an equivalent regular expression that represents the same language as defined by the (min- imized) DFA. (10 points)