-
Notifications
You must be signed in to change notification settings - Fork 8
/
RawSyntax.hs
51 lines (37 loc) · 1.13 KB
/
RawSyntax.hs
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
{-# LANGUAGE QuasiQuotes, TemplateHaskell #-}
module RawSyntax where
import Language.LBNF
bnfc [lbnf|
comment "--" ;
comment "{-" "-}" ;
ETag. Exp6 ::= "'" AIdent;
EFin. Exp6 ::= OpenBrack [AIdent] "]";
ECas. Exp6 ::= "case" Open [Defin] "}" ;
EHole. Exp6 ::= Hole ;
EVar. Exp6 ::= AIdent ;
ESet. Exp6 ::= Sort ;
EProj. Exp4 ::= Exp4 "." AIdent ;
EApp. Exp3 ::= Exp3 Exp4 ;
EPi. Exp2 ::= Exp3 Arrow Exp2 ;
ESigma. Exp2 ::= Open [Exp] "}" ;
EAbs. Exp2 ::= "\\" [Bind] Arrow Exp2 ;
EThis. Exp6 ::= "this" ;
EAnn. Exp1 ::= Exp2 ":" Exp1 ;
EPair. Exp ::= [Defin] ;
coercions Exp 6 ;
separator Exp ";";
Def. Defin ::= AIdent "=" Exp ;
separator nonempty Defin ",";
separator AIdent ",";
token Arrow ('-' '>') ;
NoBind. Bind ::= AIdent ;
Bind. Bind ::= "(" AIdent ":" Exp ")" ;
AIdent. AIdent ::= Identifier ;
terminator Bind "" ;
token Natural digit+;
position token Open ('{');
position token OpenBrack ('[');
position token Identifier ('!'|letter|digit|'-'|'_')((letter|digit|'-'|'_'|'\'')*) ;
position token Hole '?' ((letter|digit|'-'|'_'|'\'')*) ;
position token Sort ('#' | '*' (digit*));
|]