Syntax analysis is the second phase of compiler.
Syntax analysis is also known as parsing.
Parsing is the process of determining whether a string of tokens can be generated by a grammar.
It is performed by syntax analyzer which can also be termed as parser.
In addition to construction of the parse tree, syntax analysis also checks and reports syntax errors accurately.
C = a + b * 5
Syntax tree can be given as,
Parser is a program that obtains tokens from lexical analyzer and constructs the parse tree which is passed to the next phase of compiler for further processing.
Parser implements context free grammar for performing error checks.