CD - Important Questions For MID-1 - 2024-25
CD - Important Questions For MID-1 - 2024-25
UNIT-1
1. Write the compilation process for the following statement.a:=b+c*50;
2. Construct a transition diagram to recognize tokens
constant=(+|-)digit digit* and code for each state of DFA
recognizing above tokens.
3.Describe the role of lexical Analyzer with a neat sketch
4. Summarize the concept of Language Processing System.
5.Elaborate the importance of bootstrapping.
6. Discuss in detail about general format of LEX with example.
7.Write a LEX program to find out total number of Vowels and Consonants from the given
input string.
8.Explain in detail about Recognition and Specification of token.
9. Write a short notes on compiler construction tools
10.Describe the types of Input buffering with an example.
UNIT-2
1.Illustrate about left factoring and left recursion with example.
2. Consider the following CFG:
S->SS+|SS*|a and let the String be aa+a* .
Check if the given grammar is ambiguous or unambiguous?
3. Consider Grammar
E->TE’
E’->+TE’ | €
T->FT’
T’->*FT’ | €
F->(E) | id.
Find the FIRST and FOLLOW functions for the above grammar.
4. Construct Predictive Parsing table for the following grammar
S->(L)|a
L->L,S|S
Is the parser LL(1).Show the actions of the parser for the input string (a,a).
5.Explain Backtracking with an example.
6. Show that the following grammar is LL(1).
S->AaAb | BbBa
A->€
B->€
7.Describe the role of a parser with a neat sketch and how the action of Parser is different
from action of Lexical Analyzer.
8. Eliminate Left Recursion from the following grammar
S->Aa | b
A->Ac|Sd|€
9. Consider the Following Grammar
E->T+E|T T->V*T|V V->id
Write down the Procedures for the non-terminals of the Grammar to make a
Recursive Predictive Parser.
10. How Error recovery in Predictive Parsing achieved? Explain briefly.
UNIT-3
1. Construct SLR Parsing table for the following grammar. S->AS|b , A->SA|a
2. Explain the various actions performed by Shift-Reduce parser with an Example.
3. Construct an Operator Precedence parser for the grammar and also parse the string
“id+id*id”.
EEAE | (E) | -E | id
A + | - | * | / | ^
4. Explain the construction of the SLR parsing table with an example.
5. Construct Shift Reduce parser for the following grammar and also Parse the input string
“id-id*id”. EE-E|E*E| id