Saturday, 16 August 2014

What do you understand by Backus-Naur Form

Backus-Naur Form

BNF is main method for context-free grammars; used for syntax of programming languages used in computing, document formats, instruction sets and communication protocols.  It is used to explain the rules related to the programming languages. It is applied when exact descriptions of languages are needed. BNF is very important in compiler construction. BNF defines only syntax not semantics. In BNF variable must be declared before use. But there are some limitations in BNF like:-No easy way to describe the length of the variable, such as maximum length of the variable names. No easy way to describe the rang, such as 1 to 31.
  •   < > indicate a nonterminal that needs to be further expanded, e.g. <variable>
  •   Symbols not enclosed in < > are terminals; they represent themselves, e.g. if, while, (
  •   The symbol ::= means is defined as
  •   The symbol  |  means or; it separates alternatives, e.g. <addop> ::= + | -

No comments:

Post a comment

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter