Analysis Phase >> Syntax Analysis [2nd Phase of Compiler]

January 27, 2012 No Comments » Hits : 389





Analysis Phase : 2nd Phase of Compiler (Syntax Analysis)

Syntax Analysis :

  1. It is Second Phase Of Compiler after Lexical Analyzer
  2. It is also Called as Hierarchical Analysis or Parsing.
  3. It Groups Tokens of source Program into Grammatical Production.
  4. In Short Syntax Analysis Generates Parse Tree.
sum = num1 + num2

Parse Tree

Parse Tree :

It only Checks for Syntax not meaning ,

  • Example : ‘+’ Operators on two Operands
  • It does not checks which type of operands they are.
  • Suppose One of the Operand is String and other is Integer then it does not throw error as it only checks whether there are two operands associated with ‘+’ or not .
  • So this Phase is also called Hierarchical Analysis as it generates Parse Tree Representation of the Tokens generated by Lexical Analyzer

Incoming search terms: