Header Ads Widget

BNF Notation

BNF Notation

BNF stands for Backus-Naur Form. It is used to write a formal representation of a context-free grammar. It is also used to describe the syntax of a programming language.

BNF notation is basically just a variant of a context-free grammar.

In BNF, productions have the form:

  1. Left side → definition  

Where leftside ∈ (Vn∪ Vt)+ and definition ∈ (Vn∪ Vt)*. In BNF, the leftside contains one non-terminal.

We can define the several productions with the same leftside. All the productions are separated by a vertical bar symbol "|".

There is the production for any grammar as follows:

  1. S → aSa  
  2. S → bSb  
  3. S → c  

In BNF, we can represent above grammar as follows:

  1. S → aSa| bSb| c  

Post a Comment

0 Comments