BNF notation
/ B-N-F (Backus-Naur Form) /
Mathematicians write a context-free grammar as a tuple (V, Σ, R, S); engineers writing an actual language specification need something they can type and read in a manual. BNF is that practical notation — a clean, standardised way to write down the production rules of a grammar, used in language reference documents the world over. It is not a new kind of grammar, just a convenient way to spell one out.
In classic BNF (Backus-Naur Form, introduced for the ALGOL 60 report), nonterminals are written in angle brackets like <expr> or <stmt>, the rewrite arrow → is written ::= (read 'is defined as'), alternatives are separated by a vertical bar |, and terminals are written literally. A rule looks like <expr> ::= <expr> + <term> | <term>. So the math rule E → E + T | T becomes <expr> ::= <expr> + <term> | <term> — exactly the same grammar, dressed for engineers. EBNF (Extended BNF) adds convenience shorthands borrowed from regular expressions: braces { X } for 'zero or more X', square brackets [ X ] for 'optional X', and parentheses for grouping, which makes common patterns like repeated and optional items far less verbose.
BNF and EBNF are how syntax is communicated in practice: the reference manual of nearly every programming language, many file formats, and the specifications of network protocols define their grammar in some BNF dialect. A point of honesty: EBNF's braces and brackets are pure convenience — anything written in EBNF can be rewritten as a plain CFG by introducing extra nonterminals (for example { X } becomes a fresh recursive rule), so EBNF does not add expressive power beyond context-free grammars. Also beware that there are several incompatible BNF dialects with small notational differences; always check which one a document is using.
BNF: <if-stmt> ::= if <cond> then <stmt> | if <cond> then <stmt> else <stmt>. EBNF with shorthands: <number> ::= <digit> { <digit> } and <sign-num> ::= [ - ] <number>, where { } means 'repeat zero or more' and [ ] means 'optional'.
BNF: ::= for →, | for alternatives, <…> for nonterminals. EBNF adds { } (repeat) and [ ] (optional) as shorthand.
EBNF's { } and [ ] are pure convenience — they add NO power beyond context-free grammars (each can be rewritten with extra nonterminals). Several incompatible BNF dialects exist, so check which notation a document uses.