Repository navigation
Expand file tree
/
Copy pathtest.cf
More file actions
101 lines (64 loc) · 1.89 KB
/
Copy pathtest.cf
File metadata and controls
101 lines (64 loc) · 1.89 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
-- single line comment
[]. [Stm] ::= ;
(:). [Stm] ::= Stm ";" [Stm] ;
EPlus. Exp ::= Exp "+" Num ;
ENum. Exp ::= Num ;
NOne. Num ::= "1" ;
Char_a. Char ::= "a" ;
Char_b. Char ::= "b" ;
_ . Stm ::= Stm ";" ;
EInt. Exp3 ::= Integer ;
ETimes. Exp2 ::= Exp2 "*" Exp3 ;
EPlus. Exp ::= Exp "+" Exp2 ;
_. Exp ::= Exp2 ;
_. Exp2 ::= Exp3 ;
_. Exp3 ::= "(" Exp ")" ;
NilDef. ListDef ::= ;
ConsDef. ListDef ::= Def ";" ListDef ;
[]. [Def] ::= ;
(:). [Def] ::= Def ";" [Def] ;
comment "//" ;
comment "/*" "*/" ;
internal EVarT. Exp ::= "(" Ident ":" Type ")";
entrypoints Stm, Exp ;
token UIdent (upper (letter | digit | '_')*) ;
position token PIdent (letter (letter|digit|'_'|'\'')*) ;
terminator Stm ";" ;
[]. [Stm] ::= ;
(:). [Stm] ::= Stm ";" [Stm] ;
terminator nonempty Stm ";" ;
(:[]). [Stm] ::= Stm ";" ;
(:). [Stm] ::= Stm ";" [Stm] ;
terminator Stm "" ;
[]. [Stm] ::= ;
(:). [Stm] ::= Stm [Stm] ;
separator Stm ";" ;
[]. [Stm] ::= ;
(:[]). [Stm] ::= Stm ;
(:). [Stm] ::= Stm ";" [Stm] ;
separator nonempty Stm ";" ;
(:[]). [Stm] ::= Stm ;
(:). [Stm] ::= Stm ";" [Stm] ;
coercions Exp 3 ;
_. Exp ::= Exp1 ;
_. Exp1 ::= Exp2 ;
_. Exp2 ::= Exp3 ;
_. Exp3 ::= "(" Exp ")" ;
EInt. Exp2 ::= Integer;
EAdd. Exp1 ::= Exp1 "+" Exp2;
Foo. F ::= "foo" Exp2 ;
separator Exp "," ;
separator Exp2 ";" ;
rules Type ::= [Type] "[" Integer "]" | "float" | "double" | Type "*" ;
Type_0. Type ::= Type "[" Integer "]" ;
Type_float. Type ::= "float" ;
Type_double. Type ::= "double" ;
Type_3. Type ::= Type "*" ;
layout "of" , "let", "where", "sig", "struct" ;
ECase. Exp ::= "case" Exp "of" "{" [Branch] "}" ;
separator Branch ";" ;
layout stop "in" ;
layout toplevel ;
While ([],[0])([],[1])([],[2]). Stm ::= "while" "(" Exp ")" Stm Stm ;
Decl ([],[0])([[1]],[2]). Stm ::= Typ Ident ";" Stm ;
IsAlways ([],[0,1]). Sentence ::= "a" Noun "is" "always" "a" Noun ;