Link to home
Start Free TrialLog in
Avatar of bobbybio
bobbybio

asked on

BNF specification

What does BNF (Backus Naur Format) specification mean and what other format specifications exist?
Thanks!
Avatar of jhance
jhance

BNF is a rigourous method for defining a language syntax.  It's by far the most common method used and taught.  There are others but I'm unfamiliar with their names and have never used anything else.
Avatar of bobbybio

ASKER

Thank you for your immediate answer! But is this method something like  rules of coding or something else? How is it used?
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BNF (Backus/Naur Form) is a language that specifies the strings of a language. The symbols forming the string can be anything (a 'token'). They may be characters, or entities such as 'identifiers' made up of characters.

Here are some typical (extended) BNF 'productions':

ID ::= <letter> <alphanumeric> | ID <alphanumeric>
<letter> :: 'a' | 'b' | 'c' | ...
<alphanumeric> ::= <digit> | <letter>
<digit> ::= '0' | '1' | ...

These mean that an identifier (ID) is a letter followed by any number of alphanumeric characters, where an alphanumeric is defined as any digit or letter.

The '|' means an alternate derivation (this is an extension to BNF, and only makes the BNF easier to read).

Let me know if there is anything else you would like to know; I spent years writing parsers and other tools that used BNF.

David
>>other format specifications exist?
ABNF (Augmented BNF)
http://community.roxen.com/developers/idocs/rfc/rfc2234.html
RDF specifications
http://www.ics.uci.edu/~rohit/cscw98/rdf/