-
Notifications
You must be signed in to change notification settings - Fork 0
/
ino.vartan
65 lines (63 loc) · 763 Bytes
/
ino.vartan
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
#name ino;
root
: decls opt_nl #ast decls
;
decls
: decls nl decl #ast decls... decl
| decl
;
decl
: data
;
data
: kw_data id ty_vars opt_nl def conss semicolon #ast id ty_vars conss
;
ty_vars
: ty_vars ty_var #ast ty_vars... ty_var
| ty_var
|
;
ty_var
: id
;
conss
: conss or cons #ast conss... cons
| cons
;
cons
: id opt_type_lits opt_nl #ast id opt_type_lits
;
type_lit
: id
| l_paren id ty_vars r_paren #ast id ty_vars
;
type_lits
: type_lits type_lit #ast type_lits... type_lit
| type_lit
;
opt_type_lits
: type_lits
|
;
opt_nl
: nl
|
;
ws #skip
: "[\u{0009}\u{0020}]+";
nl
: "[\u{000A}\u{000D}]+";
def
: '=';
or
: '|';
semicolon
: ';';
l_paren
: '(';
r_paren
: ')';
kw_data
: 'data';
id
: "[A-Za-z][A-Za-z0-9]*";