From your past knowledge and after reading the above slide, answer Q(1-3) 1- Symbol Table is used for a) Checking Type compatibility b) Storage allocation c) checking duplicate identifiers errors d) all above 2- Symbol table is filled during the a) Lexical b) Syntax c) Semantic d) Intermediate code optimization e) object code generation - phase. 3- The access time of the symbol table will be linear if it is implemented by a) linear list b) binary search tree

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
Symbol Tables
* A symbol table is a major data structure used in a compiler:
• Associates attributes with identifiers used in a program
1 من 4
* For instance, a type attribute is usually associated with each identifier
* A symbol table is a necessary component
+ Definition (declaration) of identifiers appears once in a program
• Use of identifiers may appear in many places of the program text
* Identifiers and attributes are entered by the analysis phases
• When processing a definition (declaration) of an identifier
* In simple languages with only global variables and implicit declarations:
• The scanner can enter an identifier into a symbol table if it is not already there
• In block-structured languages with scopes and explicit declarations:
• The parser and/or semantic analyzer enter identifiers and corresponding attributes
* Symbol table information is used by the analysis and synthesis phases
• To verify that used identifiers have been defined (declared)
• To verify that expressions and assignments are semantically correct - type checking
+ To generate intermediate or target code
Symhod Tahles, Hahing nd Nah Tables -
Compiler Desige - OMulummd Mudwar
From your past knowledge and after reading the above slide, answer Q(1-3)
1- Symbol Table is used for
a) Checking Type compatibility
b) Storage allocation
c) checking duplicate identifiers errors
d) all above
2- Symbol table is filled during the
a) Lexical
b) Syntax
c) Semantic
d) Intermediate code optimization
e) object code generation
phase.
3- The access time of the symbol table will be linear if it is implemented by
a) linear list
b) binary search tree
4- Which of the following statements may not produce executable code when compiled?
a) Declaration ( int I;)
b) Assignment statement (I=3+6;)
c) print statement (print (I); )
d) Structural statement ( for , while, if )
Mid exam LT I Jan, 2022,
Name:
5- The output of a lexical analyzer is
a) a parse tree
b) intermediate code
c) machine code
d) a stream of tokens such as token table
6- Relative to the program translated by a compiler, the same program when interpreted runs
a) faster
b) slower
c) at the same speed
d) may be faster or slower
7-Which of the following comparisons between static and dynamic type checking is incorrect?
a) Dynamic type checking slows down the execution
b) Dynamic type checking offers more flexibility to the programmers.
c) In contrast to static type checking, dynamic type checking may cause failure in runtime due to
type errors.
d) Unlike static type checking, dynamic type checking is done during compilation.
Transcribed Image Text:Symbol Tables * A symbol table is a major data structure used in a compiler: • Associates attributes with identifiers used in a program 1 من 4 * For instance, a type attribute is usually associated with each identifier * A symbol table is a necessary component + Definition (declaration) of identifiers appears once in a program • Use of identifiers may appear in many places of the program text * Identifiers and attributes are entered by the analysis phases • When processing a definition (declaration) of an identifier * In simple languages with only global variables and implicit declarations: • The scanner can enter an identifier into a symbol table if it is not already there • In block-structured languages with scopes and explicit declarations: • The parser and/or semantic analyzer enter identifiers and corresponding attributes * Symbol table information is used by the analysis and synthesis phases • To verify that used identifiers have been defined (declared) • To verify that expressions and assignments are semantically correct - type checking + To generate intermediate or target code Symhod Tahles, Hahing nd Nah Tables - Compiler Desige - OMulummd Mudwar From your past knowledge and after reading the above slide, answer Q(1-3) 1- Symbol Table is used for a) Checking Type compatibility b) Storage allocation c) checking duplicate identifiers errors d) all above 2- Symbol table is filled during the a) Lexical b) Syntax c) Semantic d) Intermediate code optimization e) object code generation phase. 3- The access time of the symbol table will be linear if it is implemented by a) linear list b) binary search tree 4- Which of the following statements may not produce executable code when compiled? a) Declaration ( int I;) b) Assignment statement (I=3+6;) c) print statement (print (I); ) d) Structural statement ( for , while, if ) Mid exam LT I Jan, 2022, Name: 5- The output of a lexical analyzer is a) a parse tree b) intermediate code c) machine code d) a stream of tokens such as token table 6- Relative to the program translated by a compiler, the same program when interpreted runs a) faster b) slower c) at the same speed d) may be faster or slower 7-Which of the following comparisons between static and dynamic type checking is incorrect? a) Dynamic type checking slows down the execution b) Dynamic type checking offers more flexibility to the programmers. c) In contrast to static type checking, dynamic type checking may cause failure in runtime due to type errors. d) Unlike static type checking, dynamic type checking is done during compilation.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Intelligent Machines
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning