bnf.1.1.26.source-code.iso14977.informally.ebnf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebnf Show documentation
Show all versions of ebnf Show documentation
a simple parser combinator inspired by RelaxNG
The newest version!
(*
This example defines Extended BNF
informally. Many of the syntax rules include
a comment to explain their meaning; inside a
comment a meta identifier is enclosed in angle
brackets < and > to avoid confusion with
similar English words. The non-terminal symbols
, and are
not defined. The position of is
stated in a comment but not formally defined.
*)
syntax = syntax rule, {syntax rule};
syntax rule
= meta identifier, ’=’, definitions list, ’;’
(* A defines the sequences of
symbols represented by a *);
definitions list
= single definition, {’|’, single definition}
(* | separates alternative
*);
single definition = term, {’,’, term}
(* , separates successive *);
term = factor, [’-’, exception]
(* A represents any sequence of symbols
that is defined by the but
not defined by the *);
exception = factor
(* A may be used as an
if it could be replaced by a
containing no *);
factor = [integer, ’*’], primary
(* The specifies the number of
repetitions of the *);
primary
= optional sequence
| repeated sequence
| special sequence
| grouped sequence
| meta identifier
| terminal string
| empty;
empty = ;
optional sequence = ’[’, definitions list, ’]’
(* The brackets [ and ] enclose symbols
which are optional *);
repeated sequence = ’{’, definitions list, ’}’
(* The brackets { and } enclose symbols
which may be repeated any number of times *);
grouped sequence = ’(’, definitions list, ’)’
(* The brackets ( and ) allow any
to be a *);
terminal string
= "’", character - "’", {character - "’"}, "’"
| ’"’, character - ’"’, {character - ’"’}, ’"’
(* A represents the
between the quote symbols
’_’ or "_" *);
meta identifier = letter, {letter | decimal digit}
(* A is the name of a
syntactic element of the language being
defined *);
integer = decimal digit, {decimal digit};
special sequence = ’?’, {character - ’?’}, ’?’
(* The meaning of a is not
defined in the standard metalanguage. *);
comment = ’(*’, {comment symbol}, ’*)’
(* A comment is allowed anywhere outside a
, ,
or *);
comment symbol
= comment
| terminal string
| special sequence
| character; © 2015 - 2025 Weber Informatics LLC | Privacy Policy