Three address code is a linearized representation of DAG. (True/False)
Official theoretical question paper for Compiler Design (PCC-CS501) conducted by Maulana Abul Kalam Azad University of Technology. All questions from Groups A, B, and C are reproduced below with marks weightings.
Three address code is a linearized representation of DAG. (True/False)
What is Source-To-Source Translator?
General register allocation problem is NP-Complete. (True/False)
JVM is an Interpreter. (True/False)
What is the number of tokens in the C statement printf("%d,%d",a,b); ?
What types of grammar are used in parsing?
LEX tool is used for parsing. (True/False)
In C language type conversion can be done statically. (True/False)
Stack is used for storing local data objects. (True/False)
Which type of derivation is used in bottom up parsing?
In peephole optimization the code in peephole must be contiguous. (True/False)
Number of states in SLR(1) > Number of states in CLR(1). (True/False)
Write the differentiate between Compiler and Interpreter.
Write the structure of Lex program.
Why the grammar must be augmented during bottom up parsing?
What is S-attributed and L-attributed SDD?
Consider the grammar: T → F T'; T' → union F T' | ε; F → not T | id; Define FIRST and FOLLOW sets for the above grammar. (Assume union and not are operators)
Describe all phases of 2-pass Compiler.
What is the purpose of Symbol Table in compiler?
Write short notes on:
Local Common sub-expression
Dead Code and Unreachable code
Reordering of three address instructions
Redundant load and store
Machine Idioms
Why Intermediate Code Generation is important in compiler design?
Explain different types of Intermediate Code Generation techniques with their advantages and disadvantages.
Lemma: Every Simple-LR (1) (SLR1) is unambiguous, but there many unambiguous grammars that are not SLR (1). Consider the grammar with productions A → B = C | C; B → *C | id; C → B Find the Kernel and Non-kernel LR (0) items of each state of handle recognizing DFA of SLR (1) parsing.
Build the SLR (1) parsing table and then check whether the above grammar is SLR(1) or not.
Check whether the above grammar is ambiguous or not.
Consider a L-attributed SDD given below: | Productions | Semantic Rules | |---|---| | 1 E → T E' | E.node = E'.syn | | | E'.inh = T.node | | 2 E' → + T E' | E'.inh = new Node( +, E'.inh, T.node ) | | | E'.syn = E'.syn | | 3 E' → - T E' | E'.inh = new Node( -, E'.inh, T.node ) | | | E'.syn = E'.syn | | 4 E' → ε | E'.syn = E'.inh | | 5 T → (E) | T.node = E.node | | 6 T → id | T.node = new Leaf(id, id.entry) | | 7 T → num | T.node = new Leaf(num, num.val) | Where, syn and node are synthesized attributes and inh is an inherited attributes. Here E, E1 both are same, and for differentiate between left E and right E, we use E1 in right. Draw the parse tree for the input a - 4 + c.
Build the dependency DAG for evaluation order of attributes of input a - 4 + c and then draw the Syntax tree for the expression over this DAG.