summaryrefslogtreecommitdiff
path: root/src/GF/CFGM/CFG.cf
blob: c6b5c751b4c049e895eb55059849690453976473 (plain)
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
54
entrypoints Grammars;

Grammars. Grammars ::= [Grammar];

Grammar. Grammar ::= "grammar" Ident [Flag] [Rule] "end" "grammar";
separator Grammar "";

StartCat. Flag ::= "startcat" Category;
terminator Flag ";";

Rule. Rule ::= Ident ":" Name Profile "." Category "->" [Symbol];
terminator Rule ";";

Profile. Profile ::= "[" [Ints] "]";

Ints. Ints ::= "[" [Integer] "]";
separator Ints ",";
separator Integer ",";

CatS. Symbol ::= Category;
TermS. Symbol ::= String;

-- separator Symbol "";
[]. [Symbol] ::= "." ;
(:[]). [Symbol] ::= Symbol ;
(:). [Symbol] ::= Symbol [Symbol] ;

Name. Name ::= SingleQuoteString ;
Category. Category ::= SingleQuoteString ;

token SingleQuoteString '\'' ((char - ["'\\"]) | ('\\' ["'\\"]))* '\'' ;

{-
Name. Name ::= [IdentParam] Category;
terminator IdentParam "/";

Category. Category ::= IdentParam "." Ident [Proj] ;

IdentParam. IdentParam ::= Ident "{" [Field] "}" ;

Field. Field ::= "." KeyValue ;
terminator Field ";" ;

Proj. Proj ::= "!" Param ;
separator Proj "" ;

KeyValue. KeyValue ::= Ident "=" Param ;
separator KeyValue ";" ;

ParamSimple. Param ::= Ident ;
ParamPatt. Param ::= Ident "(" [Param] ")" ;
ParamRec. Param ::= "{" [KeyValue] "}" ;
separator Param "," ;
-}