Ihre Browserversion ist veraltet. Wir empfehlen, Ihren Browser auf die neueste Version zu aktualisieren.

The grammar of a language is defined via a syntax definition, expressed in EBNF.

The PILL EBNF (“Extended Backus-Naur-Form”) supports a variety of BNF extensions and follows ISO/IEC 14977:1996(E) (ISO), with some further very useful extensions expected in industrial environments.

Following major changes have been applied to the ISO standard:

  • Lists are explicitly supported by PILL-EBNF language elements
  • A Non-Terminal is an identifier, removing the need of the “,” terminal within EBNF
  • The empty string is an explicit keyword (EPSILON) instead of an absence of expression for improved readability.
  • The ISO terminal “-“ is not supported.

 

Description

Specific PILL EBNF

Generic PILL EBNF

ISO/IEC 14977:1996(E)

Terminal

“+”

“+”

“+”

Non-Terminal

someNT

someNT

someNT

Syntax Rule

NT = expression;

NT = expression;

NT = expression;

Group Element

( expr )

( expr )

( expr )

Optional Element

[ expr ]

[ expr ]

[ expr ]

Optional Repeat

{ expr }

{ expr }

{ expr }

Repeat at least 1

{ expr ; 1 }

{ expr ; 1}

expr , { expr }

Limited Repeat

{ expr ; 0..N }

{ expr ; 1..N }

{ expr ; 0..N }

{ expr ; 1..N }

N * { expr }

expr , N-1 * { expr }

Optional List

< expr1 ;  expr2 >

{ expr1 ;  expr2 }

[ expr1 { expr2  , expr1 } ]

List at least 1

< expr1 ;  expr2; 1>

{ expr1 ;  expr2; 1 }

expr1 { expr2  , expr1 }

Limited List

< expr1 ;  expr2; 0..N >

< expr1 ;  expr2; 1..N >

{ expr1 ;  expr2; 0..N >

{ expr1 ;  expr2; 1..N >

[ expr1 , N-1 * { expr2  , expr1 } ]

expr1 , N-1 * { expr2  , expr1 }

. term = { factor } . factor = “EPSILON” | nonTerminal | terminal | “(“ expression “)” | “[“ expression “]” | “{“ expression [ “;” limits ] “}” | “<“ expression “;” expression [ “;” limits ] “>” | “<<“ expression “;” [ expression ] “;” [ limits ] “>>” . limits = ( “0” | “1” ) [ “..” ( integer | “*” ) ] . terminal = string_literal . nonTerminal = identifier . " v:shapes="Text_x0020_Box_x0020_2">

 

The extensions of PILL EBNF are defined in BNF (Wikipedia) as follows.

Description

Generic PILL EBNF

BNF alternative construction

Terminal

String_literal

String_literal

Non-Terminal

identifier

Identifier

Syntax Rule

NT = expression ;

NT = expression .

Epsilon

NT = EPSILON;

NT = .

 

Alternatives

NT = expr1 | expr2 ;

NT = expr1 .

NT = expr2 .

Group Element

NT = expr1  ( expr ) expr2 ;

NT = expr1  NT_NEW expr2 .

NT_ NEW = expr .

Embedded EBNF Elements

NT = expr1  [ expr ] expr2 ;

NT = expr1  { expr } expr2 ;

NT = expr1  NT_NEW expr2 .

NT_ NEW = [ expr ] .

NT_ NEW =  {  expr } .

Optional Element

NT = [ expr ] ;

NT =  expr  .

NT =  .

Optional Repeat

NT = { expr } ;

NT =  expr  NT .

NT =  .

Repeat at least 1

NT = { expr ; 1} ;

NT =  expr  NT .

NT =  expr  .

Optional List

NT = { expr1 ;  expr2 } ;

NT =  expr1  NT_NEW .

NT =  .

NT_NEW =  expr2 expr1 NT_NEW .

NT_NEW = .

List at least 1

NT = { expr1 ;  expr2; 1 } ;

NT =  expr1  NT_NEW .

NT_NEW =  expr2 expr1 NT_NEW .

NT_NEW = .

Optional Limited Repeat

NT = { expr ; 0..N } ;

Limitation can be expressed in BNF via explicit enumeration, e.g.

NT = { expr ; 0..3 } ;

à

NT = .

NT = expr .

NT = expr expr .

NT = expr expr expr .

Limited Repeat at least 1

NT = { expr ; 1..N } ;

Limitation can be expressed in BNF via explicit enumeration

Optional Limited List

NT = { expr1 ;  expr2; 0..N > ;

Limitation can be expressed in BNF via explicit enumeration

Limited List at least 1

NT = { expr1 ;  expr2; 1..N > ;

Limitation can be expressed in BNF via explicit enumeration