-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The notation used to specify grammars is an extended BNF notation, or EBNF.
The syntax of GLL EBNF is described in itself in the GLL grammar file:
Its semantics are as follows:
Reserved Words are denoted by all-uppercase names.
Example: FOOBAR
Names that start with a capital letter represent terminal symbols.
Example: Foobar
Names that start with a lowercase letter represent non-terminal symbols.
Example: foobar
Literals are enclosed in single or double quotes.
Examples: 'foo'
, "bar"
A double-period ..
is used between digit or character literals to denote a range.
Example: '0' .. '9'
The definition symbol :=
is used between a name of a production rule and its body.
Example: foo := bar ;
A semicolon ;
is used to terminate a production rule.
Example: foo := bar ;
Reserved word alias
is used as a prefix to denote an alias name definition.
Example: alias foo = bar ;
A period .
is used as a prefix to denote a fragment definition. Fragments may be
used within terminal symbol definitions to inline syntactic entities. Unlike names
of terminal symbols, fragment names are not tokens.
Example: .Digit := '0' .. '9' ;
An asterisk *
is used as a prefix to denote a non-semantic symbol definition,
such as pragmas and comments.
Example: *Comment := '/*' ( AnyChar | Newline )* '*/' ;
A vertical bar |
is used to separate logical alternatives.
Example: foo := bar | baz ;
A trailing question mark ?
is used to denote zero or one occurrence.
Example: foo := bar baz? ;
A trailing plus +
is used to denote one or more occurrences.
Example: foo := bar baz+ ;
A trailing asterisk *
is used to denote zero or more occurrences.
Example: foo := bar baz* ;
- Parentheses
(
and)
are used to group syntactic entities. - A comma
,
is used to group syntactic entities and to indicate a wrap-around point when generating diagrams.
Examples:
list := foo ( ',' foo )* ;
foo := bar baz, bam | boo ;
Opening delimiter /*
is used to start a comment and closing delimiter */
is used to terminate it.
Example: /* this is a comment */
[END OF FILE]