EBNF or Extended Backus-Naur Form ISO 14977: 1996 , and is available in PDF format from ISO for free * . It is not widely used by computer language standards. There is also paper that describes this, and this document contains this table, which summarizes the EBNF notation.
Table 1: Extended BNF Extended BNF Operator Meaning ------------------------------------------------------------- unquoted words Non-terminal symbol " ... " Terminal symbol ' ... ' Terminal symbol ( ... ) Brackets [ ... ] Optional symbols { ... } Symbols repeated zero or more times { ... }- Symbols repeated one or more timesβ = in Defining symbol ; post Rule terminator | in Alternative , in Concatenation - in Except * in Occurrences of (* ... *) Comment ? ... ? Special sequence
The * operator is used with the previous (unsigned) integer; it does not seem to allow variable numbers of repetitions - for example, 1-15 characters after the start character to make identifiers up to 16 characters long. It is lis
In the standard, an open bracket ( called the start symbol of the group, and a closing bracket ) is called the symbol of the final group; the open square bracket [ is the symbol of the start option, and the closed square bracket is the symbol of the end of the end; the open bracket { is the start character of the replay and the closing bracket } is the end of the replay character. The single quotation marks ' are called the first quote character, and the double quotation marks " are the second quote character.
* Yes, for free - even if you can pay for it 74 CHF if you want. Look at the note under the box containing the rechargeable items.
The question is aimed at converting this "BNF" to EBNF:
<vardec> ::= var <vardeclist>; <vardeclist> ::= <varandtype> {;<varandtype>} <varandtype> ::= <ident> {,<ident>} : <typespec> <ident> ::= <letter> {<idchar>} <idchar> ::= <letter> | <digit> | _
BNF is not formally defined, so we need to make some (easy) guesses about what this means. The translation is routine (it can be mechanical if the form of the BNF is formally defined):
vardec = 'var', vardeclist, ';'; vardeclist = varandtype, { ';', varandtype }; varandtype = ident, { ',', ident }, ':', typespec; ident = letter, { idchar }; idchar = letter | digit | '_';
Angle brackets must be removed around non-terminals; definition symbol ::= is replaced by = ; terminals such as ; and _ are enclosed in quotation marks; concatenation is clearly marked; and each rule ends with ; . Grouping and alternative operations in the original coincide with standard notation. Note that explicit concatenation with a comma means that verbose non-terminals are unique.
β A random study of the standard itself suggests that the notation {...}- not part of the standard, namely the article. However, since jmmut notes in comment , the standard defines the value {β¦}- :
Β§5.8 Syntactic term
...
When a syntactic term is a syntactic factor, followed by the exception of a character, followed by a syntactic exception, represents any sequence of characters that satisfies the conditions:
a) is a sequence of characters represented by a syntactic factor,
b) This is not a sequence of characters represented by a syntax-exception.
...
NOTE. { "A" } - represents a sequence of one or more A, because it is a syntactic term with an empty syntax exception.