-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSYNTAX
48 lines (25 loc) · 1.06 KB
/
SYNTAX
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
# this is an informal BNF of the syntax for rmutt. consult rmutt.lex
# and rmutt.y for the exact syntax.
grammar ::= (statement | include)*;
include ::= "#include \"" filename "\"";
statement ::= (rule | package) ";"
package ::= "package" package-name;
rule ::= definition | assignment;
definition ::= name ":" body;
assignment ::= name "=" body;
body ::= choice | body choice-separator choice;
choice-separator ::= "," | "|";
choice ::= terms [probability-multiplier] | ;
probability-multiplier ::= integer ;
terms ::= qualified-term | terms qualified-term;
qualified-term ::= term | qualified-term repetition-qualifier | qualified-term ">" term;
repetition-qualifier ::= "{" [min ","] max "}" | "*" | "+" | ";";
term ::= packaged-label | literal | "(" rule ")" | rx-sub | mapping;
mapping ::= literal "=" literal;
packaged-label ::= label | namespace label;
namespace ::= label ".";
literal ::= "\"" char* "\"";
label ::= label-initial-char label-char*;
rx-sub ::= "/" pattern "/" substitution "/";
label-initial-char ::= [A-Za-z_];
label-char ::= [A-Za-z0-9_-];