Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

BNF specification

Posted on 2001-09-18
5
Medium Priority
?
504 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
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

877 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