Symbol tables are also used for code generation and optimization. When uses of these identifiers are encountered in the source code, the compiler looks them up in the symbol tables and relies on this information for things such as verifying that a variable has been declared, determining the scope of a variable, and verifying that an expression is semantically correct with type checking. As the declarations of classes, interfaces, variables, and methods are processed, their identifiers are bound to corresponding entries in the symbol tables. This information is entered into the symbol tables during lexical and syntax analysis and is used in the later phases of compilation.
Symbol tables are an important data structure created and maintained by compilers to store information associated with identifiers in a given source code.