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
Theory Explanation. |
Question 2 |
Search tables used by compilers for efficient searching generally use
Hash tables | |
Linear lists of records | |
Binary search tables | |
Binary search trees
|
Question 2 Explanation:
Search table used by compilers for efficient searching is hash tables.
Question 3 |
Uniform symbol table
Contains all constants in the program | |
Is a permanent table of division rules in the form of patterns for matching with the uniform symbol table to discover syntactic structure
| |
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 | |
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.