Q1. Describe the following Regular Expressions with Deterministic (2 Marks)
Finite Automaton (DFA)
i) a ( b l a ) b+
ii)a b*a(a*lb+)
QZ. Explain the purpose of parser and semantic analyzer. (2 Marks)
Q3. A context-free grammar has the following productions: (6 Marks)
E -> V
E -> EOF
E -> ( E
V-> a l b I c
0 -> + I – I * l
For an expression (a-b)lc
i) Perform Leftmost Derivation,
ii) Rightmost Derivation
iii) Derivation Trees for Leftmost Derivation
Q4. A context-free grammar has the following productions: (8 Marks)
E -> T E”
E’ -> + T E’ l 6
T -> F T’
T’ -+ * F T’ I e.
F -> ( E ) [ id
i) Compute the first sets
ii) Compute follow sets
iii) Construct the parse table
iv) Show each step of top-down parsing for id + id * id
QS. Eliminating Left-Recursion from the following grammar (2 Marks)
5 -> A a. l b
A -> A c 1 S d 1 e
Q6. What are the Common Programming Errors? What are the (5 Marks)
different Error-Recovery Strategies
Q7. Consider the following set of Code (5 Marks)
if (x < y)
x=5*y+5*ylm
else
3! = 5;
x=x+w
Construct:
i) Abstract Syntax Trees (ASTs)
ii) Directed Acyclic Graphs (DAGs)
iii) Control Flow Graphs (CFGs)
iv) Stack Machine Code
v) Three-Address Code
Finite Automaton (DFA)
i) a ( b l a ) b+
ii)a b*a(a*lb+)
QZ. Explain the purpose of parser and semantic analyzer. (2 Marks)
Q3. A context-free grammar has the following productions: (6 Marks)
E -> V
E -> EOF
E -> ( E
V-> a l b I c
0 -> + I – I * l
For an expression (a-b)lc
i) Perform Leftmost Derivation,
ii) Rightmost Derivation
iii) Derivation Trees for Leftmost Derivation
Q4. A context-free grammar has the following productions: (8 Marks)
E -> T E”
E’ -> + T E’ l 6
T -> F T’
T’ -+ * F T’ I e.
F -> ( E ) [ id
i) Compute the first sets
ii) Compute follow sets
iii) Construct the parse table
iv) Show each step of top-down parsing for id + id * id
QS. Eliminating Left-Recursion from the following grammar (2 Marks)
5 -> A a. l b
A -> A c 1 S d 1 e
Q6. What are the Common Programming Errors? What are the (5 Marks)
different Error-Recovery Strategies
Q7. Consider the following set of Code (5 Marks)
if (x < y)
x=5*y+5*ylm
else
3! = 5;
x=x+w
Construct:
i) Abstract Syntax Trees (ASTs)
ii) Directed Acyclic Graphs (DAGs)
iii) Control Flow Graphs (CFGs)
iv) Stack Machine Code
v) Three-Address Code
Comments
Post a Comment