Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

BNF specification

Posted on 2001-09-18
5
Medium Priority
?
502 Views
Last Modified: 2008-02-26
What does BNF (Backus Naur Format) specification mean and what other format specifications exist?
Thanks!
0
Comment
Question by:bobbybio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6490470
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.
0
 

Author Comment

by:bobbybio
ID: 6490888
Thank you for your immediate answer! But is this method something like  rules of coding or something else? How is it used?
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 6490962
I suppose it could be used and most likely is used for that purpose.  But my experience is that it's most useful to language developers, compiler developers, and students.

Using BNF is a good way to ensure that a language is "parsable".  If the rules for the language are inconsistent, building a parser for the compiler is very difficult.  Since the BNF helps in the design and even analysis of a language, you have a valuable tool.

You might say that you don't need it since you may not ever develop a C++ compiler or parser but it is also quite useful in just about any specification or documentation that will end up being "read" by a computer program.

For exmaple, even things like HTML, XML, SGML, most database languages (like SQL), etc. can and do make use of BNF specifications.
0
 
LVL 1

Expert Comment

by:dspector
ID: 6491614
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
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6492641
>>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/
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question