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
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 2 Explanation: 
Search table used by compilers for efficient searching is hash tables.
Question 3
Uniform symbol table
A
Contains all constants in the program
B
Is a permanent table of division rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure
C
Consists of full or partial list of the tokens as they appear in the program, created by Lexical Analysis and used for syntax analysis and interpretation
D
A permanent table which lists all key words and special symbols of the language in symbolic form
Question 3 Explanation: 
Uniform Symbols Table consists of a full or partial list of the token's as they appear in the program. Created by Lexical analysis and used for syntax analysis and interpretation.
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