forked from RobertHarper/cmyacc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsemain-hs.cmyacc
77 lines (63 loc) · 1.91 KB
/
parsemain-hs.cmyacc
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
name ParseMainFunHs
terminal LIDENT of string
terminal UIDENT of string
terminal NUMBER of int
terminal ARROW
terminal COLON
terminal DATA
terminal DOT
terminal EQUAL
terminal FOLLOWER
terminal MONADIC
terminal NAME
terminal NONTERMINAL
terminal NOPREC
terminal LPAREN
terminal OF
terminal PRECL
terminal PRECR
terminal RPAREN
terminal START
terminal TERMINAL
nonterminal LIdent : symbol =
1:LIDENT => sole_lident
nonterminal UIdent : symbol =
1:UIDENT => sole_uident
nonterminal Number : int =
1:NUMBER => sole_number
nonterminal Label : label =
/* Don't allow named labels in CM-Yacc-Haskell. */
1:Number => number_label
nonterminal Constituent : constituent =
1:UIdent => unlabeled_item
1:Label COLON 2:UIdent => labeled_item
LPAREN 1:Constituent RPAREN => paren_item
nonterminal Constituents : constituents =
=> nil_constituents
1:Constituent 2:Constituents => cons_constituents
nonterminal Precedence : precedence =
=> empty_precedence
PRECL 1:Number => left_precedence
PRECR 1:Number => right_precedence
NOPREC => no_precedence
nonterminal Production : production =
1:Constituents ARROW 2:LIdent 3:Precedence => sole_production
nonterminal Productions : productions =
=> nil_productions
1:Production 2:Productions => cons_productions
nonterminal QIdent : qident =
1:UIDENT => sing_qident
1:UIDENT DOT 2:QIdent => cons_qident
nonterminal Directive : directive =
NAME 1:QIdent => name_directive
DATA 1:UIDENT => data_directive
MONADIC => monadic_directive
TERMINAL 1:UIdent 2:Precedence => terminal_directive
TERMINAL 1:UIdent OF 2:LIdent 3:Precedence => terminal_of_directive
NONTERMINAL 1:UIdent COLON 2:LIdent EQUAL 3:Productions => nonterminal_directive
START 1:UIdent => start_directive
FOLLOWER 1:UIdent => follower_directive
nonterminal Directives : directives =
=> nil_directives
1:Directive 2:Directives => cons_directives
start Directives