-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEBNF.ebnf
53 lines (35 loc) · 1.17 KB
/
EBNF.ebnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(* This is a modifed version of the informal definition in the ISO 14977 *)
syntax = syntax-rule, {syntax-rule};
syntax-rule = meta-identifier, '=', definitions-list, ';';
definitions-list = single-definition , { '|', single-definition };
single-definition = term, { ',', term };
term = factor, [ '-', terminal ];
factor = [integer, '*'], primary;
primary = terminal | non-terminal;
non-terminal
= optional-sequence
| repeated-sequence
| grouped-sequence
| meta-identifier
;
terminal
= special-sequence
| terminal-string
| empty
;
empty = ;
optional-sequence = '[', definitions-list, ']';
repeated-sequence = '{', definitions-list, '}';
grouped-sequence = '(', definitions-list, ')';
terminal-string = "'", character - "'", {character - "'"}, "'"
| '"', character - '"', {character - '"'}, '"'
;
meta-identifier = letter, {letter | decimal-digit};
integer = decimal-digit, {decimal-digit};
special-sequence = '?', {character - '?'}, '?';
comment = '(*', {comment-symbol}, '*)';
comment-symbol = comment
| terminal-string
| special-sequence
| character
;