Syntax analysis is the
second phase of the compiler. It gets the input from the tokens and generates a
syntax tree or parse tree.
Advantages of grammar for syntactic specification :
grammar gives a precise and easy-to-understand syntactic specification of a
An efficient parser can be constructed
automatically from a properly designed grammar.
grammar imparts a structure to a source program that is useful for its
translation into object code and for the detection of errors.
4. New constructs can be added to a language more easily when there is a grammatical description of the language.