Compiler Design - B.Tech. 5th Semester Examination, 2019
Compiler Design
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
-
When is the type checking usually done?
-
Which one of the following statements is true?
-
In a compiler, _____ checks every character of the source text.
-
For a grammar G, shift reduce (S-R) conflicts are present in LALR(1) parser, if and only if
-
In an absolute loading scheme, which loader function is accomplished by programmer?
-
_____ is a top-down parser.
-
The languages that need heap allocation in the runtime environment are those that
-
In compilers, generation of intermediate code based on an abstract machine model is useful because
-
To convert an arbitrary CFG to an LL(1) grammar
-
The method which merges the bodies of two loops is
-
What is an activation record? Explain how they are used to access various local and global variables.
-
What is bottom-up parsing? Discuss shift reduce parsing technique in brief. What is a handle?
-
What is left recursion? Eliminate the left recursion from the following grammar:
\( E \rightarrow E+T | T \)
\( T \rightarrow T*F | F \)
\( F \rightarrow (E) | id \) -
What is the use of a symbol table? How are the identifiers stored in the symbol table?
-
What is the pass of a compiler? Explain how the single- and multi-pass compilers work.
-
Explain architecture and algorithm for the non-recursive predictive parser.
-
Check whether the following grammar is CLR or not:
\( S \rightarrow Aa | bBa | Ba | bAc \)
\( A \rightarrow c \)
\( B \rightarrow d \) -
What is the syntax directed translation and why are they important?
-
Explain different phases of compiler.
-
Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement:
\( a=(a*b+c)\wedge(b+c)*b+c \)
-
Explain various targets for code optimization with examples.
-
How are CPU registers allocated while creating machine code?
-
Check whether the following grammar is LL(1) grammar or not:
\( S \rightarrow iEtSA | a \)
\( A \rightarrow eS | \epsilon \)
\( E \rightarrow b \) -
Design the FIRST SET and FOLLOW SET for the grammar.
-
Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.
-
Explain any two of the following: