notesonly.in

One notebook for every subject — open it anywhere.

Log in

Semantic analysis and symbol tables

Compiler Design · Engineering

Study notes

Analyze '{ int x; x = 3.5; }': the symbol table enters x as int in the block scope. The assignment x = 3.5 triggers a type error (float to int needs cast) or a coercion warning. Exiting the block pops the scope, so a later 'x' is undeclared. Three checks: declaration, types, scope, all from the table.

← Back to topics for Engineering