Parser or Syntax Analyzer A parser or syntax analyzer checks whether the token string generated by the scanner, forms a valid program. It uses restricted class of context-free grammars to specify the language constructs.
Context free grammar
A context-free grammar (CFG) G is defined by a 4-tuple of data (V, T, P, S), where V is a finite set of non-terminals, T is a finite set of terminals. P is a finite subset of V U (T U V)’. Elements of P are called production or rewriting rules. The forth element S is a.- distinguished member of V, called the start symbol or the axiom of the grammar.
Explain the meaning of “context-free” in a context-free grammar.
Ans. Context-free means the syntax of the grammar in Context free Grammar. A grammar is a set of rules. A context-free grammar defines rules in a particular way: as a series of productions. Our goal is to use these rules to generate sentences that have the structure of English.