LARA

Symbol Table Contents

What should be in a symbol table?

All information is derived from syntax tree

  • symbol table is interconnected with syntax tree
  • in old one-pass compilers there was only symbol table
  • today it gives faster, easier access to parts of syntax tree

Goal: efficiently supporting phases of compiler

Semantic check phases:

  • finding which identifier refers to which definition
  • we store definitions

What can we define?

  • variables (globals, fields, parameters, locals)
    • need to know types
    • later: memory layout
    • sometimes need to make more information explicit
      • whether variable is declared local or global
      • in tree we would know it by position
  • methods and functions
  • classes