-
Notifications
You must be signed in to change notification settings - Fork 1
/
notes.txt
201 lines (190 loc) · 12.4 KB
/
notes.txt
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
Top-level binding with no type signature: bar2 :: IO ()
*Main> :main
state: 0, token: 1, action: reduce (rule 2), goto state 2
state: 2, token: 1, action: shift, enter state 8
state: 8, token: 2, action: reduce (rule 11), goto state 7
state: 7, token: 2, action: reduce (rule 10), goto state 6
state: 6, token: 2, action: reduce (rule 7), goto state 5
state: 5, token: 2, action: shift, enter state 11
state: 11, token: 1, action: shift, enter state 8
state: 8, token: 6, action: reduce (rule 11), goto state 7
state: 7, token: 6, action: reduce (rule 10), goto state 15
state: 15, token: 6, action: reduce (rule 5), goto state 5
state: 5, token: 6, action: reduce (rule 4), goto state 4
state: 4, token: 6, action: reduce (rule 3), goto state 13
state: 13, token: 6, action: reduce (rule 1), goto state 3
state: 3, token: 6, action: accept.
Plus (Term (Factor (Int 1))) (Factor (Int 2))
-----------------------------------------------------------------------------
:main
state: 0, token: 1, action: reduce A (rule 2), goto state 2
state: 2, token: 1, action: not shift, enter state 8
happyShift:(new_state,i,inp)=(8,1,Node {rootLabel = Val False False (HappyTerminal (TokenInt 1)) [] (Just (Tok 1# (TokenInt 1))) (Nothing), subForest = []})
state: 8, token: 2, action: reduce A (rule 11), goto state 7
state: 7, token: 2, action: reduce A (rule 10), goto state 6
state: 6, token: 2, action: reduce A (rule 7), goto state 5
state: 5, token: 2, action: not shift, enter state 11
happyShift:(new_state,i,inp)=(11,2,Node {rootLabel = Val False False (HappyTerminal TokenPlus) [] (Just (Tok 2# TokenPlus)) (Nothing), subForest = []})
state: 11, token: 1, action: not shift, enter state 8
happyShift:(new_state,i,inp)=(8,1,Node {rootLabel = Val False False (HappyTerminal (TokenInt 2)) [] (Just (Tok 1# (TokenInt 2))) (Nothing), subForest = []})
state: 8, tree: HappyErrorToken (-5), action: shift or breakdown.
state: 8, token: 6, action: reduce A (rule 11), goto state 7
state: 7, token: 6, action: reduce A (rule 10), goto state 15
state: 15, token: 6, action: reduce A (rule 5), goto state 5
state: 5, token: 6, action: reduce A (rule 4), goto state 4
state: 4, token: 6, action: reduce A (rule 3), goto state 13
state: 13, token: 6, action: reduce A (rule 1), goto state 3
state: 3, token: 6, action: accept. A
Val False False (HappyAbsSyn4 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
|
+- Val False False (HappyAbsSyn5 ()) [] (Nothing) (Nothing)
|
+- Val False False (HappyAbsSyn7 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| |
| `- Val False False (HappyAbsSyn8 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 2)))
| |
| +- Val False False (HappyAbsSyn8 (Term (Factor (Int 1)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn9 (Factor (Int 1))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn10 (Int 1)) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyTerminal (TokenInt 1)) [] (Just (Tok 1# (TokenInt 1))) (Nothing)
| |
| +- Val False False (HappyTerminal TokenPlus) [] (Just (Tok 2# TokenPlus)) (Nothing)
| |
| `- Val False False (HappyAbsSyn9 (Factor (Int 2))) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyAbsSyn10 (Int 2)) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyTerminal (TokenInt 2)) [] (Just (Tok 1# (TokenInt 2))) (Nothing)
|
`- Val False False (HappyAbsSyn6 ()) [] (Nothing) (Nothing)
--------------------------------
Val False True (HappyAbsSyn4 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
|
+- Val False False (HappyAbsSyn5 ()) [] (Nothing) (Nothing)
|
+- Val False True (HappyAbsSyn7 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| |
| `- Val False True (HappyAbsSyn8 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 2)))
| |
| +- Val False False (HappyAbsSyn8 (Term (Factor (Int 1)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn9 (Factor (Int 1))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn10 (Int 1)) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyTerminal (TokenInt 1)) [] (Just (Tok 1# (TokenInt 1))) (Nothing)
| |
| +- Val True True (HappyErrorToken (-5)) [Tok -10# TokenMinus] (Nothing) (Nothing)
| |
| `- Val False False (HappyAbsSyn9 (Factor (Int 2))) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyAbsSyn10 (Int 2)) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyTerminal (TokenInt 2)) [] (Just (Tok 1# (TokenInt 2))) (Nothing)
|
`- Val False False (HappyAbsSyn6 ()) [] (Nothing) (Nothing)
--------------------------------
state: 0, tree: HappyAbsSyn4 (Plus (, action: left breakdown.
state: 0, tree: HappyAbsSyn5 (), action: shift or breakdown.
state: 0, tree: HappyAbsSyn7 (Plus (, action: left breakdown.
state: 0, tree: HappyAbsSyn8 (Plus (, action: left breakdown.
state: 0, tree: HappyAbsSyn8 (Term (, action: all reductions.
reduceAll:state: 0, token: 1, action: reduce B (rule 2), goto state 2
reduceAll:state: 2, token: 1, action: no shift.
state: 2, token: 1, action: not shift, enter state 8
happyShift:(new_state,i,inp)=(8,1,Node {rootLabel = Val False False (HappyTerminal (TokenInt 1)) [] (Just (Tok 1# (TokenInt 1))) (Nothing), subForest = []})
state: 8, token: 3, action: reduce A (rule 11), goto state 7
state: 7, token: 3, action: reduce A (rule 10), goto state 6
state: 6, token: 3, action: reduce A (rule 7), goto state 5
state: 5, token: 3, action: not shift, enter state 12
happyShift:(new_state,i,inp)=(12,3,Node {rootLabel = Val False False (HappyTerminal TokenMinus) [] (Just (Tok 3# TokenMinus)) (Nothing), subForest = []})
state: 12, tree: HappyErrorToken (-5), action: left breakdown.
state: 12, tree: HappyAbsSyn9 (Factor, action: all reductions.
reduceAll:state: 12, token: 1, action: no shift.
state: 12, token: 1, action: not shift, enter state 8
happyShift:(new_state,i,inp)=(8,1,Node {rootLabel = Val False False (HappyTerminal (TokenInt 2)) [] (Just (Tok 1# (TokenInt 2))) (Nothing), subForest = []})
state: 8, tree: HappyAbsSyn6 (), action: shift or breakdown.
state: 8, token: 6, action: reduce A (rule 11), goto state 7
state: 7, token: 6, action: reduce A (rule 10), goto state 14
state: 14, token: 6, action: reduce A (rule 6), goto state 5
state: 5, token: 6, action: reduce A (rule 4), goto state 4
state: 4, token: 6, action: reduce A (rule 3), goto state 13
state: 13, token: 6, action: reduce A (rule 1), goto state 3
state: 3, token: 6, action: accept. A
Val False False (HappyAbsSyn4 (Minus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
|
+- Val False False (HappyAbsSyn5 ()) [] (Nothing) (Nothing)
|
+- Val False False (HappyAbsSyn7 (Minus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| |
| `- Val False False (HappyAbsSyn8 (Minus (Term (Factor (Int 1))) (Factor (Int 2)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 2)))
| |
| +- Val False False (HappyAbsSyn8 (Term (Factor (Int 1)))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn9 (Factor (Int 1))) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn10 (Int 1)) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyTerminal (TokenInt 1)) [] (Just (Tok 1# (TokenInt 1))) (Nothing)
| |
| +- Val False False (HappyTerminal TokenMinus) [] (Just (Tok 3# TokenMinus)) (Nothing)
| |
| `- Val False False (HappyAbsSyn9 (Factor (Int 2))) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyAbsSyn10 (Int 2)) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyTerminal (TokenInt 2)) [] (Just (Tok 1# (TokenInt 2))) (Nothing)
|
`- Val False False (HappyAbsSyn6 ()) [] (Nothing) (Nothing)
*Main> :r
--------------------------------------------------------------------------
Input (modified) tree
Val False True (HappyAbsSyn4 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) (Just 0) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 2)))
|
+- Val False False (HappyAbsSyn5 ()) (Just 1) [] (Nothing) (Nothing)
|
+- Val False True (HappyAbsSyn7 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) (Just 3) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False True (HappyAbsSyn8 (Plus (Term (Factor (Int 1))) (Factor (Int 2)))) (Just 4) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 2)))
| |
| +- Val False False (HappyAbsSyn8 (Term (Factor (Int 1)))) (Just 4) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn9 (Factor (Int 1))) (Just 5) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyAbsSyn10 (Int 1)) (Just 6) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| | |
| | `- Val False False (HappyTerminal (TokenInt 1)) (Nothing) [] (Just (Tok 1# (TokenInt 1))) (Just (Tok 1# (TokenInt 1)))
| |
| +- Val True True (HappyErrorToken (-5)) (Nothing) [Tok -10# TokenMinus] (Nothing) (Nothing)
| |
| `- Val False False (HappyAbsSyn9 (Factor (Int 2))) (Just 5) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyAbsSyn10 (Int 2)) (Just 6) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
| |
| `- Val False False (HappyTerminal (TokenInt 2)) (Nothing) [] (Just (Tok 1# (TokenInt 2))) (Just (Tok 1# (TokenInt 2)))
|
`- Val False False (HappyAbsSyn6 ()) (Just 2) [] (Nothing) (Nothing)
--------------------------------------------------------------------------------
For each (state, non-terminal), give goto val
Goto:array (0,17)
[(0,array (4,10) [(4,Goto 3),(5,Goto 2),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(1,array (4,10) [(4,NoGoto),(5,Goto 2),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(2,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,Goto 4),(8,Goto 5),(9,Goto 6), (10,Goto 7)])
,(3,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(4,array (4,10) [(4,NoGoto),(5,NoGoto),(6,Goto 13),(7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(5,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(6,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(7,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(8,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(9,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,Goto 17)])
,(10,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,Goto 16)])
,(11,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,Goto 15),(10,Goto 7)])
,(12,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,Goto 14),(10,Goto 7)])
,(13,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(14,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(15,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(16,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])
,(17,array (4,10) [(4,NoGoto),(5,NoGoto),(6,NoGoto), (7,NoGoto),(8,NoGoto),(9,NoGoto), (10,NoGoto)])]