From Wikipedia, the free encyclopedia
In computer science, BNF (Backus Normal Form or Backus–Naur Form ) is a notation technique for context-free grammars, often used to describe the syntax of languages used in computing, such as computer programming languages, document formats , instruction sets and communication protocols . It is applied wherever exact descriptions of languages are needed, for instance, in official language specifications, in manuals, and in textbooks on programming language theory.
Many extensions and variants of the original notation are used; some are exactly defined, including Extended Backus–Naur Form (EBNF) and Augmented Backus–Naur Form (ABNF).
History
The idea of describing the structure of language with rewriting rules can be traced back to at least the work of Pāṇini (around 400 BC), who used it in his description of Sanskrit word structure - hence, some suggest to rename BNF to Panini–Backus Form. [ 1] . American linguists such as Leonard Bloomfield and Zellig Harris took this idea a step further by attempting to formalize language and its study in terms of formal definitions and procedures (around 1920-1960)..
Meanwhile, string rewriting rules as formal, abstract systems were introduced and studied by mathematicians such as Axel Thue (in 1914), Emil Post (1920s-1940s) and Alan Turing (1936). Noam Chomsky, teaching linguistics to students of information theory at MIT , combined linguistics and mathematics, by taking what is essentially Thue's formalism as the basis for the description of the syntax of natural language; he also introduced a clear distinction between generative rules (those of context-free grammars) and transformation rules (1956).[ 2] [ 3]
John Backus , a programming language designer at IBM, adopted Chomsky's generative rules[ 4] to describe the syntax of the new programming language IAL, known today as ALGOL 58 (1959),[ 5] using the BNF notation.
Further development of ALGOL led to ALGOL 60; in its report (1963), Peter Naur named Backus's notation Backus Normal Form , and simplified it to minimize the character set used. However, Donald Knuth argued that BNF should rather be read as Backus-Naur Form , as it is "not a normal form in any sense",[ 6] unlike, for instance, Chomsky Normal Form .
Introduction
A BNF specification is a set of derivation rules, written as

BNF是一种用于描述计算机语言语法的形式化技术。它在编程语言、文档格式、指令集和通信协议的规范中广泛使用。BNF的变种包括EBNF和ABNF。该文介绍了BNF的历史、用途,并给出了一些例子。
最低0.47元/天 解锁文章
1250

被折叠的 条评论
为什么被折叠?



