-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExp.cf
More file actions
69 lines (55 loc) · 1.94 KB
/
Exp.cf
File metadata and controls
69 lines (55 loc) · 1.94 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
entrypoints Exp ;
comment "--" ;
comment "{-" "-}" ;
layout "where", "let", "split", "mutual", "module" ;
layout stop "in" ;
-- Do not use layout toplevel as it makes pExp fail!
Field. Fld ::= AIdent "=" Exp ;
separator Fld ",";
DeclDef. Decl ::= AIdent [AIdent] "=" ExpWhere ;
DeclType. Decl ::= AIdent ":" Exp ;
DeclOpen. Decl ::= "open" Exp ;
DeclMutual. Decl ::= "mutual" "{" [Decl] "}" ;
separator Decl ";" ;
Where. ExpWhere ::= Exp "where" "{" [Decl] "}" ;
NoWhere. ExpWhere ::= Exp ;
Let. Exp ::= "let" "{" [Decl] "}" "in" Exp ;
Lam. Exp1 ::= "\\" AIdent [AIdent] "->" Exp1 ;
TLam. Exp1 ::= "\\" "(" PseudoTDecl ")" "->" Exp1 ;
Fun. Exp1 ::= Exp2 "->" Exp1 ;
LFun. Exp1 ::= Exp2 "-o" Exp1 ;
Pi. Exp1 ::= "(" PseudoTDecl ")" "->" Exp1 ;
Or. Exp2 ::= Exp2 "\\/" Exp2;
And. Exp3 ::= Exp3 "/\\" Exp3;
App. Exp4 ::= Exp4 Exp5 ;
Singleton. Exp5 ::= Exp5 "/" Exp;
Proj. Exp5 ::= Exp5 "." AIdent ;
Module. Exp6 ::= "module" "{" [Decl] "}" ;
Tuple. Exp6 ::= "(" [Fld] ")" ;
Record. Exp6 ::= "[" [PseudoTDecl] "]" ;
Sum. Exp6 ::= "{" [Label] "}";
Var. Exp6 ::= AIdent ;
U. Exp6 ::= "Type" ;
Real. Exp6 ::= Double ;
Split. Exp6 ::= "split" "{" [Branch] "}" ;
PrimOp. Exp6 ::= "primitive" String;
Import. Exp6 ::= "import" AIdent ;
Con. Exp6 ::= "'" AIdent;
coercions Exp 6 ;
separator Exp "," ;
-- Branches
Branch. Branch ::= "'" AIdent "->" ExpWhere ;
separator Branch ";" ;
-- Labelled sum alternatives
Label. Label ::= "'" AIdent ;
separator Label "|" ;
-- Nonempty telescopes with Exp:s, this is hack to avoid ambiguities
-- in the grammar when parsing Pi
PseudoTDecl. PseudoTDecl ::= Exp ":" Exp ;
WPseudoTDecl. PseudoTDecl ::= Exp "::" Weight Exp ;
Positive. Weight ::= "+" ;
Negative. Weight ::= "-" ;
Exact. Weight ::= Integer ;
separator PseudoTDecl ";" ;
position token AIdent ((letter|'_'|'`')(letter|digit|'\''|'_')*) ;
terminator AIdent "" ;