SYNTACTIC ANALYZER
Syntax Analysis:
•Hierarchical Analysis is called as ‘Syntax Analysis’ or ‘Parsing’
•It Implements hierarchical structure on the tokens
•It involves grouping the tokens of source program into grammatical phrases that are used by the compiler to synthesize output.It Generates a Parse Tree according to the hierarchy of Tokens.
Example : Syntax Analysis
Semantic Analyzer:
• It checks the source program for semantic errors and gathers type information for the sub-sequent code generation phase
•The component of semantic analysis is ‘Type Checking’
• The compiler checks that each operator has operands that are permitted by source language specification
Example : Semantic Analysis:
* A real number is used to index an array.
Ex: int a [ 5.0];
* Arithmetic operator is applied to an integer and real data types