Symbol-Table

Question 1

(a) Write syntax directed definitions (semantic rules) for the following grammar to add the type of each identifier to its entry in the symbol table during semantic analysis. Rewriting the grammar is not permitted and semantic rules are to be added to the ends of productions only.

        D → TL;
        T → int
        T → real
        L → L, id
        L → id   

(b) Write 3-address intermediate code (quadruples) for the following boolean expression in the sequence as it would be generated by a compiler. Partial evaluation of Boolean expressions is not permitted. Assume the usual rules of precedence of the operators.

 (a + b) > (c + d) or a > c and b < d  
A
Theory Explanation.
Question 2
Which of the following are applications of symbol table? A) Storage allocation B) Checking type compatibility C) Suppressing duplicate error messages Choose the correct answer from the options given below:
A
(A) and (B) only
B
(A) and (C) only
C
(B) and (C) only
D
(A), (B) and (C) only
Question 2 Explanation: 
All statements are application of symbol table
Symbol table can be used for
1. Checking type compatibility
2. Suppressing duplication of error message
3. Storage allocation
Question 3
Search tables used by compilers for efficient searching generally use
A
Hash tables
B
Linear lists of records
C
Binary search tables
D
Binary search trees
Question 3 Explanation: 
Search table used by compilers for efficient searching is hash tables.
There are 3 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access