Backus-Naur notation (shortly BNF) is a formal mathematical way to describe a language, (to The Backus-Naur Form is a way of defining syntax. It consists of. The standard technique for defining the syntax of a computer language is to use Backus-Naur Form (BNF). The variant used in this tutorial is as follows. A Practical Tutorial on Context Free Grammars. Robert B. . Backus-Naur Form ( BNF) is a notation for expressing a CFG. The notation.
|Published (Last):||14 March 2012|
|PDF File Size:||17.95 Mb|
|ePub File Size:||18.94 Mb|
|Price:||Free* [*Free Regsitration Required]|
As an aside, if you think you’ve invented a new parsing technique, you need to check this book first. More important than the minor syntactic differences between the forms of EBNF are the additional operations it allows in expansions.
Juxtaposition of marks or bqckus in a formula signifies juxtaposition of the sequence denoted. Any mark in a formula, which is not a nayr or a connective, denotes itself. Association for Computing Machinery. Programming Systems and Languages. The integer rule is a good example of natural and metalanguage used to describe syntax:. He was the first managing editor of the Communications of the ACM.
For an comprehensive treatment of parsing techniques, I recommend Grune and Jacobs, Parsing Techniques: Many spin-off metalanguages were inspired by BNF.
For instance, the Python lexical specification uses them. The definition of floating point literals in Python is a good example of combining several notations:. When describing languages, Backus-Naur form BNF is a formal notation for encoding grammars intended for human consumption.
But, the reverse is not true: Not to be confused with Boyce—Codd normal from. If necessary, they may be described using additional BNF rules.
Studies of boolean algebra is commonly part of a mathematics. As proposed by Backus, the formula defined “classes” whose names are enclosed in angle brackets.
The origin of BNF is not as important as its impact on programming language development. The language of languages [ article index ]  [ mattmight ] [ rss ]. For more on this, see my article on translating math into code.
Communications of the ACM. This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November and incorporated under the “relicensing” terms of the GFDLversion 1. They are applied wherever exact descriptions of languages are needed: Naur changed two of Backus’s symbols to commonly available characters. There are many variants and nur of BNF, generally either for the sake of simplicity and succinctness, or to adapt it to a specific application.
Another common extension is the use of square brackets around optional items.
Backus-Naur Form (BNF)
Or, if we were describing a programming language, we could add a rule like: The name of a class of literals is usually nayr by other means, such as a regular expression or even prose.
BNF is very similar to canonical-form boolean algebra equations that are, and were at the time, used in logic-circuit design. To indicate precedence, EBNF grammars may use parentheses,to explictly define the order of expansion.
Backus-Naur Form (BNF)
Though yacc is most commonly used as a parser generator nau, its roots are obviously BNF. For the purpose of including text among the symbols of a program the following “comment” conventions hold:.
Note that many things such as the format of a first-name, apartment specifier, ZIP-code, and Roman numeral are left unspecified here. For instance, C is slightly context-sensitive because of the way it handles identifiers and fom, but this context-sensitivity is resolved by a special convention, rather than by introducing context-sensitivity into the grammar. Retrieved May 11, As far as the rule states, we could have space between the digits.
Archived from the original on 5 June He also introduced a tutorjal distinction between generative rules those of context-free grammars and transformation rules A BNF class describes a language construct formation, with formation defined as a pattern or the action of forming the pattern.