File: ExecutionPlan2Clean.hs

package info (click to toggle)
uuagc 0.9.56-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,764 kB
  • sloc: haskell: 84,340; makefile: 11
file content (7001 lines) | stat: -rw-r--r-- 423,987 bytes parent folder | download
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
{-# LANGUAGE Rank2Types, GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}

module ExecutionPlan2Clean where
{-# LINE 2 "src-ag/HsToken.ag" #-}

import CommonTypes
import UU.Scanner.Position(Pos)
{-# LINE 10 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 2 "src-ag/Expression.ag" #-}

import UU.Scanner.Position(Pos)
import HsToken
{-# LINE 16 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 2 "src-ag/Patterns.ag" #-}

-- Patterns.ag imports
import UU.Scanner.Position(Pos)
import CommonTypes (ConstructorIdent,Identifier)
{-# LINE 23 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 2 "src-ag/ExecutionPlan.ag" #-}

-- VisitSyntax.ag imports
import Patterns    (Pattern(..),Patterns)
import Expression  (Expression(..))
import CommonTypes
import ErrorMessages

import qualified Data.Set as Set
import Data.Set(Set)
import qualified Data.Map as Map
import Data.Map(Map)
{-# LINE 37 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 7 "src-ag/ExecutionPlan2Clean.ag" #-}

import ExecutionPlan
import Pretty
import PPUtil
import Options
import Data.Monoid(mappend,mempty)
import Data.Maybe
import Debug.Trace
import System.IO
import System.Directory
import System.FilePath
import UU.Scanner.Position

import TokenDef
import HsToken
import ErrorMessages

import Data.Set (Set)
import qualified Data.Set as Set
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Sequence(Seq)
import qualified Data.Sequence as Seq
import Data.Foldable(toList)
{-# LINE 64 "src-generated/ExecutionPlan2Clean.hs" #-}
import Control.Monad.Identity (Identity)
import qualified Control.Monad.Identity
{-# LINE 190 "src-ag/ExecutionPlan2Clean.ag" #-}

classCtxsToDocs :: ClassContext -> [PP_Doc]
classCtxsToDocs = map toDoc where
  toDoc (ident,args) = (ident >#< ppSpaced (map pp_parens args))

classConstrsToDocs :: [Type] -> [PP_Doc]
classConstrsToDocs = map ppTp

ppClasses :: [PP_Doc] -> PP_Doc
ppClasses [] = empty
ppClasses xs = "|" >#< pp_block "" "" "&" xs

ppQuants :: [Identifier] -> PP_Doc
ppQuants [] = empty
ppQuants ps = "E." >#< ppSpaced ps >#< ":"
{-# LINE 83 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 227 "src-ag/ExecutionPlan2Clean.ag" #-}

-- first parameter indicates: generate a record or not
ppConFields :: Bool -> [PP_Doc] -> PP_Doc
ppConFields True  flds = ppListSep "{" "}" ", " flds
ppConFields False flds = ppSpaced flds
{-# LINE 91 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 260 "src-ag/ExecutionPlan2Clean.ag" #-}

ppTp :: Type -> PP_Doc
ppTp = text . typeToHaskellString Nothing []
{-# LINE 97 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 333 "src-ag/ExecutionPlan2Clean.ag" #-}

isRecordConstructor :: NontermIdent -> Map NontermIdent ConstructorType -> Bool
isRecordConstructor nt ctm = Map.lookup nt ctm == Just RecordConstructor
{-# LINE 103 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 374 "src-ag/ExecutionPlan2Clean.ag" #-}
type VisitStateState = (VisitIdentifier,StateIdentifier, StateIdentifier)
{-# LINE 107 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 483 "src-ag/ExecutionPlan2Clean.ag" #-}

conNmTVisit nt vId      = "T_" >|< nt >|< "_v"    >|< vId
conNmTVisitIn nt vId    = "T_" >|< nt >|< "_vIn"  >|< vId
conNmTVisitOut nt vId   = "T_" >|< nt >|< "_vOut" >|< vId
conNmTNextVisit nt stId = "T_" >|< nt >|< "_s"    >|< stId

ppMonadType :: Options -> PP_Doc
ppMonadType opts
  | parallelInvoke opts = text "IO"
  | otherwise           = text "Identity"
{-# LINE 120 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 652 "src-ag/ExecutionPlan2Clean.ag" #-}

ppDefor :: Type -> PP_Doc
ppDefor (NT nt args _) = "T_" >|< nt >#< ppSpaced (map pp_parens args)
ppDefor (Haskell s)    = text s
{-# LINE 127 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 756 "src-ag/ExecutionPlan2Clean.ag" #-}

mklet :: (PP a, PP b, PP c) => a -> b -> c -> PP_Doc
mklet prefix defs body =
  prefix
  >-< indent (length (show prefix))
    ("let"
     >-< indent 4 defs
     >-< "in" >#< body)
{-# LINE 138 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 817 "src-ag/ExecutionPlan2Clean.ag" #-}

resultValName :: String
resultValName = "ag__result_"

nextStName :: String
nextStName = "ag__st_"
{-# LINE 147 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 878 "src-ag/ExecutionPlan2Clean.ag" #-}

parResultName :: String
parResultName = "__outcome_"

fmtDecl :: PP a => Bool -> FormatMode -> a -> PP_Doc
fmtDecl declPure fmt decl = case fmt of
  FormatLetDecl -> pp decl
  FormatLetLine -> "let" >#< decl >#< "in"
  FormatDo | declPure  -> "let" >#< decl >#< "in"
           | otherwise -> pp decl
{-# LINE 160 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 992 "src-ag/ExecutionPlan2Clean.ag" #-}

stname :: Identifier -> Int -> String
stname child st = "st_" ++ getName child ++ "X" ++ show st

-- should actually return some conversion info
compatibleAttach :: VisitKind -> NontermIdent -> Options -> Bool
compatibleAttach _ _ _ = True

unMon :: Options -> PP_Doc
unMon options
  | parallelInvoke options = text "'System.IO.Unsafe'.unsafePerformIO"    -- IO monad
  | otherwise              = text "'Control.Monad.Identity'.runIdentity"  -- identity monad
{-# LINE 175 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1079 "src-ag/ExecutionPlan2Clean.ag" #-}

dummyPat :: Options -> Bool -> PP_Doc
dummyPat opts noArgs
  | not noArgs && tupleAsDummyToken opts = empty  -- no unnecessary tuples
  | tupleAsDummyToken opts = if strictDummyToken opts
                             then text "Void"
                             else text "(_)"
  | otherwise              = let match | strictDummyToken opts = "!_"
                                       | otherwise             = "_"
                             in pp_parens (match >#< "::" >#< dummyType opts noArgs)
  where match | strictDummyToken opts = "(!_)"
              | otherwise             = "_"

dummyArg :: Options -> Bool -> PP_Doc
dummyArg opts noArgs
  | not noArgs && tupleAsDummyToken opts = empty    -- no unnecessary tuples
  | tupleAsDummyToken opts = text "Void"
  | otherwise              = text "GHC.Prim.realWorld#"

dummyType :: Options -> Bool -> PP_Doc
dummyType opts noArgs
  | not noArgs && tupleAsDummyToken opts = empty     -- no unnecessary tuples
  | tupleAsDummyToken opts = text "Void"
  | otherwise              = text "(GHC.Prim.State# GHC.Prim.RealWorld)"
{-# LINE 202 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1105 "src-ag/ExecutionPlan2Clean.ag" #-}

-- rules are "deinlined" to prevent needless code duplication.
-- if there is only a bit of duplication, we allow ghc to decide if it is worth it.
-- if the duplication crosses this threshold, however, we tell ghc definitely not to inline it.
ruleInlineThresholdSoft :: Int
ruleInlineThresholdSoft = 3

ruleInlineThresholdHard :: Int
ruleInlineThresholdHard = 5

reallyOftenUsedThreshold :: Int
reallyOftenUsedThreshold = 12
{-# LINE 217 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1172 "src-ag/ExecutionPlan2Clean.ag" #-}

data NonLocalAttr
  = AttrInh Identifier Identifier
  | AttrSyn Identifier Identifier deriving Show

mkNonLocalAttr :: Bool -> Identifier -> Identifier -> NonLocalAttr
mkNonLocalAttr True  = AttrInh  -- True: inherited attr
mkNonLocalAttr False = AttrSyn

lookupAttrType :: NonLocalAttr -> Map Identifier Attributes -> Map Identifier Attributes -> Map Identifier Type -> Maybe PP_Doc
lookupAttrType (AttrInh child name) inhs _ = lookupType child name inhs
lookupAttrType (AttrSyn child name) _ syns = lookupType child name syns

-- Note: if the child takes type parameters, the type of an attribute of this child may refer to these parameters. This means that
-- the actual type of the attribute needs to have its type parameters substituted with the actual type argument of the child.
-- However, for now we simply decide to return Nothing in this case, which skips the type annotation.
lookupType :: Identifier -> Identifier -> Map Identifier Attributes -> Map Identifier Type -> Maybe PP_Doc
lookupType child name attrMp childMp
  | noParameters childTp = Just ppDoc
  | otherwise            = Nothing
  where
    attrTp     = Map.findWithDefault (error "lookupType: the attribute is not in the attrs of the child") name childAttrs
    childAttrs = Map.findWithDefault (error "lookupType: the attributes of the nonterm are not in the map") nonterm attrMp
    nonterm    = extractNonterminal childTp
    childTp    = Map.findWithDefault (error ("lookupType: the child " ++ show child ++ "is not in the appropriate map")) child childMp
    ppDoc      = ppTp attrTp

noParameters :: Type -> Bool
noParameters (Haskell _)   = True
noParameters (NT _ args _) = null args
{-# LINE 250 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1259 "src-ag/ExecutionPlan2Clean.ag" #-}

-- a `compatibleKind` b  means: can kind b be invoked from a
compatibleKind :: VisitKind -> VisitKind -> Bool
compatibleKind _              _             = True

compatibleRule :: VisitKind -> Bool -> Bool
compatibleRule (VisitPure _) False = False
compatibleRule _             _     = True
{-# LINE 261 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1281 "src-ag/ExecutionPlan2Clean.ag" #-}

unionWithSum = Map.unionWith (+)
{-# LINE 266 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1304 "src-ag/ExecutionPlan2Clean.ag" #-}

uwSetUnion :: (Ord a, Ord b) => Map a (Set b) -> Map a (Set b) -> Map a (Set b)
uwSetUnion = Map.unionWith Set.union

uwMapUnion :: (Ord a, Ord b) => Map a (Map b c) -> Map a (Map b c) -> Map a (Map b c)
uwMapUnion = Map.unionWith Map.union
{-# LINE 275 "src-generated/ExecutionPlan2Clean.hs" #-}

{-# LINE 1499 "src-ag/ExecutionPlan2Clean.ag" #-}

renderDocs :: [PP_Doc] -> String
renderDocs pps = foldr (.) id (map (\d -> (disp d 50000) . ( '\n':) ) pps) ""

writeModule :: FilePath -> [PP_Doc] -> IO ()
writeModule path docs
  = do bExists <- doesFileExist path
       if bExists
        then do input <- readFile path
                seq (length input) (return ())
                if input /= output
                 then dumpIt
                 else return ()
        else dumpIt
  where
    output = renderDocs docs
    dumpIt = writeFile path output

cleanIclModuleHeader :: Options -> String -> String
cleanIclModuleHeader flags input
 = case moduleName flags
   of Name nm -> genMod nm
      Default -> genMod (defaultModuleName input)
      NoName  -> ""
   where genMod x = "implementation module " ++ x 

cleanDclModuleHeader :: Options -> String -> Maybe String -> String
cleanDclModuleHeader flags input export
 = case moduleName flags
   of Name nm -> genMod nm
      Default -> genMod (defaultModuleName input)
      NoName  -> ""
   where genMod x = "definition module " ++ x ++ genExp export x
         genExp Nothing _ = ""
         genExp (Just e) x = "(module " ++ x ++ ", module " ++ e ++ ")"

defaultModuleName :: String -> String
defaultModuleName = dropExtension

mkIclModuleHeader :: Maybe (String,String,String) -> String -> String -> String -> Bool -> String
mkIclModuleHeader Nothing defaultName suffix _ _
  = "implementation module " ++ defaultName ++ suffix
mkIclModuleHeader (Just (name, exports, imports)) _ suffix addExports replaceExports
  = "implementation module " ++ name ++ suffix ++ "\n" ++ imports ++ "\n"

mkDclModuleHeader :: Maybe (String,String,String) -> String -> String -> String -> Bool -> String
mkDclModuleHeader Nothing defaultName suffix _ _
  = "definition module " ++ defaultName ++ suffix
mkDclModuleHeader (Just (name, exports, _)) _ suffix addExports replaceExports
  = "definition module " ++ name ++ suffix ++ ex ++ "\n"
  where
    ex  = if null exports || (replaceExports && null addExports)
          then ""
          else if null addExports
               then exports
               else if replaceExports
                    then addExports
                    else exports ++ "," ++ addExports
{-# LINE 336 "src-generated/ExecutionPlan2Clean.hs" #-}
-- EChild ------------------------------------------------------
-- wrapper
data Inh_EChild  = Inh_EChild { allInitStates_Inh_EChild :: (Map NontermIdent Int), con_Inh_EChild :: (ConstructorIdent), constructorTypeMap_Inh_EChild :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_EChild :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_EChild :: (String -> String -> String -> Bool -> String), importBlocks_Inh_EChild :: (PP_Doc), mainFile_Inh_EChild :: (String), mainName_Inh_EChild :: (String), nt_Inh_EChild :: (NontermIdent), options_Inh_EChild :: (Options), textBlocks_Inh_EChild :: (PP_Doc) }
data Syn_EChild  = Syn_EChild { argnamesw_Syn_EChild :: ( PP_Doc ), argpats_Syn_EChild :: (  PP_Doc  ), argtps_Syn_EChild :: (  PP_Doc  ), childTypes_Syn_EChild :: (Map Identifier Type), childintros_Syn_EChild :: (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))), datatype_Syn_EChild :: (PP_Doc), recfields_Syn_EChild :: ( [Identifier] ), recordtype_Syn_EChild :: (PP_Doc), terminaldefs_Syn_EChild :: (Set String), usedArgs_Syn_EChild :: (Set String) }
{-# INLINABLE wrap_EChild #-}
wrap_EChild :: T_EChild  -> Inh_EChild  -> (Syn_EChild )
wrap_EChild (T_EChild act) (Inh_EChild _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg1 = T_EChild_vIn1 _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks
        (T_EChild_vOut1 _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs) <- return (inv_EChild_s2 sem arg1)
        return (Syn_EChild _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs)
   )

-- cata
{-# NOINLINE sem_EChild #-}
sem_EChild :: EChild  -> T_EChild 
sem_EChild ( EChild name_ tp_ kind_ hasAround_ merges_ isMerged_ ) = sem_EChild_EChild name_ tp_ kind_ hasAround_ merges_ isMerged_
sem_EChild ( ETerm name_ tp_ ) = sem_EChild_ETerm name_ tp_

-- semantic domain
newtype T_EChild  = T_EChild {
                             attach_T_EChild :: Identity (T_EChild_s2 )
                             }
newtype T_EChild_s2  = C_EChild_s2 {
                                   inv_EChild_s2 :: (T_EChild_v1 )
                                   }
data T_EChild_s3  = C_EChild_s3
type T_EChild_v1  = (T_EChild_vIn1 ) -> (T_EChild_vOut1 )
data T_EChild_vIn1  = T_EChild_vIn1 (Map NontermIdent Int) (ConstructorIdent) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (String) (String) (NontermIdent) (Options) (PP_Doc)
data T_EChild_vOut1  = T_EChild_vOut1 ( PP_Doc ) (  PP_Doc  ) (  PP_Doc  ) (Map Identifier Type) (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) (PP_Doc) ( [Identifier] ) (PP_Doc) (Set String) (Set String)
{-# NOINLINE sem_EChild_EChild #-}
sem_EChild_EChild :: (Identifier) -> (Type) -> (ChildKind) -> (Bool) -> (Maybe [Identifier]) -> (Bool) -> T_EChild 
sem_EChild_EChild arg_name_ arg_tp_ arg_kind_ arg_hasAround_ _ _ = T_EChild (return st2) where
   {-# NOINLINE st2 #-}
   st2 = let
      v1 :: T_EChild_v1 
      v1 = \ (T_EChild_vIn1 _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks) -> ( let
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule0 _usedArgs_augmented_f1 _usedArgs_augmented_syn
         _usedArgs_augmented_f1 = rule1 arg_kind_ arg_name_
         _tpDoc = rule2 _addStrict arg_tp_
         _strNm = rule3 _lhsIcon _lhsInt arg_name_
         _field = rule4 _lhsIoptions _strNm _tpDoc
         _recordfield = rule5 _strNm _tpDoc
         _addStrict = rule6 _lhsIoptions
         _lhsOdatatype :: PP_Doc
         _lhsOdatatype = rule7 _field arg_kind_
         _lhsOrecordtype :: PP_Doc
         _lhsOrecordtype = rule8 _recordfield arg_kind_
         _lhsOargnamesw ::  PP_Doc 
         _lhsOargnamesw = rule9 _nt arg_kind_ arg_name_
         _lhsOargtps ::   PP_Doc  
         _lhsOargtps = rule10 arg_kind_ arg_tp_
         _argpats = rule11 arg_kind_ arg_name_
         _lhsOrecfields ::  [Identifier] 
         _lhsOrecfields = rule12 arg_kind_ arg_name_
         _lhsOchildintros :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))
         _lhsOchildintros = rule13 _introcode arg_name_
         _isDefor = rule14 arg_tp_
         _valcode = rule15 _isDefor _lhsIoptions _nt arg_kind_ arg_name_
         _aroundcode = rule16 _lhsIoptions arg_hasAround_ arg_name_
         _introcode = rule17 _addbang _aroundcode _initSt _isDefor _lhsIoptions _nt _valcode arg_hasAround_ arg_kind_ arg_name_
         _nt = rule18 arg_tp_
         _addbang = rule19 _lhsIoptions
         _lhsOchildTypes :: Map Identifier Type
         _lhsOchildTypes = rule20 arg_name_ arg_tp_
         _initSt = rule21 _lhsIallInitStates _nt
         _lhsOterminaldefs :: Set String
         _lhsOterminaldefs = rule22  ()
         _usedArgs_augmented_syn = rule23  ()
         _lhsOargpats ::   PP_Doc  
         _lhsOargpats = rule24 _argpats
         __result_ = T_EChild_vOut1 _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs
         in __result_ )
     in C_EChild_s2 v1
   {-# INLINE rule0 #-}
   rule0 = \ _usedArgs_augmented_f1 _usedArgs_augmented_syn ->
     foldr ($) _usedArgs_augmented_syn [_usedArgs_augmented_f1]
   {-# INLINE rule1 #-}
   rule1 = \ kind_ name_ ->
                         \s -> case kind_ of
                               ChildSyntax -> Set.insert ("arg_" ++ show name_ ++ "_") s
                               _           -> s
   {-# INLINE rule2 #-}
   {-# LINE 243 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule2 = \ _addStrict tp_ ->
                     {-# LINE 243 "src-ag/ExecutionPlan2Clean.ag" #-}
                     _addStrict     $ pp_parens $ ppTp $ removeDeforested tp_
                     {-# LINE 426 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule3 #-}
   {-# LINE 244 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule3 = \ ((_lhsIcon) :: ConstructorIdent) ((_lhsInt) :: NontermIdent) name_ ->
                     {-# LINE 244 "src-ag/ExecutionPlan2Clean.ag" #-}
                     recordFieldname _lhsInt _lhsIcon name_
                     {-# LINE 432 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule4 #-}
   {-# LINE 245 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule4 = \ ((_lhsIoptions) :: Options) _strNm _tpDoc ->
                     {-# LINE 245 "src-ag/ExecutionPlan2Clean.ag" #-}
                     if dataRecords _lhsIoptions
                     then _strNm     >#< "::" >#< _tpDoc
                     else _tpDoc
                     {-# LINE 440 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule5 #-}
   {-# LINE 248 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule5 = \ _strNm _tpDoc ->
                           {-# LINE 248 "src-ag/ExecutionPlan2Clean.ag" #-}
                           _strNm     >#< "::" >#< _tpDoc
                           {-# LINE 446 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule6 #-}
   {-# LINE 249 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule6 = \ ((_lhsIoptions) :: Options) ->
                        {-# LINE 249 "src-ag/ExecutionPlan2Clean.ag" #-}
                        \x -> if strictData _lhsIoptions then "!" >|< x else x
                        {-# LINE 452 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule7 #-}
   {-# LINE 250 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule7 = \ _field kind_ ->
                             {-# LINE 250 "src-ag/ExecutionPlan2Clean.ag" #-}
                             case kind_ of
                               ChildAttr -> empty
                               _         -> _field
                             {-# LINE 460 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule8 #-}
   {-# LINE 254 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule8 = \ _recordfield kind_ ->
                               {-# LINE 254 "src-ag/ExecutionPlan2Clean.ag" #-}
                               case kind_ of
                                 ChildAttr -> empty
                                 _         -> _recordfield
                               {-# LINE 468 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule9 #-}
   {-# LINE 342 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule9 = \ _nt kind_ name_ ->
                             {-# LINE 342 "src-ag/ExecutionPlan2Clean.ag" #-}
                             case kind_ of
                               ChildSyntax     -> "(" >#< "sem_" >|< _nt     >#< name_ >|< "_" >#< ")"
                               ChildAttr       -> empty
                               ChildReplace tp -> "(" >#< "sem_" >|< extractNonterminal tp >#< name_ >|< "_" >#< ")"
                             {-# LINE 477 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule10 #-}
   {-# LINE 633 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule10 = \ kind_ tp_ ->
                            {-# LINE 633 "src-ag/ExecutionPlan2Clean.ag" #-}
                            case kind_ of
                              ChildSyntax     -> pp_parens $ ppDefor tp_
                              ChildReplace tp -> pp_parens $ ppDefor tp
                              _               -> empty
                            {-# LINE 486 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule11 #-}
   {-# LINE 637 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule11 = \ kind_ name_ ->
                           {-# LINE 637 "src-ag/ExecutionPlan2Clean.ag" #-}
                           case kind_ of
                             ChildSyntax    -> name_ >|< "_"
                             ChildReplace _ -> name_ >|< "_"
                             _              -> empty
                           {-# LINE 495 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule12 #-}
   {-# LINE 642 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule12 = \ kind_ name_ ->
                             {-# LINE 642 "src-ag/ExecutionPlan2Clean.ag" #-}
                             case kind_ of
                               ChildSyntax    -> [name_]
                               ChildReplace _ -> [name_]
                               _              -> []
                             {-# LINE 504 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule13 #-}
   {-# LINE 946 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule13 = \ _introcode name_ ->
                               {-# LINE 946 "src-ag/ExecutionPlan2Clean.ag" #-}
                               Map.singleton name_ _introcode
                               {-# LINE 510 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule14 #-}
   {-# LINE 947 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule14 = \ tp_ ->
                               {-# LINE 947 "src-ag/ExecutionPlan2Clean.ag" #-}
                               case tp_ of
                                 NT _ _ defor -> defor
                                 _            -> False
                               {-# LINE 518 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule15 #-}
   {-# LINE 950 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule15 = \ _isDefor ((_lhsIoptions) :: Options) _nt kind_ name_ ->
                               {-# LINE 950 "src-ag/ExecutionPlan2Clean.ag" #-}
                               case kind_ of
                                 ChildSyntax -> "arg_" >|< name_ >|< "_"
                                 ChildAttr   ->
                                                let prefix | not _isDefor     = if lateHigherOrderBinding _lhsIoptions
                                                                                then lateSemNtLabel _nt     >#< lhsname _lhsIoptions True idLateBindingAttr
                                                                                else "sem_" >|< _nt
                                                           | otherwise        = empty
                                                in pp_parens (prefix >#< instname name_)
                                 ChildReplace _ ->
                                                   pp_parens (instname name_ >#< name_ >|< "_")
                               {-# LINE 533 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule16 #-}
   {-# LINE 961 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule16 = \ ((_lhsIoptions) :: Options) hasAround_ name_ ->
                               {-# LINE 961 "src-ag/ExecutionPlan2Clean.ag" #-}
                               if hasAround_
                               then locname _lhsIoptions name_ >|< "_around"
                               else empty
                               {-# LINE 541 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule17 #-}
   {-# LINE 964 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule17 = \ _addbang _aroundcode _initSt _isDefor ((_lhsIoptions) :: Options) _nt _valcode hasAround_ kind_ name_ ->
                               {-# LINE 964 "src-ag/ExecutionPlan2Clean.ag" #-}
                               \kind fmtMode ->
                                        let pat       = text $ stname name_ _initSt
                                            patStrict = _addbang     pat
                                            attach    = "attach_T_" >|< _nt     >#< pp_parens (_aroundcode     >#< _valcode    )
                                            runAttach = unMon _lhsIoptions >#< pp_parens attach
                                            decl      = case kind of
                                                          VisitPure False -> pat >#< "=" >#< runAttach
                                                          VisitPure True  -> patStrict >#< "=" >#< runAttach
                                                          VisitMonadic    -> attach >#< ">>= \\" >#< patStrict >#< "->"
                                        in if compatibleAttach kind _nt     _lhsIoptions
                                           then Right ( fmtDecl False fmtMode decl
                                                      , Set.singleton (stname name_ _initSt    )
                                                      , case kind_ of
                                                          ChildAttr   -> Map.insert (instname name_) Nothing $
                                                                           ( if _isDefor     || not (lateHigherOrderBinding _lhsIoptions)
                                                                             then id
                                                                             else Map.insert (lhsname _lhsIoptions True idLateBindingAttr) (Just $ AttrInh _LHS idLateBindingAttr)
                                                                           ) $
                                                                           ( if hasAround_
                                                                             then Map.insert (locname _lhsIoptions (name_) ++ "_around") Nothing
                                                                             else id
                                                                           ) $ Map.empty
                                                          ChildReplace _ -> Map.singleton (instname name_) Nothing
                                                          ChildSyntax    -> Map.empty
                                                      )
                                           else Left $ IncompatibleAttachKind name_ kind
                               {-# LINE 572 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule18 #-}
   {-# LINE 990 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule18 = \ tp_ ->
                            {-# LINE 990 "src-ag/ExecutionPlan2Clean.ag" #-}
                            extractNonterminal tp_
                            {-# LINE 578 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule19 #-}
   {-# LINE 1568 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule19 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1568 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 584 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule20 #-}
   {-# LINE 1620 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule20 = \ name_ tp_ ->
                     {-# LINE 1620 "src-ag/ExecutionPlan2Clean.ag" #-}
                     Map.singleton name_ tp_
                     {-# LINE 590 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule21 #-}
   {-# LINE 1664 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule21 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) _nt ->
                 {-# LINE 1664 "src-ag/ExecutionPlan2Clean.ag" #-}
                 Map.findWithDefault (error "nonterminal not in allInitStates map") _nt     _lhsIallInitStates
                 {-# LINE 596 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule22 #-}
   rule22 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule23 #-}
   rule23 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule24 #-}
   rule24 = \ _argpats ->
     _argpats
{-# NOINLINE sem_EChild_ETerm #-}
sem_EChild_ETerm :: (Identifier) -> (Type) -> T_EChild 
sem_EChild_ETerm arg_name_ arg_tp_ = T_EChild (return st2) where
   {-# NOINLINE st2 #-}
   st2 = let
      v1 :: T_EChild_v1 
      v1 = \ (T_EChild_vIn1 _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks) -> ( let
         _tpDoc = rule25 _addStrict arg_tp_
         _strNm = rule26 _lhsIcon _lhsInt arg_name_
         _field = rule27 _lhsIoptions _strNm _tpDoc
         _recordfield = rule28 _strNm _tpDoc
         _addStrict = rule29 _lhsIoptions
         _lhsOdatatype :: PP_Doc
         _lhsOdatatype = rule30 _field
         _lhsOrecordtype :: PP_Doc
         _lhsOrecordtype = rule31 _recordfield
         _lhsOargnamesw ::  PP_Doc 
         _lhsOargnamesw = rule32 arg_name_
         _lhsOargtps ::   PP_Doc  
         _lhsOargtps = rule33 arg_tp_
         _argpats = rule34 _addbang arg_name_
         _lhsOrecfields ::  [Identifier] 
         _lhsOrecfields = rule35 arg_name_
         _lhsOchildintros :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))
         _lhsOchildintros = rule36 arg_name_
         _lhsOterminaldefs :: Set String
         _lhsOterminaldefs = rule37 arg_name_
         _addbang = rule38 _lhsIoptions
         _lhsOchildTypes :: Map Identifier Type
         _lhsOchildTypes = rule39 arg_name_ arg_tp_
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule40  ()
         _lhsOargpats ::   PP_Doc  
         _lhsOargpats = rule41 _argpats
         __result_ = T_EChild_vOut1 _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs
         in __result_ )
     in C_EChild_s2 v1
   {-# INLINE rule25 #-}
   {-# LINE 243 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule25 = \ _addStrict tp_ ->
                     {-# LINE 243 "src-ag/ExecutionPlan2Clean.ag" #-}
                     _addStrict     $ pp_parens $ ppTp $ removeDeforested tp_
                     {-# LINE 648 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule26 #-}
   {-# LINE 244 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule26 = \ ((_lhsIcon) :: ConstructorIdent) ((_lhsInt) :: NontermIdent) name_ ->
                     {-# LINE 244 "src-ag/ExecutionPlan2Clean.ag" #-}
                     recordFieldname _lhsInt _lhsIcon name_
                     {-# LINE 654 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule27 #-}
   {-# LINE 245 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule27 = \ ((_lhsIoptions) :: Options) _strNm _tpDoc ->
                     {-# LINE 245 "src-ag/ExecutionPlan2Clean.ag" #-}
                     if dataRecords _lhsIoptions
                     then _strNm     >#< "::" >#< _tpDoc
                     else _tpDoc
                     {-# LINE 662 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule28 #-}
   {-# LINE 248 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule28 = \ _strNm _tpDoc ->
                           {-# LINE 248 "src-ag/ExecutionPlan2Clean.ag" #-}
                           _strNm     >#< "::" >#< _tpDoc
                           {-# LINE 668 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule29 #-}
   {-# LINE 249 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule29 = \ ((_lhsIoptions) :: Options) ->
                        {-# LINE 249 "src-ag/ExecutionPlan2Clean.ag" #-}
                        \x -> if strictData _lhsIoptions then "!" >|< x else x
                        {-# LINE 674 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule30 #-}
   {-# LINE 257 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule30 = \ _field ->
                                {-# LINE 257 "src-ag/ExecutionPlan2Clean.ag" #-}
                                _field
                                {-# LINE 680 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule31 #-}
   {-# LINE 258 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule31 = \ _recordfield ->
                                {-# LINE 258 "src-ag/ExecutionPlan2Clean.ag" #-}
                                _recordfield
                                {-# LINE 686 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule32 #-}
   {-# LINE 346 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule32 = \ name_ ->
                             {-# LINE 346 "src-ag/ExecutionPlan2Clean.ag" #-}
                             text $ fieldname name_
                             {-# LINE 692 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule33 #-}
   {-# LINE 648 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule33 = \ tp_ ->
                             {-# LINE 648 "src-ag/ExecutionPlan2Clean.ag" #-}
                             pp_parens $ show tp_
                             {-# LINE 698 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule34 #-}
   {-# LINE 649 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule34 = \ _addbang name_ ->
                             {-# LINE 649 "src-ag/ExecutionPlan2Clean.ag" #-}
                             _addbang     $ text $ fieldname name_
                             {-# LINE 704 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule35 #-}
   {-# LINE 650 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule35 = \ name_ ->
                             {-# LINE 650 "src-ag/ExecutionPlan2Clean.ag" #-}
                             [name_]
                             {-# LINE 710 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule36 #-}
   {-# LINE 945 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule36 = \ name_ ->
                               {-# LINE 945 "src-ag/ExecutionPlan2Clean.ag" #-}
                               Map.singleton name_ (\_ _ -> Right (empty, Set.empty, Map.empty))
                               {-# LINE 716 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule37 #-}
   {-# LINE 1318 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule37 = \ name_ ->
                       {-# LINE 1318 "src-ag/ExecutionPlan2Clean.ag" #-}
                       Set.singleton $ fieldname name_
                       {-# LINE 722 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule38 #-}
   {-# LINE 1569 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule38 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1569 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 728 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule39 #-}
   {-# LINE 1620 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule39 = \ name_ tp_ ->
                     {-# LINE 1620 "src-ag/ExecutionPlan2Clean.ag" #-}
                     Map.singleton name_ tp_
                     {-# LINE 734 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule40 #-}
   rule40 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule41 #-}
   rule41 = \ _argpats ->
     _argpats

-- EChildren ---------------------------------------------------
-- wrapper
data Inh_EChildren  = Inh_EChildren { allInitStates_Inh_EChildren :: (Map NontermIdent Int), con_Inh_EChildren :: (ConstructorIdent), constructorTypeMap_Inh_EChildren :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_EChildren :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_EChildren :: (String -> String -> String -> Bool -> String), importBlocks_Inh_EChildren :: (PP_Doc), mainFile_Inh_EChildren :: (String), mainName_Inh_EChildren :: (String), nt_Inh_EChildren :: (NontermIdent), options_Inh_EChildren :: (Options), textBlocks_Inh_EChildren :: (PP_Doc) }
data Syn_EChildren  = Syn_EChildren { argnamesw_Syn_EChildren :: ([PP_Doc]), argpats_Syn_EChildren :: ( [PP_Doc] ), argtps_Syn_EChildren :: ( [PP_Doc] ), childTypes_Syn_EChildren :: (Map Identifier Type), childintros_Syn_EChildren :: (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))), datatype_Syn_EChildren :: ([PP_Doc]), recfields_Syn_EChildren :: ( [Identifier] ), recordtype_Syn_EChildren :: ([PP_Doc]), terminaldefs_Syn_EChildren :: (Set String), usedArgs_Syn_EChildren :: (Set String) }
{-# INLINABLE wrap_EChildren #-}
wrap_EChildren :: T_EChildren  -> Inh_EChildren  -> (Syn_EChildren )
wrap_EChildren (T_EChildren act) (Inh_EChildren _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg4 = T_EChildren_vIn4 _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks
        (T_EChildren_vOut4 _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs) <- return (inv_EChildren_s5 sem arg4)
        return (Syn_EChildren _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs)
   )

-- cata
{-# NOINLINE sem_EChildren #-}
sem_EChildren :: EChildren  -> T_EChildren 
sem_EChildren list = Prelude.foldr sem_EChildren_Cons sem_EChildren_Nil (Prelude.map sem_EChild list)

-- semantic domain
newtype T_EChildren  = T_EChildren {
                                   attach_T_EChildren :: Identity (T_EChildren_s5 )
                                   }
newtype T_EChildren_s5  = C_EChildren_s5 {
                                         inv_EChildren_s5 :: (T_EChildren_v4 )
                                         }
data T_EChildren_s6  = C_EChildren_s6
type T_EChildren_v4  = (T_EChildren_vIn4 ) -> (T_EChildren_vOut4 )
data T_EChildren_vIn4  = T_EChildren_vIn4 (Map NontermIdent Int) (ConstructorIdent) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (String) (String) (NontermIdent) (Options) (PP_Doc)
data T_EChildren_vOut4  = T_EChildren_vOut4 ([PP_Doc]) ( [PP_Doc] ) ( [PP_Doc] ) (Map Identifier Type) (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ([PP_Doc]) ( [Identifier] ) ([PP_Doc]) (Set String) (Set String)
{-# NOINLINE sem_EChildren_Cons #-}
sem_EChildren_Cons :: T_EChild  -> T_EChildren  -> T_EChildren 
sem_EChildren_Cons arg_hd_ arg_tl_ = T_EChildren (return st5) where
   {-# NOINLINE st5 #-}
   st5 = let
      v4 :: T_EChildren_v4 
      v4 = \ (T_EChildren_vIn4 _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks) -> ( let
         _hdX2 = Control.Monad.Identity.runIdentity (attach_T_EChild (arg_hd_))
         _tlX5 = Control.Monad.Identity.runIdentity (attach_T_EChildren (arg_tl_))
         (T_EChild_vOut1 _hdIargnamesw _hdIargpats _hdIargtps _hdIchildTypes _hdIchildintros _hdIdatatype _hdIrecfields _hdIrecordtype _hdIterminaldefs _hdIusedArgs) = inv_EChild_s2 _hdX2 (T_EChild_vIn1 _hdOallInitStates _hdOcon _hdOconstructorTypeMap _hdOdclModuleHeader _hdOiclModuleHeader _hdOimportBlocks _hdOmainFile _hdOmainName _hdOnt _hdOoptions _hdOtextBlocks)
         (T_EChildren_vOut4 _tlIargnamesw _tlIargpats _tlIargtps _tlIchildTypes _tlIchildintros _tlIdatatype _tlIrecfields _tlIrecordtype _tlIterminaldefs _tlIusedArgs) = inv_EChildren_s5 _tlX5 (T_EChildren_vIn4 _tlOallInitStates _tlOcon _tlOconstructorTypeMap _tlOdclModuleHeader _tlOiclModuleHeader _tlOimportBlocks _tlOmainFile _tlOmainName _tlOnt _tlOoptions _tlOtextBlocks)
         _lhsOargnamesw :: [PP_Doc]
         _lhsOargnamesw = rule42 _hdIargnamesw _tlIargnamesw
         _lhsOargpats ::  [PP_Doc] 
         _lhsOargpats = rule43 _hdIargpats _tlIargpats
         _lhsOargtps ::  [PP_Doc] 
         _lhsOargtps = rule44 _hdIargtps _tlIargtps
         _lhsOchildTypes :: Map Identifier Type
         _lhsOchildTypes = rule45 _hdIchildTypes _tlIchildTypes
         _lhsOchildintros :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))
         _lhsOchildintros = rule46 _hdIchildintros _tlIchildintros
         _lhsOdatatype :: [PP_Doc]
         _lhsOdatatype = rule47 _hdIdatatype _tlIdatatype
         _lhsOrecfields ::  [Identifier] 
         _lhsOrecfields = rule48 _hdIrecfields _tlIrecfields
         _lhsOrecordtype :: [PP_Doc]
         _lhsOrecordtype = rule49 _hdIrecordtype _tlIrecordtype
         _lhsOterminaldefs :: Set String
         _lhsOterminaldefs = rule50 _hdIterminaldefs _tlIterminaldefs
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule51 _hdIusedArgs _tlIusedArgs
         _hdOallInitStates = rule52 _lhsIallInitStates
         _hdOcon = rule53 _lhsIcon
         _hdOconstructorTypeMap = rule54 _lhsIconstructorTypeMap
         _hdOdclModuleHeader = rule55 _lhsIdclModuleHeader
         _hdOiclModuleHeader = rule56 _lhsIiclModuleHeader
         _hdOimportBlocks = rule57 _lhsIimportBlocks
         _hdOmainFile = rule58 _lhsImainFile
         _hdOmainName = rule59 _lhsImainName
         _hdOnt = rule60 _lhsInt
         _hdOoptions = rule61 _lhsIoptions
         _hdOtextBlocks = rule62 _lhsItextBlocks
         _tlOallInitStates = rule63 _lhsIallInitStates
         _tlOcon = rule64 _lhsIcon
         _tlOconstructorTypeMap = rule65 _lhsIconstructorTypeMap
         _tlOdclModuleHeader = rule66 _lhsIdclModuleHeader
         _tlOiclModuleHeader = rule67 _lhsIiclModuleHeader
         _tlOimportBlocks = rule68 _lhsIimportBlocks
         _tlOmainFile = rule69 _lhsImainFile
         _tlOmainName = rule70 _lhsImainName
         _tlOnt = rule71 _lhsInt
         _tlOoptions = rule72 _lhsIoptions
         _tlOtextBlocks = rule73 _lhsItextBlocks
         __result_ = T_EChildren_vOut4 _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs
         in __result_ )
     in C_EChildren_s5 v4
   {-# INLINE rule42 #-}
   rule42 = \ ((_hdIargnamesw) ::  PP_Doc ) ((_tlIargnamesw) :: [PP_Doc]) ->
     _hdIargnamesw : _tlIargnamesw
   {-# INLINE rule43 #-}
   rule43 = \ ((_hdIargpats) ::   PP_Doc  ) ((_tlIargpats) ::  [PP_Doc] ) ->
     _hdIargpats : _tlIargpats
   {-# INLINE rule44 #-}
   rule44 = \ ((_hdIargtps) ::   PP_Doc  ) ((_tlIargtps) ::  [PP_Doc] ) ->
     _hdIargtps : _tlIargtps
   {-# INLINE rule45 #-}
   rule45 = \ ((_hdIchildTypes) :: Map Identifier Type) ((_tlIchildTypes) :: Map Identifier Type) ->
     _hdIchildTypes `mappend` _tlIchildTypes
   {-# INLINE rule46 #-}
   rule46 = \ ((_hdIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ((_tlIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _hdIchildintros `Map.union` _tlIchildintros
   {-# INLINE rule47 #-}
   rule47 = \ ((_hdIdatatype) :: PP_Doc) ((_tlIdatatype) :: [PP_Doc]) ->
     _hdIdatatype : _tlIdatatype
   {-# INLINE rule48 #-}
   rule48 = \ ((_hdIrecfields) ::  [Identifier] ) ((_tlIrecfields) ::  [Identifier] ) ->
     _hdIrecfields ++ _tlIrecfields
   {-# INLINE rule49 #-}
   rule49 = \ ((_hdIrecordtype) :: PP_Doc) ((_tlIrecordtype) :: [PP_Doc]) ->
     _hdIrecordtype : _tlIrecordtype
   {-# INLINE rule50 #-}
   rule50 = \ ((_hdIterminaldefs) :: Set String) ((_tlIterminaldefs) :: Set String) ->
     _hdIterminaldefs `Set.union` _tlIterminaldefs
   {-# INLINE rule51 #-}
   rule51 = \ ((_hdIusedArgs) :: Set String) ((_tlIusedArgs) :: Set String) ->
     _hdIusedArgs `Set.union` _tlIusedArgs
   {-# INLINE rule52 #-}
   rule52 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule53 #-}
   rule53 = \ ((_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule54 #-}
   rule54 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule55 #-}
   rule55 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule56 #-}
   rule56 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule57 #-}
   rule57 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule58 #-}
   rule58 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule59 #-}
   rule59 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule60 #-}
   rule60 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule61 #-}
   rule61 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule62 #-}
   rule62 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule63 #-}
   rule63 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule64 #-}
   rule64 = \ ((_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule65 #-}
   rule65 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule66 #-}
   rule66 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule67 #-}
   rule67 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule68 #-}
   rule68 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule69 #-}
   rule69 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule70 #-}
   rule70 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule71 #-}
   rule71 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule72 #-}
   rule72 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule73 #-}
   rule73 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
{-# NOINLINE sem_EChildren_Nil #-}
sem_EChildren_Nil ::  T_EChildren 
sem_EChildren_Nil  = T_EChildren (return st5) where
   {-# NOINLINE st5 #-}
   st5 = let
      v4 :: T_EChildren_v4 
      v4 = \ (T_EChildren_vIn4 _lhsIallInitStates _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsItextBlocks) -> ( let
         _lhsOargnamesw :: [PP_Doc]
         _lhsOargnamesw = rule74  ()
         _lhsOargpats ::  [PP_Doc] 
         _lhsOargpats = rule75  ()
         _lhsOargtps ::  [PP_Doc] 
         _lhsOargtps = rule76  ()
         _lhsOchildTypes :: Map Identifier Type
         _lhsOchildTypes = rule77  ()
         _lhsOchildintros :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))
         _lhsOchildintros = rule78  ()
         _lhsOdatatype :: [PP_Doc]
         _lhsOdatatype = rule79  ()
         _lhsOrecfields ::  [Identifier] 
         _lhsOrecfields = rule80  ()
         _lhsOrecordtype :: [PP_Doc]
         _lhsOrecordtype = rule81  ()
         _lhsOterminaldefs :: Set String
         _lhsOterminaldefs = rule82  ()
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule83  ()
         __result_ = T_EChildren_vOut4 _lhsOargnamesw _lhsOargpats _lhsOargtps _lhsOchildTypes _lhsOchildintros _lhsOdatatype _lhsOrecfields _lhsOrecordtype _lhsOterminaldefs _lhsOusedArgs
         in __result_ )
     in C_EChildren_s5 v4
   {-# INLINE rule74 #-}
   rule74 = \  (_ :: ()) ->
     []
   {-# INLINE rule75 #-}
   rule75 = \  (_ :: ()) ->
     []
   {-# INLINE rule76 #-}
   rule76 = \  (_ :: ()) ->
     []
   {-# INLINE rule77 #-}
   rule77 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule78 #-}
   rule78 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule79 #-}
   rule79 = \  (_ :: ()) ->
     []
   {-# INLINE rule80 #-}
   rule80 = \  (_ :: ()) ->
     []
   {-# INLINE rule81 #-}
   rule81 = \  (_ :: ()) ->
     []
   {-# INLINE rule82 #-}
   rule82 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule83 #-}
   rule83 = \  (_ :: ()) ->
     Set.empty

-- ENonterminal ------------------------------------------------
-- wrapper
data Inh_ENonterminal  = Inh_ENonterminal { allFromToStates_Inh_ENonterminal :: (Map VisitIdentifier (Int,Int)), allInitStates_Inh_ENonterminal :: (Map NontermIdent Int), allVisitKinds_Inh_ENonterminal :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_ENonterminal :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), avisitdefs_Inh_ENonterminal :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_ENonterminal :: (Map VisitIdentifier (Set Identifier)), constructorTypeMap_Inh_ENonterminal :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_ENonterminal :: (String -> String -> String -> Bool -> String), derivings_Inh_ENonterminal :: (Derivings), iclModuleHeader_Inh_ENonterminal :: (String -> String -> String -> Bool -> String), importBlocks_Inh_ENonterminal :: (PP_Doc), inhmap_Inh_ENonterminal :: (Map NontermIdent Attributes), localAttrTypes_Inh_ENonterminal :: (Map NontermIdent (Map ConstructorIdent (Map Identifier Type))), mainFile_Inh_ENonterminal :: (String), mainName_Inh_ENonterminal :: (String), options_Inh_ENonterminal :: (Options), synmap_Inh_ENonterminal :: (Map NontermIdent Attributes), textBlocks_Inh_ENonterminal :: (PP_Doc), typeSyns_Inh_ENonterminal :: (TypeSyns), wrappers_Inh_ENonterminal :: (Set NontermIdent) }
data Syn_ENonterminal  = Syn_ENonterminal { appendCommon_Syn_ENonterminal :: ( PP_Doc ), appendMain_Syn_ENonterminal :: ( PP_Doc ), childvisit_Syn_ENonterminal :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), errors_Syn_ENonterminal :: (Seq Error), fromToStates_Syn_ENonterminal :: (Map VisitIdentifier (Int,Int)), genProdIO_Syn_ENonterminal :: (IO ()), imports_Syn_ENonterminal :: ([PP_Doc]), initStates_Syn_ENonterminal :: (Map NontermIdent Int), output_Syn_ENonterminal :: (PP_Doc), output_dcl_Syn_ENonterminal :: (PP_Doc), semFunBndDefs_Syn_ENonterminal :: (Seq PP_Doc), semFunBndTps_Syn_ENonterminal :: (Seq PP_Doc), visitKinds_Syn_ENonterminal :: (Map VisitIdentifier VisitKind), visitdefs_Syn_ENonterminal :: (Map VisitIdentifier (Set Identifier)), visituses_Syn_ENonterminal :: (Map VisitIdentifier (Set Identifier)) }
{-# INLINABLE wrap_ENonterminal #-}
wrap_ENonterminal :: T_ENonterminal  -> Inh_ENonterminal  -> (Syn_ENonterminal )
wrap_ENonterminal (T_ENonterminal act) (Inh_ENonterminal _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg7 = T_ENonterminal_vIn7 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers
        (T_ENonterminal_vOut7 _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses) <- return (inv_ENonterminal_s8 sem arg7)
        return (Syn_ENonterminal _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses)
   )

-- cata
{-# INLINE sem_ENonterminal #-}
sem_ENonterminal :: ENonterminal  -> T_ENonterminal 
sem_ENonterminal ( ENonterminal nt_ params_ classCtxs_ initial_ initialv_ nextVisits_ prevVisits_ prods_ recursive_ hoInfo_ ) = sem_ENonterminal_ENonterminal nt_ params_ classCtxs_ initial_ initialv_ nextVisits_ prevVisits_ ( sem_EProductions prods_ ) recursive_ hoInfo_

-- semantic domain
newtype T_ENonterminal  = T_ENonterminal {
                                         attach_T_ENonterminal :: Identity (T_ENonterminal_s8 )
                                         }
newtype T_ENonterminal_s8  = C_ENonterminal_s8 {
                                               inv_ENonterminal_s8 :: (T_ENonterminal_v7 )
                                               }
data T_ENonterminal_s9  = C_ENonterminal_s9
type T_ENonterminal_v7  = (T_ENonterminal_vIn7 ) -> (T_ENonterminal_vOut7 )
data T_ENonterminal_vIn7  = T_ENonterminal_vIn7 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Int) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (Derivings) (String -> String -> String -> Bool -> String) (PP_Doc) (Map NontermIdent Attributes) (Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) (String) (String) (Options) (Map NontermIdent Attributes) (PP_Doc) (TypeSyns) (Set NontermIdent)
data T_ENonterminal_vOut7  = T_ENonterminal_vOut7 ( PP_Doc ) ( PP_Doc ) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Seq Error) (Map VisitIdentifier (Int,Int)) (IO ()) ([PP_Doc]) (Map NontermIdent Int) (PP_Doc) (PP_Doc) (Seq PP_Doc) (Seq PP_Doc) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier))
{-# NOINLINE sem_ENonterminal_ENonterminal #-}
sem_ENonterminal_ENonterminal :: (NontermIdent) -> ([Identifier]) -> (ClassContext) -> (StateIdentifier) -> ([VisitIdentifier]) -> (Map StateIdentifier StateCtx) -> (Map StateIdentifier StateCtx) -> T_EProductions  -> (Bool) -> (HigherOrderInfo) -> T_ENonterminal 
sem_ENonterminal_ENonterminal arg_nt_ arg_params_ arg_classCtxs_ arg_initial_ arg_initialv_ arg_nextVisits_ arg_prevVisits_ arg_prods_ _ _ = T_ENonterminal (return st8) where
   {-# NOINLINE st8 #-}
   st8 = let
      v7 :: T_ENonterminal_v7 
      v7 = \ (T_ENonterminal_vIn7 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers) -> ( let
         _prodsX17 = Control.Monad.Identity.runIdentity (attach_T_EProductions (arg_prods_))
         (T_EProductions_vOut16 _prodsIallvisits _prodsIchildvisit _prodsIcount _prodsIdatatype _prodsIerrors _prodsIfromToStates _prodsIgenProdIO _prodsIimports _prodsIrecordtype _prodsIsemFunBndDefs _prodsIsemFunBndTps _prodsIsem_nt _prodsIsem_prod _prodsIsem_prod_tys _prodsIt_visits _prodsIvisitKinds _prodsIvisitdefs _prodsIvisituses) = inv_EProductions_s17 _prodsX17 (T_EProductions_vIn16 _prodsOallFromToStates _prodsOallInhmap _prodsOallInitStates _prodsOallSynmap _prodsOallVisitKinds _prodsOallchildvisit _prodsOallstates _prodsOavisitdefs _prodsOavisituses _prodsOclassCtxs _prodsOconstructorTypeMap _prodsOdclModuleHeader _prodsOiclModuleHeader _prodsOimportBlocks _prodsOinhmap _prodsOinitial _prodsOlocalAttrTypes _prodsOmainFile _prodsOmainName _prodsOnextVisits _prodsOnt _prodsOntType _prodsOoptions _prodsOparams _prodsOprevVisits _prodsOrename _prodsOsynmap _prodsOtextBlocks)
         _prodsOrename = rule84 _lhsIoptions
         _prodsOnt = rule85 arg_nt_
         _prodsOparams = rule86 arg_params_
         _prodsOclassCtxs = rule87 arg_classCtxs_
         _lhsOoutput :: PP_Doc
         _lhsOoutput = rule88 _hasWrapper _k_states _lhsIoptions _prodsIsem_prod _sem_nt _t_init_icl _t_states_icl _wr_inh_icl _wr_syn_icl _wrapper_icl arg_nt_
         _hasWrapper = rule89 _lhsIwrappers arg_nt_
         _lhsOoutput_dcl :: PP_Doc
         _lhsOoutput_dcl = rule90 _datatype _hasWrapper _lhsIoptions _prodsIsem_prod_tys _prodsIt_visits _sem_tp _semname _t_init_dcl _t_states_dcl _wr_inh_dcl _wr_syn_dcl _wrapper_dcl arg_nt_
         _classPP = rule91 arg_classCtxs_
         _aliasPre = rule92 _classPP _t_params arg_nt_
         _datatype = rule93 _aliasPre _classPP _derivings _lhsIconstructorTypeMap _lhsItypeSyns _prodsIdatatype _prodsIrecordtype _t_params arg_nt_
         _derivings = rule94 _lhsIderivings arg_nt_
         _fsemname = rule95  ()
         _semname = rule96 _fsemname arg_nt_
         _frecarg = rule97 _fsemname
         _sem_tp = rule98 _classPP _quantPP _t_params _t_type arg_nt_
         _quantPP = rule99 arg_params_
         _sem_nt = rule100 _frecarg _fsemname _lhsItypeSyns _prodsIsem_nt _sem_tp _semname arg_nt_
         (Just _prodsOinhmap) = rule101 _lhsIinhmap arg_nt_
         (Just _prodsOsynmap) = rule102 _lhsIsynmap arg_nt_
         _prodsOallInhmap = rule103 _lhsIinhmap
         _prodsOallSynmap = rule104 _lhsIsynmap
         _outedges = rule105 _prodsIallvisits
         _inedges = rule106 _prodsIallvisits
         _allstates = rule107 _inedges _outedges arg_initial_
         _stvisits = rule108 _prodsIallvisits
         _t_type = rule109 arg_nt_
         _lt_type = rule110 arg_nt_
         _t_params = rule111 arg_params_
         _t_init_icl = rule112 _lt_type _t_init_dcl _t_type
         _t_init_dcl = rule113 _lhsIoptions _t_params _t_type arg_initial_
         _t_states_icl = rule114 _allstates arg_nextVisits_ arg_nt_
         _t_states_dcl = rule115 _allstates _t_params arg_nextVisits_ arg_nt_
         _k_type = rule116 arg_nt_
         _k_states = rule117 _allstates _k_type _prodsIallvisits _t_params _t_type arg_nextVisits_ arg_nt_
         _wr_inh_icl = rule118 _genwrap_icl _wr_inhs
         _wr_syn_icl = rule119 _genwrap_icl _wr_syns
         _genwrap_icl = rule120 _addbang arg_nt_
         _wr_inh_dcl = rule121 _genwrap_dcl _wr_inhs
         _wr_syn_dcl = rule122 _genwrap_dcl _wr_syns
         _genwrap_dcl = rule123 _addbang _t_params arg_nt_
         _synAttrs = rule124 _lhsIinhmap arg_nt_
         _wr_inhs = rule125 _synAttrs _wr_filter
         _wr_inhs1 = rule126 _synAttrs
         _wr_filter = rule127 _lhsIoptions
         _wr_syns = rule128 _lhsIsynmap arg_nt_
         _inhlist = rule129 _lhsIoptions _wr_inhs
         _inhlist1 = rule130 _lhsIoptions _wr_inhs1
         _synlist = rule131 _lhsIoptions _wr_syns
         _wrapname = rule132 arg_nt_
         _inhname = rule133 arg_nt_
         _synname = rule134 arg_nt_
         _firstVisitInfo = rule135 arg_initial_ arg_nextVisits_
         _wrapper_icl = rule136 _addbang _addbangWrap _classPP _firstVisitInfo _inhlist _inhlist1 _inhname _k_type _lhsIallVisitKinds _lhsImainName _lhsIoptions _quantPP _synlist _synname _t_params _t_type _wrapname arg_initial_ arg_initialv_ arg_nt_
         _wrapper_dcl = rule137 _classPP _inhname _lhsIoptions _quantPP _synname _t_params _t_type _wrapname
         _lhsOsemFunBndDefs :: Seq PP_Doc
         _lhsOsemFunBndDefs = rule138 _prodsIsemFunBndDefs _semFunBndDef
         _lhsOsemFunBndTps :: Seq PP_Doc
         _lhsOsemFunBndTps = rule139 _prodsIsemFunBndTps _semFunBndTp
         _semFunBndDef = rule140 _semFunBndNm _semname
         _semFunBndTp = rule141 _semFunBndNm _sem_tp
         _semFunBndNm = rule142 arg_nt_
         _prodsOinitial = rule143 arg_initial_
         _prodsOallstates = rule144 _allstates
         _lhsOappendMain ::  PP_Doc 
         _lhsOappendMain = rule145 _lhsIwrappers _sem_nt _wr_inh_icl _wr_syn_icl _wrapper_icl arg_nt_
         _lhsOappendCommon ::  PP_Doc 
         _lhsOappendCommon = rule146 _datatype _k_states _lhsIoptions _prodsIt_visits _t_init_icl _t_states_icl
         _addbang = rule147 _lhsIoptions
         _addbangWrap = rule148  ()
         _prodsOnextVisits = rule149 arg_nextVisits_
         _prodsOprevVisits = rule150 arg_prevVisits_
         _prodsOlocalAttrTypes = rule151 _lhsIlocalAttrTypes arg_nt_
         _lhsOinitStates :: Map NontermIdent Int
         _lhsOinitStates = rule152 arg_initial_ arg_nt_
         _ntType = rule153 arg_nt_ arg_params_
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule154 _prodsIchildvisit
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule155 _prodsIerrors
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule156 _prodsIfromToStates
         _lhsOgenProdIO :: IO ()
         _lhsOgenProdIO = rule157 _prodsIgenProdIO
         _lhsOimports :: [PP_Doc]
         _lhsOimports = rule158 _prodsIimports
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule159 _prodsIvisitKinds
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule160 _prodsIvisitdefs
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule161 _prodsIvisituses
         _prodsOallFromToStates = rule162 _lhsIallFromToStates
         _prodsOallInitStates = rule163 _lhsIallInitStates
         _prodsOallVisitKinds = rule164 _lhsIallVisitKinds
         _prodsOallchildvisit = rule165 _lhsIallchildvisit
         _prodsOavisitdefs = rule166 _lhsIavisitdefs
         _prodsOavisituses = rule167 _lhsIavisituses
         _prodsOconstructorTypeMap = rule168 _lhsIconstructorTypeMap
         _prodsOdclModuleHeader = rule169 _lhsIdclModuleHeader
         _prodsOiclModuleHeader = rule170 _lhsIiclModuleHeader
         _prodsOimportBlocks = rule171 _lhsIimportBlocks
         _prodsOmainFile = rule172 _lhsImainFile
         _prodsOmainName = rule173 _lhsImainName
         _prodsOntType = rule174 _ntType
         _prodsOoptions = rule175 _lhsIoptions
         _prodsOtextBlocks = rule176 _lhsItextBlocks
         __result_ = T_ENonterminal_vOut7 _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_ENonterminal_s8 v7
   {-# INLINE rule84 #-}
   {-# LINE 58 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule84 = \ ((_lhsIoptions) :: Options) ->
                                  {-# LINE 58 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  rename _lhsIoptions
                                  {-# LINE 1140 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule85 #-}
   {-# LINE 66 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule85 = \ nt_ ->
                              {-# LINE 66 "src-ag/ExecutionPlan2Clean.ag" #-}
                              nt_
                              {-# LINE 1146 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule86 #-}
   {-# LINE 78 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule86 = \ params_ ->
                   {-# LINE 78 "src-ag/ExecutionPlan2Clean.ag" #-}
                   params_
                   {-# LINE 1152 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule87 #-}
   {-# LINE 82 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule87 = \ classCtxs_ ->
                      {-# LINE 82 "src-ag/ExecutionPlan2Clean.ag" #-}
                      classCtxs_
                      {-# LINE 1158 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule88 #-}
   {-# LINE 102 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule88 = \ _hasWrapper _k_states ((_lhsIoptions) :: Options) ((_prodsIsem_prod) :: PP_Doc) _sem_nt _t_init_icl _t_states_icl _wr_inh_icl _wr_syn_icl _wrapper_icl nt_ ->
                                {-# LINE 102 "src-ag/ExecutionPlan2Clean.ag" #-}
                                ("// " ++ getName nt_ ++ " " ++ replicate (60 - length (getName nt_)) '-')
                                >-< (if _hasWrapper
                                     then "// wrapper"
                                          >-< _wr_inh_icl
                                          >-< _wr_syn_icl
                                          >-< _wrapper_icl
                                          >-< ""
                                     else empty)
                                >-< (if   folds _lhsIoptions
                                     then "// cata"
                                          >-< _sem_nt
                                          >-< ""
                                     else empty)
                                >-< (if   semfuns _lhsIoptions
                                     then "// semantic domain"
                                          >-< _t_init_icl
                                          >-< _t_states_icl
                                          >-< _k_states
                                          >-< _prodsIsem_prod
                                          >-< ""
                                     else empty)
                                {-# LINE 1184 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule89 #-}
   {-# LINE 123 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule89 = \ ((_lhsIwrappers) :: Set NontermIdent) nt_ ->
                                    {-# LINE 123 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    nt_ `Set.member` _lhsIwrappers
                                    {-# LINE 1190 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule90 #-}
   {-# LINE 125 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule90 = \ _datatype _hasWrapper ((_lhsIoptions) :: Options) ((_prodsIsem_prod_tys) :: PP_Doc) ((_prodsIt_visits) :: PP_Doc) _sem_tp _semname _t_init_dcl _t_states_dcl _wr_inh_dcl _wr_syn_dcl _wrapper_dcl nt_ ->
                                    {-# LINE 125 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    ("// " ++ getName nt_ ++ " " ++ replicate (60 - length (getName nt_)) '-')
                                    >-< (if dataTypes _lhsIoptions
                                         then "// data"
                                              >-< _datatype
                                              >-< ""
                                         else empty)
                                    >-< (if _hasWrapper
                                         then "// wrapper"
                                              >-< _wr_inh_dcl
                                              >-< _wr_syn_dcl
                                              >-< _wrapper_dcl
                                              >-< ""
                                         else empty)
                                    >-< (if   folds _lhsIoptions
                                         then "// cata"
                                              >-< _semname     >#< "::" >#< _sem_tp
                                              >-< ""
                                         else empty)
                                    >-< (if   semfuns _lhsIoptions
                                         then "// semantic domain"
                                              >-< _t_init_dcl
                                              >-< _t_states_dcl
                                              >-< _prodsIt_visits
                                              >-< _prodsIsem_prod_tys
                                              >-< ""
                                         else empty)
                                    {-# LINE 1221 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule91 #-}
   {-# LINE 163 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule91 = \ classCtxs_ ->
                                  {-# LINE 163 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  ppClasses $ classCtxsToDocs classCtxs_
                                  {-# LINE 1227 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule92 #-}
   {-# LINE 164 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule92 = \ _classPP _t_params nt_ ->
                                  {-# LINE 164 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  "::" >#< _classPP     >#< nt_ >#< _t_params     >#< ":=="
                                  {-# LINE 1233 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule93 #-}
   {-# LINE 165 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule93 = \ _aliasPre _classPP _derivings ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ((_lhsItypeSyns) :: TypeSyns) ((_prodsIdatatype) :: [PP_Doc]) ((_prodsIrecordtype) :: PP_Doc) _t_params nt_ ->
                                  {-# LINE 165 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  case lookup nt_ _lhsItypeSyns of
                                     Nothing -> "::" >#< _classPP     >#< nt_ >#< _t_params
                                                >-< ( if null _prodsIdatatype
                                                      then empty
                                                      else if isRecordConstructor nt_ _lhsIconstructorTypeMap
                                                             then  indent 2 $ "=" >#< _prodsIrecordtype
                                                             else  indent 2 $ vlist $ ( ("=" >#< head _prodsIdatatype)
                                                                                    : (map ("|" >#<) $ tail _prodsIdatatype))
                                                    )
                                                >-< indent 2 _derivings
                                     Just (List t)     -> _aliasPre     >#< "[" >#< show t >#< "]"
                                     Just (Maybe t)    -> _aliasPre     >#< "Data.Maybe" >#< pp_parens (show t)
                                     Just (Tuple ts)   -> _aliasPre     >#< pp_parens (ppCommas $ map (show . snd) ts)
                                     Just (Either l r) -> _aliasPre     >#< "Data.Either" >#< pp_parens (show l) >#< pp_parens (show r)
                                     Just (Map k v)    -> _aliasPre     >#< "Data.Map" >#< pp_parens (show k) >#< pp_parens (show v)
                                     Just (IntMap t)   -> _aliasPre     >#< "Data.IntMap.IntMap" >#< pp_parens (show t)
                                     Just (OrdSet t)   -> _aliasPre     >#< "Data.Set.Set" >#< pp_parens (show t)
                                     Just IntSet       -> _aliasPre     >#< "Data.IntSet.IntSet"
                                  {-# LINE 1256 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule94 #-}
   {-# LINE 184 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule94 = \ ((_lhsIderivings) :: Derivings) nt_ ->
                                   {-# LINE 184 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   case Map.lookup nt_ _lhsIderivings of
                                      Nothing -> empty
                                      Just s  -> if   Set.null s
                                                 then empty
                                                 else "deriving" >#< (pp_parens $ ppCommas $ map pp $ Set.toList s)
                                   {-# LINE 1266 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule95 #-}
   {-# LINE 269 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule95 = \  (_ :: ()) ->
                                  {-# LINE 269 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  \x -> "sem_" ++ show x
                                  {-# LINE 1272 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule96 #-}
   {-# LINE 270 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule96 = \ _fsemname nt_ ->
                                 {-# LINE 270 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _fsemname     nt_
                                 {-# LINE 1278 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule97 #-}
   {-# LINE 271 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule97 = \ _fsemname ->
                                 {-# LINE 271 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 \t x -> case t of
                                            NT nt _ _ -> pp_parens (_fsemname nt >#< x)
                                            _         -> pp x
                                 {-# LINE 1286 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule98 #-}
   {-# LINE 277 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule98 = \ _classPP _quantPP _t_params _t_type nt_ ->
                                 {-# LINE 277 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _quantPP     >#< _classPP     >#< nt_ >#< _t_params     >#< "->" >#< _t_type     >#< _t_params
                                 {-# LINE 1292 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule99 #-}
   {-# LINE 278 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule99 = \ params_ ->
                                 {-# LINE 278 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 ppQuants params_
                                 {-# LINE 1298 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule100 #-}
   {-# LINE 280 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule100 = \ _frecarg _fsemname ((_lhsItypeSyns) :: TypeSyns) ((_prodsIsem_nt) :: PP_Doc) _sem_tp _semname nt_ ->
                                 {-# LINE 280 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _semname     >#< "::" >#< _sem_tp
                                 >-< case lookup nt_ _lhsItypeSyns of
                                        Nothing -> _prodsIsem_nt
                                        Just (List t) -> _semname     >#< "list" >#< "=" >#< "foldr" >#< _semname     >|< "_Cons"
                                                         >#< _semname     >|< "_Nil"
                                                         >#< case t of
                                                                NT nt _ _ -> pp_parens ("map" >#< _fsemname nt >#< "list")
                                                                _         -> pp "list"
                                        Just (Maybe t) -> _semname     >#< "'Data.Maybe'.Nothing" >#< "=" >#< _semname     >|< "_Nothing"
                                                          >-< _semname     >#< pp_parens ("'Data.Maybe'.Just just") >#< "="
                                                          >#< _semname     >|< "_Just" >#< _frecarg t "just"
                                        Just (Tuple ts) -> _semname     >#< pp_parens (ppCommas $ map fst ts) >#< "="
                                                           >#< _semname     >|< "_Tuple" >#< ppSpaced (map (\t -> _frecarg (snd t) (show $ fst t)) ts)
                                        Just (Either l r) -> _semname     >#< "('Data.Either'.Left left)" >#< "=" >#< _semname     >|< "_Left" >#< _frecarg l "left"
                                                             >-< _semname     >#< "('Data.Either'.Right right)" >#< "=" >#< _semname     >|< "_Right" >#< _frecarg r "right"
                                        Just (Map k v) -> _semname     >#< "m" >#< "=" >#< "'Data.Map'.foldrWithKey"
                                                          >#< _semname     >|< "_Entry" >#< _semname     >|< "_Nil"
                                                          >#< case v of
                                                                 NT nt _ _ -> pp_parens ("'Data.Map'.map" >#< _fsemname nt >#< "m")
                                                                 _         -> pp "m"
                                        Just (IntMap v) -> _semname     >#< "m" >#< "=" >#< "'Data.IntMap'.foldWithKey"
                                                           >#< _semname     >|< "_Entry" >#< _semname     >|< "_Nil"
                                                           >#< case v of
                                                                  NT nt _ _ -> pp_parens ("'Data.IntMap'.map" >#< _fsemname nt >#< "m")
                                                                  _         -> pp "m"
                                        Just (OrdSet t) -> _semname     >#< "s" >#< "=" >#< "foldr" >#< _semname     >|< "_Entry"
                                                           >#< _semname     >|< "_Nil"
                                                           >#< pp_parens (
                                                                 ( case t of
                                                                     NT nt _ _ -> pp_parens ("map" >#< _fsemname nt)
                                                                     _         -> empty
                                                                 ) >#< pp_parens ("'Data.IntSet'.elems" >#< "s")
                                                               )
                                        Just IntSet     -> _semname     >#< "s" >#< "=" >#< "foldr" >#< _semname     >|< "_Entry"
                                                           >#< _semname     >|< "_Nil"
                                                           >#< pp_parens ("'Data.IntSet'.elems" >#< "s")
                                 {-# LINE 1339 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule101 #-}
   {-# LINE 366 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule101 = \ ((_lhsIinhmap) :: Map NontermIdent Attributes) nt_ ->
                                         {-# LINE 366 "src-ag/ExecutionPlan2Clean.ag" #-}
                                         Map.lookup nt_ _lhsIinhmap
                                         {-# LINE 1345 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule102 #-}
   {-# LINE 367 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule102 = \ ((_lhsIsynmap) :: Map NontermIdent Attributes) nt_ ->
                                         {-# LINE 367 "src-ag/ExecutionPlan2Clean.ag" #-}
                                         Map.lookup nt_ _lhsIsynmap
                                         {-# LINE 1351 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule103 #-}
   {-# LINE 368 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule103 = \ ((_lhsIinhmap) :: Map NontermIdent Attributes) ->
                                     {-# LINE 368 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     _lhsIinhmap
                                     {-# LINE 1357 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule104 #-}
   {-# LINE 369 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule104 = \ ((_lhsIsynmap) :: Map NontermIdent Attributes) ->
                                     {-# LINE 369 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     _lhsIsynmap
                                     {-# LINE 1363 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule105 #-}
   {-# LINE 390 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule105 = \ ((_prodsIallvisits) :: [VisitStateState]) ->
                                   {-# LINE 390 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   Set.fromList $ map (\(_,f,_) -> f) _prodsIallvisits
                                   {-# LINE 1369 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule106 #-}
   {-# LINE 391 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule106 = \ ((_prodsIallvisits) :: [VisitStateState]) ->
                                   {-# LINE 391 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   Set.fromList $ map (\(_,_,t) -> t) _prodsIallvisits
                                   {-# LINE 1375 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule107 #-}
   {-# LINE 392 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule107 = \ _inedges _outedges initial_ ->
                                   {-# LINE 392 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   Set.insert initial_ $ _inedges     `Set.union` _outedges
                                   {-# LINE 1381 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule108 #-}
   {-# LINE 393 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule108 = \ ((_prodsIallvisits) :: [VisitStateState]) ->
                                   {-# LINE 393 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   \st -> filter (\(v,f,t) -> f == st) _prodsIallvisits
                                   {-# LINE 1387 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule109 #-}
   {-# LINE 394 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule109 = \ nt_ ->
                                   {-# LINE 394 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   "T_" >|< nt_
                                   {-# LINE 1393 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule110 #-}
   {-# LINE 395 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule110 = \ nt_ ->
                                   {-# LINE 395 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   "t_" >|< nt_
                                   {-# LINE 1399 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule111 #-}
   {-# LINE 396 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule111 = \ params_ ->
                                   {-# LINE 396 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   ppSpaced params_
                                   {-# LINE 1405 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule112 #-}
   {-# LINE 397 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule112 = \ _lt_type _t_init_dcl _t_type ->
                                       {-# LINE 397 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       _t_init_dcl     >-<
                                       "attach_" >|< _t_type     >#< pp_parens (_t_type     >#< _lt_type    ) >#< "=" >#< _lt_type
                                       {-# LINE 1412 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule113 #-}
   {-# LINE 399 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule113 = \ ((_lhsIoptions) :: Options) _t_params _t_type initial_ ->
                                       {-# LINE 399 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       "::" >#< _t_type     >#< _t_params     >#< "=" >#< _t_type
                                       >#<
                                       pp_parens (
                                       ppMonadType _lhsIoptions >#< pp_parens (_t_type     >|< "_s" >|< initial_ >#< _t_params    ))
                                       {-# LINE 1421 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule114 #-}
   {-# LINE 403 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule114 = \ _allstates nextVisits_ nt_ ->
                                       {-# LINE 403 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       vlist $ map (\st ->
                                         let nt_st = nt_ >|< "_s" >|< st
                                             c_st  = "C_" >|< nt_st
                                             inv_st  = "inv_" >|< nt_st
                                             nextVisit = Map.findWithDefault ManyVis st nextVisits_
                                         in  case nextVisit of
                                               NoneVis    -> empty
                                               OneVis vId -> inv_st >#< pp_parens (c_st >#< "x") >#< "=" >#< "x"
                                               ManyVis    -> empty
                                             ) $ Set.toList _allstates
                                       {-# LINE 1436 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule115 #-}
   {-# LINE 413 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule115 = \ _allstates _t_params nextVisits_ nt_ ->
                                       {-# LINE 413 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       vlist $ map (\st ->
                                         let nt_st   = nt_ >|< "_s" >|< st
                                             t_st    = "T_" >|< nt_st
                                             k_st    = "K_" >|< nt_st
                                             c_st    = "C_" >|< nt_st
                                             inv_st  = "inv_" >|< nt_st
                                             nextVisit = Map.findWithDefault ManyVis st nextVisits_
                                         in  case nextVisit of
                                               NoneVis    -> "::" >#< t_st >#< _t_params     >#< "=" >#< c_st
                                               OneVis vId -> "::" >#< t_st >#< _t_params     >#< "=" >#< c_st >#< (pp_parens (conNmTVisit nt_ vId >#< _t_params    ))
                                               ManyVis    -> "::" >#< t_st >#< _t_params     >#< "where" >#< c_st >#< "::"
                                                               >#< (pp_braces $ inv_st >#< "::" >#< "!" >|< pp_parens ("E.t:" >#< k_st >#< _t_params     >#< "t" >#< "->" >#< "t"))
                                                               >#< "->" >#< t_st >#< _t_params
                                             ) $ Set.toList _allstates
                                       {-# LINE 1455 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule116 #-}
   {-# LINE 430 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule116 = \ nt_ ->
                                  {-# LINE 430 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  "K_" ++ show nt_
                                  {-# LINE 1461 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule117 #-}
   {-# LINE 431 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule117 = \ _allstates _k_type ((_prodsIallvisits) :: [VisitStateState]) _t_params _t_type nextVisits_ nt_ ->
                                  {-# LINE 431 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  vlist $ map (\st ->
                                     let nt_st = nt_ >|< "_s" >|< st
                                         k_st  = "K_" >|< nt_st
                                         outg  = filter (\(v,f,t) -> f == st) _prodsIallvisits
                                         visitlist = vlist $ map (\(v,f,t) ->
                                             _k_type     >|< "_v" >|< v >#< "::" >#< k_st >#< _t_params     >#< pp_parens (_t_type     >|< "_v" >|< v >#< _t_params    )
                                              ) outg
                                         nextVisit = Map.findWithDefault ManyVis st nextVisits_
                                         decl = "::" >#< k_st >#< "k" >#< _t_params     >#< "where" >-< indent 3 visitlist
                                     in  case nextVisit of
                                           NoneVis  -> empty
                                           OneVis _ -> empty
                                           ManyVis  -> decl
                                     ) $ Set.toList _allstates
                                  {-# LINE 1480 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule118 #-}
   {-# LINE 499 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule118 = \ _genwrap_icl _wr_inhs ->
                                      {-# LINE 499 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      _genwrap_icl     "Inh" _wr_inhs
                                      {-# LINE 1486 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule119 #-}
   {-# LINE 500 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule119 = \ _genwrap_icl _wr_syns ->
                                      {-# LINE 500 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      _genwrap_icl     "Syn" _wr_syns
                                      {-# LINE 1492 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule120 #-}
   {-# LINE 501 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule120 = \ _addbang nt_ ->
                                      {-# LINE 501 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      \nm attr ->
                                        let tyConName = nm >|< "_" >|< nt_
                                        in  (let (d, _, _) = foldr (\(i, t) (d, c, n) -> (d >-<
                                                               i >|< "_" >|< tyConName >#< "::" >#< tyConName >#< "->" >#< (_addbang     $ pp_parens $ typeToHaskellString (Just nt_) [] t)
                                                               >-< i >|< "_" >|< tyConName >#< pp_parens (tyConName >#< unwords (replicate (n - c - 1) "_" ++ ["x"] ++ replicate c "_")) >#< "= x"
                                                               , c + 1, n)
                                                               ) (empty, 0, length attr) attr
                                            in  d)
                                      {-# LINE 1505 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule121 #-}
   {-# LINE 509 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule121 = \ _genwrap_dcl _wr_inhs ->
                                      {-# LINE 509 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      _genwrap_dcl     "Inh" _wr_inhs
                                      {-# LINE 1511 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule122 #-}
   {-# LINE 510 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule122 = \ _genwrap_dcl _wr_syns ->
                                      {-# LINE 510 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      _genwrap_dcl     "Syn" _wr_syns
                                      {-# LINE 1517 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule123 #-}
   {-# LINE 511 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule123 = \ _addbang _t_params nt_ ->
                                      {-# LINE 511 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      \nm attr ->
                                        let tyConName = nm >|< "_" >|< nt_
                                        in  "::" >#< tyConName >#< _t_params     >#< "=" >#< tyConName
                                            >#< (ppSpaced $ map (\(_,t) -> _addbang     $ pp_parens $ typeToHaskellString (Just nt_) [] t) attr)
                                            >-<
                                                (let (d, _, _) = foldr (\(i, t) (d, c, n) -> (d >-<
                                                                  i >|< "_" >|< tyConName >#< "::" >#< tyConName >#< "->" >#< (_addbang     $ pp_parens $ typeToHaskellString (Just nt_) [] t)
                                                                  , c + 1, n)
                                                                  ) (empty, 0, length attr) attr
                                                in  d)
                                      {-# LINE 1532 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule124 #-}
   {-# LINE 521 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule124 = \ ((_lhsIinhmap) :: Map NontermIdent Attributes) nt_ ->
                                  {-# LINE 521 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  fromJust $ Map.lookup nt_ _lhsIinhmap
                                  {-# LINE 1538 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule125 #-}
   {-# LINE 522 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule125 = \ _synAttrs _wr_filter ->
                                  {-# LINE 522 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  Map.toList $ _wr_filter     $ _synAttrs
                                  {-# LINE 1544 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule126 #-}
   {-# LINE 523 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule126 = \ _synAttrs ->
                                  {-# LINE 523 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  Map.toList _synAttrs
                                  {-# LINE 1550 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule127 #-}
   {-# LINE 524 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule127 = \ ((_lhsIoptions) :: Options) ->
                                   {-# LINE 524 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   if lateHigherOrderBinding _lhsIoptions
                                   then Map.delete idLateBindingAttr
                                   else id
                                   {-# LINE 1558 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule128 #-}
   {-# LINE 527 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule128 = \ ((_lhsIsynmap) :: Map NontermIdent Attributes) nt_ ->
                                  {-# LINE 527 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  Map.toList $ fromJust $ Map.lookup nt_ _lhsIsynmap
                                  {-# LINE 1564 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule129 #-}
   {-# LINE 528 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule129 = \ ((_lhsIoptions) :: Options) _wr_inhs ->
                                  {-# LINE 528 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  map (lhsname _lhsIoptions True . fst) _wr_inhs
                                  {-# LINE 1570 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule130 #-}
   {-# LINE 529 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule130 = \ ((_lhsIoptions) :: Options) _wr_inhs1 ->
                                  {-# LINE 529 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  map (lhsname _lhsIoptions True . fst) _wr_inhs1
                                  {-# LINE 1576 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule131 #-}
   {-# LINE 530 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule131 = \ ((_lhsIoptions) :: Options) _wr_syns ->
                                  {-# LINE 530 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  map (lhsname _lhsIoptions False . fst) _wr_syns
                                  {-# LINE 1582 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule132 #-}
   {-# LINE 531 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule132 = \ nt_ ->
                                  {-# LINE 531 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  "wrap_" ++ show nt_
                                  {-# LINE 1588 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule133 #-}
   {-# LINE 532 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule133 = \ nt_ ->
                                  {-# LINE 532 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  "Inh_" ++ show nt_
                                  {-# LINE 1594 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule134 #-}
   {-# LINE 533 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule134 = \ nt_ ->
                                  {-# LINE 533 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  "Syn_" ++ show nt_
                                  {-# LINE 1600 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule135 #-}
   {-# LINE 534 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule135 = \ initial_ nextVisits_ ->
                                        {-# LINE 534 "src-ag/ExecutionPlan2Clean.ag" #-}
                                        Map.findWithDefault ManyVis initial_ nextVisits_
                                        {-# LINE 1606 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule136 #-}
   {-# LINE 535 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule136 = \ _addbang _addbangWrap _classPP _firstVisitInfo _inhlist _inhlist1 _inhname _k_type ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ((_lhsImainName) :: String) ((_lhsIoptions) :: Options) _quantPP _synlist _synname _t_params _t_type _wrapname initial_ initialv_ nt_ ->
                                      {-# LINE 535 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      (_wrapname     >#< "::" >#< _quantPP     >#< _classPP     >#< _t_type     >#< _t_params
                                            >#< _inhname     >#< _t_params     >#< "->" >#< ( if monadicWrappers _lhsIoptions then ppMonadType _lhsIoptions else empty) >#< pp_parens (_synname     >#< _t_params    ))
                                      >-< (_wrapname     >#< (_addbang     $ pp_parens (_t_type     >#< pp "act"))
                                          >#< (_addbang     $ pp_parens (_inhname
                                                 >#< (ppSpaced $ map (_addbangWrap     . pp) _inhlist    )) >#< "="))
                                      >-<
                                      indent 3 (case initialv_ of
                                        [] -> text _synname
                                        (initv:_) ->
                                          let inCon  = conNmTVisitIn nt_ initv
                                              outCon = conNmTVisitOut nt_ initv
                                              pat    = _addbang     $ pp_parens $ pat0
                                              pat0   = outCon >#< ppSpaced _synlist
                                              arg    = inCon >#< ppSpaced _inhlist1
                                              ind    = case _firstVisitInfo     of
                                                         NoneVis  -> error "wrapper: initial state should have a next visit but it has none"
                                                         OneVis _ -> empty
                                                         ManyVis  -> _k_type     >|< "_v" >|< initv
                                              extra  = if dummyTokenVisit _lhsIoptions
                                                       then pp $ dummyArg _lhsIoptions True
                                                       else empty
                                              convert = case Map.lookup initv _lhsIallVisitKinds of
                                                          Just kind -> case kind of
                                                                         VisitPure _  -> text "lift"
                                                                         VisitMonadic -> empty
                                                          _         -> empty
                                              unMonad | monadicWrappers _lhsIoptions = empty
                                                      | otherwise                    = unMon _lhsIoptions
                                          in unMonad >#< "("
                                             >-< indent 2
                                                   ("act >>= \\" >#< _addbang     (pp "sem") >#< "->"
                                                   >-< "lift" >#< pp_parens arg >#< ">>= \\" >#< _addbangWrap     (pp "arg") >#< "->"
                                                   >-< convert >#< pp_parens ("inv_" >|< nt_ >|< "_s" >|< initial_ >#< "sem" >#< ind >#< "arg" >#< extra) >#< ">>= \\" >#< pat >#< "->"
                                                   >-< "lift" >#< pp_parens (_synname     >#< ppSpaced _synlist    )
                                                   )
                                             >-< ")" )
                                      >-< if lateHigherOrderBinding _lhsIoptions
                                          then indent 2 ("where" >#< lhsname _lhsIoptions True idLateBindingAttr >#< "=" >#< lateBindingFieldNm _lhsImainName)
                                          else empty
                                      {-# LINE 1650 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule137 #-}
   {-# LINE 575 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule137 = \ _classPP _inhname ((_lhsIoptions) :: Options) _quantPP _synname _t_params _t_type _wrapname ->
                                      {-# LINE 575 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      (_wrapname     >#< "::" >#< _quantPP     >#< _classPP     >#< _t_type     >#< _t_params
                                            >#< _inhname     >#< _t_params     >#< "->" >#< ( if monadicWrappers _lhsIoptions then ppMonadType _lhsIoptions else empty) >#< pp_parens (_synname     >#< _t_params    ))
                                      {-# LINE 1657 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule138 #-}
   {-# LINE 584 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule138 = \ ((_prodsIsemFunBndDefs) :: Seq PP_Doc) _semFunBndDef ->
                        {-# LINE 584 "src-ag/ExecutionPlan2Clean.ag" #-}
                        _semFunBndDef     Seq.<| _prodsIsemFunBndDefs
                        {-# LINE 1663 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule139 #-}
   {-# LINE 585 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule139 = \ ((_prodsIsemFunBndTps) :: Seq PP_Doc) _semFunBndTp ->
                        {-# LINE 585 "src-ag/ExecutionPlan2Clean.ag" #-}
                        _semFunBndTp     Seq.<| _prodsIsemFunBndTps
                        {-# LINE 1669 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule140 #-}
   {-# LINE 586 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule140 = \ _semFunBndNm _semname ->
                        {-# LINE 586 "src-ag/ExecutionPlan2Clean.ag" #-}
                        _semFunBndNm     >#< "=" >#< _semname
                        {-# LINE 1675 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule141 #-}
   {-# LINE 587 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule141 = \ _semFunBndNm _sem_tp ->
                        {-# LINE 587 "src-ag/ExecutionPlan2Clean.ag" #-}
                        _semFunBndNm     >#< "::" >#< _sem_tp
                        {-# LINE 1681 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule142 #-}
   {-# LINE 588 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule142 = \ nt_ ->
                        {-# LINE 588 "src-ag/ExecutionPlan2Clean.ag" #-}
                        lateSemNtLabel nt_
                        {-# LINE 1687 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule143 #-}
   {-# LINE 622 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule143 = \ initial_ ->
                                     {-# LINE 622 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     initial_
                                     {-# LINE 1693 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule144 #-}
   {-# LINE 623 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule144 = \ _allstates ->
                                     {-# LINE 623 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     _allstates
                                     {-# LINE 1699 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule145 #-}
   {-# LINE 1469 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule145 = \ ((_lhsIwrappers) :: Set NontermIdent) _sem_nt _wr_inh_icl _wr_syn_icl _wrapper_icl nt_ ->
                                      {-# LINE 1469 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      (if nt_ `Set.member` _lhsIwrappers
                                       then     _wr_inh_icl
                                            >-< _wr_syn_icl
                                            >-< _wrapper_icl
                                       else empty)
                                      >-< _sem_nt
                                      {-# LINE 1710 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule146 #-}
   {-# LINE 1475 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule146 = \ _datatype _k_states ((_lhsIoptions) :: Options) ((_prodsIt_visits) :: PP_Doc) _t_init_icl _t_states_icl ->
                                      {-# LINE 1475 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      (if dataTypes _lhsIoptions then _datatype     else empty)
                                      >-< _t_init_icl
                                      >-< _t_states_icl
                                      >-< _k_states
                                      >-< _prodsIt_visits
                                      {-# LINE 1720 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule147 #-}
   {-# LINE 1566 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule147 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1566 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 1726 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule148 #-}
   {-# LINE 1574 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule148 = \  (_ :: ()) ->
                                                        {-# LINE 1574 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                        id
                                                        {-# LINE 1732 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule149 #-}
   {-# LINE 1586 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule149 = \ nextVisits_ ->
                       {-# LINE 1586 "src-ag/ExecutionPlan2Clean.ag" #-}
                       nextVisits_
                       {-# LINE 1738 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule150 #-}
   {-# LINE 1587 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule150 = \ prevVisits_ ->
                       {-# LINE 1587 "src-ag/ExecutionPlan2Clean.ag" #-}
                       prevVisits_
                       {-# LINE 1744 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule151 #-}
   {-# LINE 1631 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule151 = \ ((_lhsIlocalAttrTypes) :: Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) nt_ ->
                           {-# LINE 1631 "src-ag/ExecutionPlan2Clean.ag" #-}
                           Map.findWithDefault Map.empty nt_ _lhsIlocalAttrTypes
                           {-# LINE 1750 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule152 #-}
   {-# LINE 1658 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule152 = \ initial_ nt_ ->
                     {-# LINE 1658 "src-ag/ExecutionPlan2Clean.ag" #-}
                     Map.singleton nt_ initial_
                     {-# LINE 1756 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule153 #-}
   {-# LINE 1672 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule153 = \ nt_ params_ ->
                 {-# LINE 1672 "src-ag/ExecutionPlan2Clean.ag" #-}
                 NT nt_ (map show params_) False
                 {-# LINE 1762 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule154 #-}
   rule154 = \ ((_prodsIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _prodsIchildvisit
   {-# INLINE rule155 #-}
   rule155 = \ ((_prodsIerrors) :: Seq Error) ->
     _prodsIerrors
   {-# INLINE rule156 #-}
   rule156 = \ ((_prodsIfromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _prodsIfromToStates
   {-# INLINE rule157 #-}
   rule157 = \ ((_prodsIgenProdIO) :: IO ()) ->
     _prodsIgenProdIO
   {-# INLINE rule158 #-}
   rule158 = \ ((_prodsIimports) :: [PP_Doc]) ->
     _prodsIimports
   {-# INLINE rule159 #-}
   rule159 = \ ((_prodsIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _prodsIvisitKinds
   {-# INLINE rule160 #-}
   rule160 = \ ((_prodsIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _prodsIvisitdefs
   {-# INLINE rule161 #-}
   rule161 = \ ((_prodsIvisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _prodsIvisituses
   {-# INLINE rule162 #-}
   rule162 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule163 #-}
   rule163 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule164 #-}
   rule164 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule165 #-}
   rule165 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule166 #-}
   rule166 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule167 #-}
   rule167 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule168 #-}
   rule168 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule169 #-}
   rule169 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule170 #-}
   rule170 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule171 #-}
   rule171 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule172 #-}
   rule172 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule173 #-}
   rule173 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule174 #-}
   rule174 = \ _ntType ->
     _ntType
   {-# INLINE rule175 #-}
   rule175 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule176 #-}
   rule176 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks

-- ENonterminals -----------------------------------------------
-- wrapper
data Inh_ENonterminals  = Inh_ENonterminals { allFromToStates_Inh_ENonterminals :: (Map VisitIdentifier (Int,Int)), allInitStates_Inh_ENonterminals :: (Map NontermIdent Int), allVisitKinds_Inh_ENonterminals :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_ENonterminals :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), avisitdefs_Inh_ENonterminals :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_ENonterminals :: (Map VisitIdentifier (Set Identifier)), constructorTypeMap_Inh_ENonterminals :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_ENonterminals :: (String -> String -> String -> Bool -> String), derivings_Inh_ENonterminals :: (Derivings), iclModuleHeader_Inh_ENonterminals :: (String -> String -> String -> Bool -> String), importBlocks_Inh_ENonterminals :: (PP_Doc), inhmap_Inh_ENonterminals :: (Map NontermIdent Attributes), localAttrTypes_Inh_ENonterminals :: (Map NontermIdent (Map ConstructorIdent (Map Identifier Type))), mainFile_Inh_ENonterminals :: (String), mainName_Inh_ENonterminals :: (String), options_Inh_ENonterminals :: (Options), synmap_Inh_ENonterminals :: (Map NontermIdent Attributes), textBlocks_Inh_ENonterminals :: (PP_Doc), typeSyns_Inh_ENonterminals :: (TypeSyns), wrappers_Inh_ENonterminals :: (Set NontermIdent) }
data Syn_ENonterminals  = Syn_ENonterminals { appendCommon_Syn_ENonterminals :: ([PP_Doc]), appendMain_Syn_ENonterminals :: ([PP_Doc]), childvisit_Syn_ENonterminals :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), errors_Syn_ENonterminals :: (Seq Error), fromToStates_Syn_ENonterminals :: (Map VisitIdentifier (Int,Int)), genProdIO_Syn_ENonterminals :: (IO ()), imports_Syn_ENonterminals :: ([PP_Doc]), initStates_Syn_ENonterminals :: (Map NontermIdent Int), output_Syn_ENonterminals :: (PP_Doc), output_dcl_Syn_ENonterminals :: (PP_Doc), semFunBndDefs_Syn_ENonterminals :: (Seq PP_Doc), semFunBndTps_Syn_ENonterminals :: (Seq PP_Doc), visitKinds_Syn_ENonterminals :: (Map VisitIdentifier VisitKind), visitdefs_Syn_ENonterminals :: (Map VisitIdentifier (Set Identifier)), visituses_Syn_ENonterminals :: (Map VisitIdentifier (Set Identifier)) }
{-# INLINABLE wrap_ENonterminals #-}
wrap_ENonterminals :: T_ENonterminals  -> Inh_ENonterminals  -> (Syn_ENonterminals )
wrap_ENonterminals (T_ENonterminals act) (Inh_ENonterminals _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg10 = T_ENonterminals_vIn10 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers
        (T_ENonterminals_vOut10 _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses) <- return (inv_ENonterminals_s11 sem arg10)
        return (Syn_ENonterminals _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses)
   )

-- cata
{-# NOINLINE sem_ENonterminals #-}
sem_ENonterminals :: ENonterminals  -> T_ENonterminals 
sem_ENonterminals list = Prelude.foldr sem_ENonterminals_Cons sem_ENonterminals_Nil (Prelude.map sem_ENonterminal list)

-- semantic domain
newtype T_ENonterminals  = T_ENonterminals {
                                           attach_T_ENonterminals :: Identity (T_ENonterminals_s11 )
                                           }
newtype T_ENonterminals_s11  = C_ENonterminals_s11 {
                                                   inv_ENonterminals_s11 :: (T_ENonterminals_v10 )
                                                   }
data T_ENonterminals_s12  = C_ENonterminals_s12
type T_ENonterminals_v10  = (T_ENonterminals_vIn10 ) -> (T_ENonterminals_vOut10 )
data T_ENonterminals_vIn10  = T_ENonterminals_vIn10 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Int) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (Derivings) (String -> String -> String -> Bool -> String) (PP_Doc) (Map NontermIdent Attributes) (Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) (String) (String) (Options) (Map NontermIdent Attributes) (PP_Doc) (TypeSyns) (Set NontermIdent)
data T_ENonterminals_vOut10  = T_ENonterminals_vOut10 ([PP_Doc]) ([PP_Doc]) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Seq Error) (Map VisitIdentifier (Int,Int)) (IO ()) ([PP_Doc]) (Map NontermIdent Int) (PP_Doc) (PP_Doc) (Seq PP_Doc) (Seq PP_Doc) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier))
{-# NOINLINE sem_ENonterminals_Cons #-}
sem_ENonterminals_Cons :: T_ENonterminal  -> T_ENonterminals  -> T_ENonterminals 
sem_ENonterminals_Cons arg_hd_ arg_tl_ = T_ENonterminals (return st11) where
   {-# NOINLINE st11 #-}
   st11 = let
      v10 :: T_ENonterminals_v10 
      v10 = \ (T_ENonterminals_vIn10 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers) -> ( let
         _hdX8 = Control.Monad.Identity.runIdentity (attach_T_ENonterminal (arg_hd_))
         _tlX11 = Control.Monad.Identity.runIdentity (attach_T_ENonterminals (arg_tl_))
         (T_ENonterminal_vOut7 _hdIappendCommon _hdIappendMain _hdIchildvisit _hdIerrors _hdIfromToStates _hdIgenProdIO _hdIimports _hdIinitStates _hdIoutput _hdIoutput_dcl _hdIsemFunBndDefs _hdIsemFunBndTps _hdIvisitKinds _hdIvisitdefs _hdIvisituses) = inv_ENonterminal_s8 _hdX8 (T_ENonterminal_vIn7 _hdOallFromToStates _hdOallInitStates _hdOallVisitKinds _hdOallchildvisit _hdOavisitdefs _hdOavisituses _hdOconstructorTypeMap _hdOdclModuleHeader _hdOderivings _hdOiclModuleHeader _hdOimportBlocks _hdOinhmap _hdOlocalAttrTypes _hdOmainFile _hdOmainName _hdOoptions _hdOsynmap _hdOtextBlocks _hdOtypeSyns _hdOwrappers)
         (T_ENonterminals_vOut10 _tlIappendCommon _tlIappendMain _tlIchildvisit _tlIerrors _tlIfromToStates _tlIgenProdIO _tlIimports _tlIinitStates _tlIoutput _tlIoutput_dcl _tlIsemFunBndDefs _tlIsemFunBndTps _tlIvisitKinds _tlIvisitdefs _tlIvisituses) = inv_ENonterminals_s11 _tlX11 (T_ENonterminals_vIn10 _tlOallFromToStates _tlOallInitStates _tlOallVisitKinds _tlOallchildvisit _tlOavisitdefs _tlOavisituses _tlOconstructorTypeMap _tlOdclModuleHeader _tlOderivings _tlOiclModuleHeader _tlOimportBlocks _tlOinhmap _tlOlocalAttrTypes _tlOmainFile _tlOmainName _tlOoptions _tlOsynmap _tlOtextBlocks _tlOtypeSyns _tlOwrappers)
         _lhsOappendCommon :: [PP_Doc]
         _lhsOappendCommon = rule177 _hdIappendCommon _tlIappendCommon
         _lhsOappendMain :: [PP_Doc]
         _lhsOappendMain = rule178 _hdIappendMain _tlIappendMain
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule179 _hdIchildvisit _tlIchildvisit
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule180 _hdIerrors _tlIerrors
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule181 _hdIfromToStates _tlIfromToStates
         _lhsOgenProdIO :: IO ()
         _lhsOgenProdIO = rule182 _hdIgenProdIO _tlIgenProdIO
         _lhsOimports :: [PP_Doc]
         _lhsOimports = rule183 _hdIimports _tlIimports
         _lhsOinitStates :: Map NontermIdent Int
         _lhsOinitStates = rule184 _hdIinitStates _tlIinitStates
         _lhsOoutput :: PP_Doc
         _lhsOoutput = rule185 _hdIoutput _tlIoutput
         _lhsOoutput_dcl :: PP_Doc
         _lhsOoutput_dcl = rule186 _hdIoutput_dcl _tlIoutput_dcl
         _lhsOsemFunBndDefs :: Seq PP_Doc
         _lhsOsemFunBndDefs = rule187 _hdIsemFunBndDefs _tlIsemFunBndDefs
         _lhsOsemFunBndTps :: Seq PP_Doc
         _lhsOsemFunBndTps = rule188 _hdIsemFunBndTps _tlIsemFunBndTps
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule189 _hdIvisitKinds _tlIvisitKinds
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule190 _hdIvisitdefs _tlIvisitdefs
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule191 _hdIvisituses _tlIvisituses
         _hdOallFromToStates = rule192 _lhsIallFromToStates
         _hdOallInitStates = rule193 _lhsIallInitStates
         _hdOallVisitKinds = rule194 _lhsIallVisitKinds
         _hdOallchildvisit = rule195 _lhsIallchildvisit
         _hdOavisitdefs = rule196 _lhsIavisitdefs
         _hdOavisituses = rule197 _lhsIavisituses
         _hdOconstructorTypeMap = rule198 _lhsIconstructorTypeMap
         _hdOdclModuleHeader = rule199 _lhsIdclModuleHeader
         _hdOderivings = rule200 _lhsIderivings
         _hdOiclModuleHeader = rule201 _lhsIiclModuleHeader
         _hdOimportBlocks = rule202 _lhsIimportBlocks
         _hdOinhmap = rule203 _lhsIinhmap
         _hdOlocalAttrTypes = rule204 _lhsIlocalAttrTypes
         _hdOmainFile = rule205 _lhsImainFile
         _hdOmainName = rule206 _lhsImainName
         _hdOoptions = rule207 _lhsIoptions
         _hdOsynmap = rule208 _lhsIsynmap
         _hdOtextBlocks = rule209 _lhsItextBlocks
         _hdOtypeSyns = rule210 _lhsItypeSyns
         _hdOwrappers = rule211 _lhsIwrappers
         _tlOallFromToStates = rule212 _lhsIallFromToStates
         _tlOallInitStates = rule213 _lhsIallInitStates
         _tlOallVisitKinds = rule214 _lhsIallVisitKinds
         _tlOallchildvisit = rule215 _lhsIallchildvisit
         _tlOavisitdefs = rule216 _lhsIavisitdefs
         _tlOavisituses = rule217 _lhsIavisituses
         _tlOconstructorTypeMap = rule218 _lhsIconstructorTypeMap
         _tlOdclModuleHeader = rule219 _lhsIdclModuleHeader
         _tlOderivings = rule220 _lhsIderivings
         _tlOiclModuleHeader = rule221 _lhsIiclModuleHeader
         _tlOimportBlocks = rule222 _lhsIimportBlocks
         _tlOinhmap = rule223 _lhsIinhmap
         _tlOlocalAttrTypes = rule224 _lhsIlocalAttrTypes
         _tlOmainFile = rule225 _lhsImainFile
         _tlOmainName = rule226 _lhsImainName
         _tlOoptions = rule227 _lhsIoptions
         _tlOsynmap = rule228 _lhsIsynmap
         _tlOtextBlocks = rule229 _lhsItextBlocks
         _tlOtypeSyns = rule230 _lhsItypeSyns
         _tlOwrappers = rule231 _lhsIwrappers
         __result_ = T_ENonterminals_vOut10 _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_ENonterminals_s11 v10
   {-# INLINE rule177 #-}
   rule177 = \ ((_hdIappendCommon) ::  PP_Doc ) ((_tlIappendCommon) :: [PP_Doc]) ->
     _hdIappendCommon : _tlIappendCommon
   {-# INLINE rule178 #-}
   rule178 = \ ((_hdIappendMain) ::  PP_Doc ) ((_tlIappendMain) :: [PP_Doc]) ->
     _hdIappendMain : _tlIappendMain
   {-# INLINE rule179 #-}
   rule179 = \ ((_hdIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ((_tlIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _hdIchildvisit `Map.union` _tlIchildvisit
   {-# INLINE rule180 #-}
   rule180 = \ ((_hdIerrors) :: Seq Error) ((_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# INLINE rule181 #-}
   rule181 = \ ((_hdIfromToStates) :: Map VisitIdentifier (Int,Int)) ((_tlIfromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _hdIfromToStates `mappend` _tlIfromToStates
   {-# INLINE rule182 #-}
   rule182 = \ ((_hdIgenProdIO) :: IO ()) ((_tlIgenProdIO) :: IO ()) ->
     _hdIgenProdIO >> _tlIgenProdIO
   {-# INLINE rule183 #-}
   rule183 = \ ((_hdIimports) :: [PP_Doc]) ((_tlIimports) :: [PP_Doc]) ->
     _hdIimports ++ _tlIimports
   {-# INLINE rule184 #-}
   rule184 = \ ((_hdIinitStates) :: Map NontermIdent Int) ((_tlIinitStates) :: Map NontermIdent Int) ->
     _hdIinitStates `mappend` _tlIinitStates
   {-# INLINE rule185 #-}
   rule185 = \ ((_hdIoutput) :: PP_Doc) ((_tlIoutput) :: PP_Doc) ->
     _hdIoutput >-< _tlIoutput
   {-# INLINE rule186 #-}
   rule186 = \ ((_hdIoutput_dcl) :: PP_Doc) ((_tlIoutput_dcl) :: PP_Doc) ->
     _hdIoutput_dcl >-< _tlIoutput_dcl
   {-# INLINE rule187 #-}
   rule187 = \ ((_hdIsemFunBndDefs) :: Seq PP_Doc) ((_tlIsemFunBndDefs) :: Seq PP_Doc) ->
     _hdIsemFunBndDefs Seq.>< _tlIsemFunBndDefs
   {-# INLINE rule188 #-}
   rule188 = \ ((_hdIsemFunBndTps) :: Seq PP_Doc) ((_tlIsemFunBndTps) :: Seq PP_Doc) ->
     _hdIsemFunBndTps Seq.>< _tlIsemFunBndTps
   {-# INLINE rule189 #-}
   rule189 = \ ((_hdIvisitKinds) :: Map VisitIdentifier VisitKind) ((_tlIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _hdIvisitKinds `mappend` _tlIvisitKinds
   {-# INLINE rule190 #-}
   rule190 = \ ((_hdIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ((_tlIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _hdIvisitdefs `uwSetUnion` _tlIvisitdefs
   {-# INLINE rule191 #-}
   rule191 = \ ((_hdIvisituses) :: Map VisitIdentifier (Set Identifier)) ((_tlIvisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _hdIvisituses `uwSetUnion` _tlIvisituses
   {-# INLINE rule192 #-}
   rule192 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule193 #-}
   rule193 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule194 #-}
   rule194 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule195 #-}
   rule195 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule196 #-}
   rule196 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule197 #-}
   rule197 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule198 #-}
   rule198 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule199 #-}
   rule199 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule200 #-}
   rule200 = \ ((_lhsIderivings) :: Derivings) ->
     _lhsIderivings
   {-# INLINE rule201 #-}
   rule201 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule202 #-}
   rule202 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule203 #-}
   rule203 = \ ((_lhsIinhmap) :: Map NontermIdent Attributes) ->
     _lhsIinhmap
   {-# INLINE rule204 #-}
   rule204 = \ ((_lhsIlocalAttrTypes) :: Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule205 #-}
   rule205 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule206 #-}
   rule206 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule207 #-}
   rule207 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule208 #-}
   rule208 = \ ((_lhsIsynmap) :: Map NontermIdent Attributes) ->
     _lhsIsynmap
   {-# INLINE rule209 #-}
   rule209 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule210 #-}
   rule210 = \ ((_lhsItypeSyns) :: TypeSyns) ->
     _lhsItypeSyns
   {-# INLINE rule211 #-}
   rule211 = \ ((_lhsIwrappers) :: Set NontermIdent) ->
     _lhsIwrappers
   {-# INLINE rule212 #-}
   rule212 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule213 #-}
   rule213 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule214 #-}
   rule214 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule215 #-}
   rule215 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule216 #-}
   rule216 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule217 #-}
   rule217 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule218 #-}
   rule218 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule219 #-}
   rule219 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule220 #-}
   rule220 = \ ((_lhsIderivings) :: Derivings) ->
     _lhsIderivings
   {-# INLINE rule221 #-}
   rule221 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule222 #-}
   rule222 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule223 #-}
   rule223 = \ ((_lhsIinhmap) :: Map NontermIdent Attributes) ->
     _lhsIinhmap
   {-# INLINE rule224 #-}
   rule224 = \ ((_lhsIlocalAttrTypes) :: Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule225 #-}
   rule225 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule226 #-}
   rule226 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule227 #-}
   rule227 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule228 #-}
   rule228 = \ ((_lhsIsynmap) :: Map NontermIdent Attributes) ->
     _lhsIsynmap
   {-# INLINE rule229 #-}
   rule229 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule230 #-}
   rule230 = \ ((_lhsItypeSyns) :: TypeSyns) ->
     _lhsItypeSyns
   {-# INLINE rule231 #-}
   rule231 = \ ((_lhsIwrappers) :: Set NontermIdent) ->
     _lhsIwrappers
{-# NOINLINE sem_ENonterminals_Nil #-}
sem_ENonterminals_Nil ::  T_ENonterminals 
sem_ENonterminals_Nil  = T_ENonterminals (return st11) where
   {-# NOINLINE st11 #-}
   st11 = let
      v10 :: T_ENonterminals_v10 
      v10 = \ (T_ENonterminals_vIn10 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIderivings _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlocks _lhsItypeSyns _lhsIwrappers) -> ( let
         _lhsOappendCommon :: [PP_Doc]
         _lhsOappendCommon = rule232  ()
         _lhsOappendMain :: [PP_Doc]
         _lhsOappendMain = rule233  ()
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule234  ()
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule235  ()
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule236  ()
         _lhsOgenProdIO :: IO ()
         _lhsOgenProdIO = rule237  ()
         _lhsOimports :: [PP_Doc]
         _lhsOimports = rule238  ()
         _lhsOinitStates :: Map NontermIdent Int
         _lhsOinitStates = rule239  ()
         _lhsOoutput :: PP_Doc
         _lhsOoutput = rule240  ()
         _lhsOoutput_dcl :: PP_Doc
         _lhsOoutput_dcl = rule241  ()
         _lhsOsemFunBndDefs :: Seq PP_Doc
         _lhsOsemFunBndDefs = rule242  ()
         _lhsOsemFunBndTps :: Seq PP_Doc
         _lhsOsemFunBndTps = rule243  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule244  ()
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule245  ()
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule246  ()
         __result_ = T_ENonterminals_vOut10 _lhsOappendCommon _lhsOappendMain _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOinitStates _lhsOoutput _lhsOoutput_dcl _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_ENonterminals_s11 v10
   {-# INLINE rule232 #-}
   rule232 = \  (_ :: ()) ->
     []
   {-# INLINE rule233 #-}
   rule233 = \  (_ :: ()) ->
     []
   {-# INLINE rule234 #-}
   rule234 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule235 #-}
   rule235 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule236 #-}
   rule236 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule237 #-}
   rule237 = \  (_ :: ()) ->
     return ()
   {-# INLINE rule238 #-}
   rule238 = \  (_ :: ()) ->
     []
   {-# INLINE rule239 #-}
   rule239 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule240 #-}
   rule240 = \  (_ :: ()) ->
     empty
   {-# INLINE rule241 #-}
   rule241 = \  (_ :: ()) ->
     empty
   {-# INLINE rule242 #-}
   rule242 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule243 #-}
   rule243 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule244 #-}
   rule244 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule245 #-}
   rule245 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule246 #-}
   rule246 = \  (_ :: ()) ->
     Map.empty

-- EProduction -------------------------------------------------
-- wrapper
data Inh_EProduction  = Inh_EProduction { allFromToStates_Inh_EProduction :: (Map VisitIdentifier (Int,Int)), allInhmap_Inh_EProduction :: (Map NontermIdent Attributes), allInitStates_Inh_EProduction :: (Map NontermIdent Int), allSynmap_Inh_EProduction :: (Map NontermIdent Attributes), allVisitKinds_Inh_EProduction :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_EProduction :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), allstates_Inh_EProduction :: (Set StateIdentifier), avisitdefs_Inh_EProduction :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_EProduction :: (Map VisitIdentifier (Set Identifier)), classCtxs_Inh_EProduction :: (ClassContext), constructorTypeMap_Inh_EProduction :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_EProduction :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_EProduction :: (String -> String -> String -> Bool -> String), importBlocks_Inh_EProduction :: (PP_Doc), inhmap_Inh_EProduction :: (Attributes), initial_Inh_EProduction :: (StateIdentifier), localAttrTypes_Inh_EProduction :: (Map ConstructorIdent (Map Identifier Type)), mainFile_Inh_EProduction :: (String), mainName_Inh_EProduction :: (String), nextVisits_Inh_EProduction :: (Map StateIdentifier StateCtx), nt_Inh_EProduction :: (NontermIdent), ntType_Inh_EProduction :: (Type), options_Inh_EProduction :: (Options), params_Inh_EProduction :: ([Identifier]), prevVisits_Inh_EProduction :: (Map StateIdentifier StateCtx), rename_Inh_EProduction :: (Bool), synmap_Inh_EProduction :: (Attributes), textBlocks_Inh_EProduction :: (PP_Doc) }
data Syn_EProduction  = Syn_EProduction { allvisits_Syn_EProduction :: ([VisitStateState]), childvisit_Syn_EProduction :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), count_Syn_EProduction :: (Int), datatype_Syn_EProduction :: (PP_Doc), errors_Syn_EProduction :: (Seq Error), fromToStates_Syn_EProduction :: (Map VisitIdentifier (Int,Int)), genProdIO_Syn_EProduction :: (IO ()), imports_Syn_EProduction :: ([PP_Doc]), recordtype_Syn_EProduction :: (PP_Doc), semFunBndDefs_Syn_EProduction :: (Seq PP_Doc), semFunBndTps_Syn_EProduction :: (Seq PP_Doc), sem_nt_Syn_EProduction :: (PP_Doc), sem_prod_Syn_EProduction :: (PP_Doc), sem_prod_tys_Syn_EProduction :: (PP_Doc), t_visits_Syn_EProduction :: (PP_Doc), visitKinds_Syn_EProduction :: (Map VisitIdentifier VisitKind), visitdefs_Syn_EProduction :: (Map VisitIdentifier (Set Identifier)), visituses_Syn_EProduction :: (Map VisitIdentifier (Set Identifier)) }
{-# INLINABLE wrap_EProduction #-}
wrap_EProduction :: T_EProduction  -> Inh_EProduction  -> (Syn_EProduction )
wrap_EProduction (T_EProduction act) (Inh_EProduction _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg13 = T_EProduction_vIn13 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks
        (T_EProduction_vOut13 _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses) <- return (inv_EProduction_s14 sem arg13)
        return (Syn_EProduction _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses)
   )

-- cata
{-# INLINE sem_EProduction #-}
sem_EProduction :: EProduction  -> T_EProduction 
sem_EProduction ( EProduction con_ params_ constraints_ rules_ children_ visits_ ) = sem_EProduction_EProduction con_ params_ constraints_ ( sem_ERules rules_ ) ( sem_EChildren children_ ) ( sem_Visits visits_ )

-- semantic domain
newtype T_EProduction  = T_EProduction {
                                       attach_T_EProduction :: Identity (T_EProduction_s14 )
                                       }
newtype T_EProduction_s14  = C_EProduction_s14 {
                                               inv_EProduction_s14 :: (T_EProduction_v13 )
                                               }
data T_EProduction_s15  = C_EProduction_s15
type T_EProduction_v13  = (T_EProduction_vIn13 ) -> (T_EProduction_vOut13 )
data T_EProduction_vIn13  = T_EProduction_vIn13 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Attributes) (Map NontermIdent Int) (Map NontermIdent Attributes) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Set StateIdentifier) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (ClassContext) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (Attributes) (StateIdentifier) (Map ConstructorIdent (Map Identifier Type)) (String) (String) (Map StateIdentifier StateCtx) (NontermIdent) (Type) (Options) ([Identifier]) (Map StateIdentifier StateCtx) (Bool) (Attributes) (PP_Doc)
data T_EProduction_vOut13  = T_EProduction_vOut13 ([VisitStateState]) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Int) (PP_Doc) (Seq Error) (Map VisitIdentifier (Int,Int)) (IO ()) ([PP_Doc]) (PP_Doc) (Seq PP_Doc) (Seq PP_Doc) (PP_Doc) (PP_Doc) (PP_Doc) (PP_Doc) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier))
{-# NOINLINE sem_EProduction_EProduction #-}
sem_EProduction_EProduction :: (ConstructorIdent) -> ([Identifier]) -> ([Type]) -> T_ERules  -> T_EChildren  -> T_Visits  -> T_EProduction 
sem_EProduction_EProduction arg_con_ arg_params_ arg_constraints_ arg_rules_ arg_children_ arg_visits_ = T_EProduction (return st14) where
   {-# NOINLINE st14 #-}
   st14 = let
      v13 :: T_EProduction_v13 
      v13 = \ (T_EProduction_vIn13 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks) -> ( let
         _rulesX23 = Control.Monad.Identity.runIdentity (attach_T_ERules (arg_rules_))
         _childrenX5 = Control.Monad.Identity.runIdentity (attach_T_EChildren (arg_children_))
         _visitsX56 = Control.Monad.Identity.runIdentity (attach_T_Visits (arg_visits_))
         (T_ERules_vOut22 _rulesIerrors _rulesImrules _rulesIruledefs _rulesIruleuses _rulesIsem_rules _rulesIusedArgs) = inv_ERules_s23 _rulesX23 (T_ERules_vIn22 _rulesOallInhmap _rulesOallSynmap _rulesOchildTypes _rulesOcon _rulesOconstructorTypeMap _rulesOdclModuleHeader _rulesOiclModuleHeader _rulesOimportBlocks _rulesOinhmap _rulesOlazyIntras _rulesOlocalAttrTypes _rulesOmainFile _rulesOmainName _rulesOnt _rulesOoptions _rulesOruleKinds _rulesOsynmap _rulesOtextBlocks _rulesOusageInfo)
         (T_EChildren_vOut4 _childrenIargnamesw _childrenIargpats _childrenIargtps _childrenIchildTypes _childrenIchildintros _childrenIdatatype _childrenIrecfields _childrenIrecordtype _childrenIterminaldefs _childrenIusedArgs) = inv_EChildren_s5 _childrenX5 (T_EChildren_vIn4 _childrenOallInitStates _childrenOcon _childrenOconstructorTypeMap _childrenOdclModuleHeader _childrenOiclModuleHeader _childrenOimportBlocks _childrenOmainFile _childrenOmainName _childrenOnt _childrenOoptions _childrenOtextBlocks)
         (T_Visits_vOut55 _visitsIallvisits _visitsIchildvisit _visitsIerrors _visitsIfromToStates _visitsIintramap _visitsIlazyIntras _visitsIruleKinds _visitsIruleUsage _visitsIsem_visit _visitsIt_visits _visitsIusedArgs _visitsIvisitKinds _visitsIvisitdefs _visitsIvisituses) = inv_Visits_s56 _visitsX56 (T_Visits_vIn55 _visitsOallFromToStates _visitsOallInhmap _visitsOallInitStates _visitsOallSynmap _visitsOallVisitKinds _visitsOallchildvisit _visitsOallintramap _visitsOavisitdefs _visitsOavisituses _visitsOchildTypes _visitsOchildintros _visitsOcon _visitsOinhmap _visitsOmrules _visitsOnextVisits _visitsOnt _visitsOoptions _visitsOparams _visitsOprevVisits _visitsOruledefs _visitsOruleuses _visitsOsynmap _visitsOterminaldefs)
         _childrenOcon = rule247 arg_con_
         _rulesOcon = rule248 arg_con_
         _visitsOcon = rule249 arg_con_
         _lhsOdatatype :: PP_Doc
         _lhsOdatatype = rule250 _childrenIdatatype _classPP1 _lhsInt _lhsIoptions _lhsIrename _quantPP1 arg_con_
         _lhsOrecordtype :: PP_Doc
         _lhsOrecordtype = rule251 _childrenIrecordtype _classPP1 _quantPP1
         _classPP1 = rule252 arg_constraints_
         _quantPP1 = rule253 arg_params_
         _lhsOcount :: Int
         _lhsOcount = rule254  ()
         _lhsOsem_nt :: PP_Doc
         _lhsOsem_nt = rule255 _childrenIargnamesw _childrenIargpats _childrenIrecfields _lhsIconstructorTypeMap _lhsInt _lhsIrename arg_con_
         _lhsOsemFunBndDefs :: Seq PP_Doc
         _lhsOsemFunBndDefs = rule256 _semFunBndDef
         _lhsOsemFunBndTps :: Seq PP_Doc
         _lhsOsemFunBndTps = rule257 _semFunBndTp
         _semFunBndDef = rule258 _semFunBndNm _semname
         _semFunBndTp = rule259 _semFunBndNm _sem_tp
         _semFunBndNm = rule260 _lhsInt arg_con_
         _t_type = rule261 _lhsInt
         _t_params = rule262 _lhsIparams
         _usedArgs = rule263 _childrenIusedArgs _rulesIusedArgs _visitsIusedArgs
         _args = rule264 _childrenIargpats _usedArgs
         _semname = rule265 _lhsInt arg_con_
         _sem_tp = rule266 _childrenIargtps _classPP2 _quantPP2 _t_params _t_type
         _classPP2 = rule267 _lhsIclassCtxs arg_constraints_
         _quantPP2 = rule268 _lhsIparams arg_params_
         _lhsOsem_prod_tys :: PP_Doc
         _lhsOsem_prod_tys = rule269 _sem_tp _semname
         _sem_prod = rule270 _args _lhsIinitial _mbInitializer _mkSemBody _outerlet _sem_tp _semname _t_type
         _mkSemBody = rule271  ()
         _mbInitializer = rule272 _lhsIoptions
         _outerlet = rule273 _rulesIsem_rules _statefns
         _statefns = rule274 _genstfn _lhsIallstates
         _genstfn = rule275 _addbang _lhsIinitial _lhsInextVisits _lhsInt _lhsIprevVisits _stargs _stks _stvs
         _stargs = rule276 _addbang _childTypes _lazyIntras _lhsIallInhmap _lhsIallSynmap _lhsIoptions _localAttrTypes _visitsIintramap
         _stks = rule277 _lhsInt _stvisits _t_params
         _stvisits = rule278 _visitsIallvisits
         _stvs = rule279 _visitsIsem_visit
         _visitsOmrules = rule280 _rulesImrules
         _visitsOchildintros = rule281 _childrenIchildintros
         _rulesOusageInfo = rule282 _visitsIruleUsage
         _rulesOruleKinds = rule283 _visitsIruleKinds
         _visitsOallintramap = rule284 _visitsIintramap
         _visitsOterminaldefs = rule285 _childrenIterminaldefs
         _visitsOruledefs = rule286 _rulesIruledefs
         _visitsOruleuses = rule287 _rulesIruleuses
         _lazyIntras = rule288 _visitsIlazyIntras
         _lhsOimports :: [PP_Doc]
         _lhsOimports = rule289 _moduleName
         _moduleName = rule290 _lhsImainName _suffix
         _suffix = rule291 _lhsInt arg_con_
         _outputfile = rule292 _lhsImainFile _suffix
         _ppMonadImports = rule293  ()
         _lhsOgenProdIO :: IO ()
         _lhsOgenProdIO = rule294 _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainName _outputfile _ppMonadImports _sem_prod _semname _suffix
         _addbang = rule295 _lhsIoptions
         _childTypes = rule296 _childrenIchildTypes _lhsIntType
         _localAttrTypes = rule297 _lhsIlocalAttrTypes arg_con_
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule298 _visitsIchildvisit
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule299 _rulesIerrors _visitsIerrors
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule300 _visitsIfromToStates
         _lhsOt_visits :: PP_Doc
         _lhsOt_visits = rule301 _visitsIt_visits
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule302 _visitsIvisitKinds
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule303 _visitsIvisitdefs
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule304 _visitsIvisituses
         _lhsOallvisits :: [VisitStateState]
         _lhsOallvisits = rule305 _visitsIallvisits
         _lhsOsem_prod :: PP_Doc
         _lhsOsem_prod = rule306 _sem_prod
         _rulesOallInhmap = rule307 _lhsIallInhmap
         _rulesOallSynmap = rule308 _lhsIallSynmap
         _rulesOchildTypes = rule309 _childTypes
         _rulesOconstructorTypeMap = rule310 _lhsIconstructorTypeMap
         _rulesOdclModuleHeader = rule311 _lhsIdclModuleHeader
         _rulesOiclModuleHeader = rule312 _lhsIiclModuleHeader
         _rulesOimportBlocks = rule313 _lhsIimportBlocks
         _rulesOinhmap = rule314 _lhsIinhmap
         _rulesOlazyIntras = rule315 _lazyIntras
         _rulesOlocalAttrTypes = rule316 _localAttrTypes
         _rulesOmainFile = rule317 _lhsImainFile
         _rulesOmainName = rule318 _lhsImainName
         _rulesOnt = rule319 _lhsInt
         _rulesOoptions = rule320 _lhsIoptions
         _rulesOsynmap = rule321 _lhsIsynmap
         _rulesOtextBlocks = rule322 _lhsItextBlocks
         _childrenOallInitStates = rule323 _lhsIallInitStates
         _childrenOconstructorTypeMap = rule324 _lhsIconstructorTypeMap
         _childrenOdclModuleHeader = rule325 _lhsIdclModuleHeader
         _childrenOiclModuleHeader = rule326 _lhsIiclModuleHeader
         _childrenOimportBlocks = rule327 _lhsIimportBlocks
         _childrenOmainFile = rule328 _lhsImainFile
         _childrenOmainName = rule329 _lhsImainName
         _childrenOnt = rule330 _lhsInt
         _childrenOoptions = rule331 _lhsIoptions
         _childrenOtextBlocks = rule332 _lhsItextBlocks
         _visitsOallFromToStates = rule333 _lhsIallFromToStates
         _visitsOallInhmap = rule334 _lhsIallInhmap
         _visitsOallInitStates = rule335 _lhsIallInitStates
         _visitsOallSynmap = rule336 _lhsIallSynmap
         _visitsOallVisitKinds = rule337 _lhsIallVisitKinds
         _visitsOallchildvisit = rule338 _lhsIallchildvisit
         _visitsOavisitdefs = rule339 _lhsIavisitdefs
         _visitsOavisituses = rule340 _lhsIavisituses
         _visitsOchildTypes = rule341 _childTypes
         _visitsOinhmap = rule342 _lhsIinhmap
         _visitsOnextVisits = rule343 _lhsInextVisits
         _visitsOnt = rule344 _lhsInt
         _visitsOoptions = rule345 _lhsIoptions
         _visitsOparams = rule346 _lhsIparams
         _visitsOprevVisits = rule347 _lhsIprevVisits
         _visitsOsynmap = rule348 _lhsIsynmap
         __result_ = T_EProduction_vOut13 _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_EProduction_s14 v13
   {-# INLINE rule247 #-}
   {-# LINE 72 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule247 = \ con_ ->
                                 {-# LINE 72 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 con_
                                 {-# LINE 2369 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule248 #-}
   {-# LINE 73 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule248 = \ con_ ->
                                 {-# LINE 73 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 con_
                                 {-# LINE 2375 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule249 #-}
   {-# LINE 74 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule249 = \ con_ ->
                                 {-# LINE 74 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 con_
                                 {-# LINE 2381 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule250 #-}
   {-# LINE 215 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule250 = \ ((_childrenIdatatype) :: [PP_Doc]) _classPP1 ((_lhsInt) :: NontermIdent) ((_lhsIoptions) :: Options) ((_lhsIrename) :: Bool) _quantPP1 con_ ->
                                 {-# LINE 215 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _quantPP1     >#< _classPP1
                                 >#< conname _lhsIrename _lhsInt con_
                                 >#< ppConFields (dataRecords _lhsIoptions) _childrenIdatatype
                                 {-# LINE 2389 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule251 #-}
   {-# LINE 218 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule251 = \ ((_childrenIrecordtype) :: [PP_Doc]) _classPP1 _quantPP1 ->
                                   {-# LINE 218 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   _quantPP1     >#< _classPP1
                                   >#< ppConFields True _childrenIrecordtype
                                   {-# LINE 2396 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule252 #-}
   {-# LINE 220 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule252 = \ constraints_ ->
                                 {-# LINE 220 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 ppClasses (classConstrsToDocs constraints_)
                                 {-# LINE 2402 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule253 #-}
   {-# LINE 221 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule253 = \ params_ ->
                                 {-# LINE 221 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 ppQuants params_
                                 {-# LINE 2408 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule254 #-}
   {-# LINE 320 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule254 = \  (_ :: ()) ->
                                              {-# LINE 320 "src-ag/ExecutionPlan2Clean.ag" #-}
                                              1
                                              {-# LINE 2414 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule255 #-}
   {-# LINE 325 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule255 = \ ((_childrenIargnamesw) :: [PP_Doc]) ((_childrenIargpats) ::  [PP_Doc] ) ((_childrenIrecfields) ::  [Identifier] ) ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ((_lhsInt) :: NontermIdent) ((_lhsIrename) :: Bool) con_ ->
                               {-# LINE 325 "src-ag/ExecutionPlan2Clean.ag" #-}
                               let lhs   = "sem_" >|< _lhsInt
                                   rhs   = "=" >#< "sem_" >|< _lhsInt >|< "_" >|< con_ >#< ppSpaced _childrenIargnamesw
                                   cnnm  = conname _lhsIrename _lhsInt con_
                               in  if isRecordConstructor _lhsInt _lhsIconstructorTypeMap
                                     then  lhs >#< "{" >#< cnnm >#< "|" >#<
                                           pp_block "" "" "," (zipWith (\l r -> l >#< "=" >#< r) _childrenIrecfields _childrenIargpats) >#< "}" >#< rhs
                                     else  lhs >#< "(" >#< cnnm >#< ppSpaced _childrenIargpats >#< ")" >#< rhs
                               {-# LINE 2426 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule256 #-}
   {-# LINE 591 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule256 = \ _semFunBndDef ->
                        {-# LINE 591 "src-ag/ExecutionPlan2Clean.ag" #-}
                        Seq.singleton _semFunBndDef
                        {-# LINE 2432 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule257 #-}
   {-# LINE 592 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule257 = \ _semFunBndTp ->
                        {-# LINE 592 "src-ag/ExecutionPlan2Clean.ag" #-}
                        Seq.singleton _semFunBndTp
                        {-# LINE 2438 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule258 #-}
   {-# LINE 593 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule258 = \ _semFunBndNm _semname ->
                        {-# LINE 593 "src-ag/ExecutionPlan2Clean.ag" #-}
                        _semFunBndNm     >#< "=" >#< _semname
                        {-# LINE 2444 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule259 #-}
   {-# LINE 594 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule259 = \ _semFunBndNm _sem_tp ->
                        {-# LINE 594 "src-ag/ExecutionPlan2Clean.ag" #-}
                        _semFunBndNm     >#< "::" >#< _sem_tp
                        {-# LINE 2450 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule260 #-}
   {-# LINE 595 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule260 = \ ((_lhsInt) :: NontermIdent) con_ ->
                        {-# LINE 595 "src-ag/ExecutionPlan2Clean.ag" #-}
                        lateSemConLabel _lhsInt con_
                        {-# LINE 2456 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule261 #-}
   {-# LINE 659 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule261 = \ ((_lhsInt) :: NontermIdent) ->
                                 {-# LINE 659 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 "T_" >|< _lhsInt
                                 {-# LINE 2462 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule262 #-}
   {-# LINE 660 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule262 = \ ((_lhsIparams) :: [Identifier]) ->
                                 {-# LINE 660 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 ppSpaced _lhsIparams
                                 {-# LINE 2468 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule263 #-}
   {-# LINE 661 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule263 = \ ((_childrenIusedArgs) :: Set String) ((_rulesIusedArgs) :: Set String) ((_visitsIusedArgs) :: Set String) ->
                                 {-# LINE 661 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _childrenIusedArgs `Set.union` _visitsIusedArgs `Set.union` _rulesIusedArgs
                                 {-# LINE 2474 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule264 #-}
   {-# LINE 664 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule264 = \ ((_childrenIargpats) ::  [PP_Doc] ) _usedArgs ->
                                 {-# LINE 664 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 map (\x -> let (name,arg) = case show x of
                                                         ""       -> ("", empty)
                                                         '!':name -> ("arg_" ++ name, "!arg_" >|< name)
                                                         name     -> ("arg_" ++ name, "arg_"  >|< name)
                                            in  if null name || name `Set.member` _usedArgs
                                                              then arg
                                                              else text "_") _childrenIargpats
                                 {-# LINE 2486 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule265 #-}
   {-# LINE 671 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule265 = \ ((_lhsInt) :: NontermIdent) con_ ->
                                 {-# LINE 671 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 "sem_" ++ show _lhsInt ++ "_" ++ show con_
                                 {-# LINE 2492 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule266 #-}
   {-# LINE 672 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule266 = \ ((_childrenIargtps) ::  [PP_Doc] ) _classPP2 _quantPP2 _t_params _t_type ->
                                 {-# LINE 672 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _quantPP2     >#< _classPP2     >#< ppSpaced _childrenIargtps
                                 >#< (if length _childrenIargtps > 0 then "->" else "")
                                 >#< _t_type     >#< _t_params
                                 {-# LINE 2500 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule267 #-}
   {-# LINE 675 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule267 = \ ((_lhsIclassCtxs) :: ClassContext) constraints_ ->
                                 {-# LINE 675 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 ppClasses (classCtxsToDocs _lhsIclassCtxs ++ classConstrsToDocs constraints_)
                                 {-# LINE 2506 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule268 #-}
   {-# LINE 676 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule268 = \ ((_lhsIparams) :: [Identifier]) params_ ->
                                 {-# LINE 676 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 ppQuants (_lhsIparams ++ params_)
                                 {-# LINE 2512 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule269 #-}
   {-# LINE 678 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule269 = \ _sem_tp _semname ->
                                     {-# LINE 678 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     _semname     >#< " ::" >#< _sem_tp
                                     {-# LINE 2518 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule270 #-}
   {-# LINE 680 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule270 = \ _args ((_lhsIinitial) :: StateIdentifier) _mbInitializer _mkSemBody _outerlet _sem_tp _semname _t_type ->
                                 {-# LINE 680 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _semname     >#< " ::" >#< _sem_tp
                                 >-< _mkSemBody     (_semname     >#< ppSpaced _args     >#< "=" >#< _t_type    )
                                                    _mbInitializer     _outerlet     ("lift" >#< "st" >|< _lhsIinitial)
                                 {-# LINE 2526 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule271 #-}
   {-# LINE 683 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule271 = \  (_ :: ()) ->
                                  {-# LINE 683 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  \prefix mbInit outerlet ret ->
                                    case mbInit of
                                      Nothing -> prefix >#< pp_parens ret >#< "where"
                                                 >-< indent 3 outerlet
                                      Just m  -> prefix >#< "(" >#< "do"
                                                 >-< indent 1 (
                                                       m
                                                       >-< "let"
                                                       >-< indent 2 outerlet
                                                       >-< ret )
                                                 >-< indent 1 ")"
                                  {-# LINE 2542 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule272 #-}
   {-# LINE 695 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule272 = \ ((_lhsIoptions) :: Options) ->
                                        {-# LINE 695 "src-ag/ExecutionPlan2Clean.ag" #-}
                                        if parallelInvoke _lhsIoptions
                                        then (Nothing :: Maybe PP_Doc)
                                        else Nothing
                                        {-# LINE 2550 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule273 #-}
   {-# LINE 701 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule273 = \ ((_rulesIsem_rules) :: PP_Doc) _statefns ->
                                 {-# LINE 701 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 vlist _statefns     >-< _rulesIsem_rules
                                 {-# LINE 2556 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule274 #-}
   {-# LINE 702 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule274 = \ _genstfn ((_lhsIallstates) :: Set StateIdentifier) ->
                                 {-# LINE 702 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 map _genstfn     $ Set.toList _lhsIallstates
                                 {-# LINE 2562 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule275 #-}
   {-# LINE 703 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule275 = \ _addbang ((_lhsIinitial) :: StateIdentifier) ((_lhsInextVisits) :: Map StateIdentifier StateCtx) ((_lhsInt) :: NontermIdent) ((_lhsIprevVisits) :: Map StateIdentifier StateCtx) _stargs _stks _stvs ->
                                 {-# LINE 703 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 \st -> let nextVisitInfo = Map.findWithDefault ManyVis st _lhsInextVisits
                                            prevVisitInfo = Map.findWithDefault ManyVis st _lhsIprevVisits
                                            stNm = "st" >|< st
                                            lhs  = bang stNm >#< "=" >#<
                                                   (
                                                     if st == _lhsIinitial
                                                     then empty
                                                     else "\\" >#< _stargs     st >#< "->"
                                                   )
                                            cCon = "C_" >|< _lhsInt >|< "_s" >|< st
                                            bang | st == _lhsIinitial = _addbang
                                                 | otherwise          = id
                                        in case nextVisitInfo of
                                             NoneVis    ->
                                                           if st == _lhsIinitial
                                                           then lhs >#< cCon
                                                           else empty
                                             OneVis vId -> mklet lhs (_stvs     st False) (cCon >#< "v" >|< vId)
                                             ManyVis    -> mklet lhs (_stks     st >-< _stvs     st True) (cCon >#< "k" >|< st)
                                 {-# LINE 2586 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule276 #-}
   {-# LINE 731 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule276 = \ _addbang _childTypes _lazyIntras ((_lhsIallInhmap) :: Map NontermIdent Attributes) ((_lhsIallSynmap) :: Map NontermIdent Attributes) ((_lhsIoptions) :: Options) _localAttrTypes ((_visitsIintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) ->
                                 {-# LINE 731 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 \st -> let attrs = maybe Map.empty id $ Map.lookup st _visitsIintramap
                                        in ppSpaced [ let match | str `Set.member` _lazyIntras     = pp str
                                                                | otherwise                        = _addbang     (pp str)
                                                      in case mbAttr of
                                                           Just (AttrSyn child nm) | child == _LOC && not (noPerStateTypeSigs _lhsIoptions) ->
                                                             case Map.lookup nm _localAttrTypes     of
                                                               Just tp -> pp_parens (pp_parens match >#< "::" >#< ppTp tp)
                                                               Nothing -> match
                                                           Just attr | not (noPerStateTypeSigs _lhsIoptions) ->
                                                             case lookupAttrType attr _lhsIallInhmap _lhsIallSynmap _childTypes     of
                                                               Just tpDoc -> pp_parens (pp_parens match >#< "::" >#< tpDoc)
                                                               Nothing    -> match
                                                           _ -> match
                                                   | (str,mbAttr) <- Map.assocs attrs
                                                   ] >#< dummyPat _lhsIoptions (Map.null attrs)
                                 {-# LINE 2606 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule277 #-}
   {-# LINE 747 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule277 = \ ((_lhsInt) :: NontermIdent) _stvisits _t_params ->
                                 {-# LINE 747 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 \st -> if null (_stvisits     st)
                                        then empty
                                        else "k" >|< st >#< "::" >#< "K_" >|< _lhsInt >|< "_s" >|< st >#< _t_params     >#< "t" >#< "->" >#< "t"
                                             >-< vlist (map (\(v,f,t) -> "k" >|< st >#< "K_" >|< _lhsInt >|< "_v" >|< v >#< "="
                                                                    >#< "v" >|< v) $ _stvisits     st)
                                 {-# LINE 2616 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule278 #-}
   {-# LINE 752 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule278 = \ ((_visitsIallvisits) :: [VisitStateState]) ->
                                 {-# LINE 752 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 \st -> filter (\(v,f,t) -> f == st) _visitsIallvisits
                                 {-# LINE 2622 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule279 #-}
   {-# LINE 753 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule279 = \ ((_visitsIsem_visit) ::  [(StateIdentifier,Bool -> PP_Doc)] ) ->
                                 {-# LINE 753 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 \st inlinePragma -> vlist [ppf inlinePragma | (f,ppf) <- _visitsIsem_visit, f == st]
                                 {-# LINE 2628 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule280 #-}
   {-# LINE 754 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule280 = \ ((_rulesImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
                                  {-# LINE 754 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  _rulesImrules
                                  {-# LINE 2634 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule281 #-}
   {-# LINE 942 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule281 = \ ((_childrenIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
                                       {-# LINE 942 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       _childrenIchildintros
                                       {-# LINE 2640 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule282 #-}
   {-# LINE 1277 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule282 = \ ((_visitsIruleUsage) :: Map Identifier Int) ->
                                                   {-# LINE 1277 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                   _visitsIruleUsage
                                                   {-# LINE 2646 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule283 #-}
   {-# LINE 1292 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule283 = \ ((_visitsIruleKinds) :: Map Identifier (Set VisitKind)) ->
                      {-# LINE 1292 "src-ag/ExecutionPlan2Clean.ag" #-}
                      _visitsIruleKinds
                      {-# LINE 2652 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule284 #-}
   {-# LINE 1321 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule284 = \ ((_visitsIintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) ->
                          {-# LINE 1321 "src-ag/ExecutionPlan2Clean.ag" #-}
                          _visitsIintramap
                          {-# LINE 2658 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule285 #-}
   {-# LINE 1322 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule285 = \ ((_childrenIterminaldefs) :: Set String) ->
                          {-# LINE 1322 "src-ag/ExecutionPlan2Clean.ag" #-}
                          _childrenIterminaldefs
                          {-# LINE 2664 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule286 #-}
   {-# LINE 1346 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule286 = \ ((_rulesIruledefs) :: Map Identifier (Set String)) ->
                                    {-# LINE 1346 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    _rulesIruledefs
                                    {-# LINE 2670 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule287 #-}
   {-# LINE 1347 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule287 = \ ((_rulesIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
                                    {-# LINE 1347 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    _rulesIruleuses
                                    {-# LINE 2676 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule288 #-}
   {-# LINE 1401 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule288 = \ ((_visitsIlazyIntras) :: Set String) ->
                     {-# LINE 1401 "src-ag/ExecutionPlan2Clean.ag" #-}
                     _visitsIlazyIntras
                     {-# LINE 2682 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule289 #-}
   {-# LINE 1486 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule289 = \ _moduleName ->
                                   {-# LINE 1486 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   [pp $ "import " ++ _moduleName    ]
                                   {-# LINE 2688 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule290 #-}
   {-# LINE 1487 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule290 = \ ((_lhsImainName) :: String) _suffix ->
                                   {-# LINE 1487 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   _lhsImainName ++ _suffix
                                   {-# LINE 2694 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule291 #-}
   {-# LINE 1488 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule291 = \ ((_lhsInt) :: NontermIdent) con_ ->
                                   {-# LINE 1488 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   '_' : show _lhsInt ++ ('_' : show con_)
                                   {-# LINE 2700 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule292 #-}
   {-# LINE 1489 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule292 = \ ((_lhsImainFile) :: String) _suffix ->
                                   {-# LINE 1489 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   replaceBaseName _lhsImainFile (takeBaseName _lhsImainFile ++ _suffix    )
                                   {-# LINE 2706 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule293 #-}
   {-# LINE 1490 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule293 = \  (_ :: ()) ->
                                        {-# LINE 1490 "src-ag/ExecutionPlan2Clean.ag" #-}
                                        pp "import qualified Control.Monad.Identity"
                                        {-# LINE 2712 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule294 #-}
   {-# LINE 1491 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule294 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ((_lhsIimportBlocks) :: PP_Doc) ((_lhsImainName) :: String) _outputfile _ppMonadImports _sem_prod _semname _suffix ->
                                   {-# LINE 1491 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   writeModule _outputfile
                                       [ pp $ _lhsIiclModuleHeader _lhsImainName _suffix     _semname     True
                                       , _lhsIimportBlocks
                                       , _ppMonadImports
                                       , pp $ "import " ++ _lhsImainName ++ "_common"
                                       , _sem_prod
                                       ]
                                   {-# LINE 2724 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule295 #-}
   {-# LINE 1567 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule295 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1567 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 2730 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule296 #-}
   {-# LINE 1617 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule296 = \ ((_childrenIchildTypes) :: Map Identifier Type) ((_lhsIntType) :: Type) ->
                     {-# LINE 1617 "src-ag/ExecutionPlan2Clean.ag" #-}
                     Map.singleton _LHS _lhsIntType `Map.union` _childrenIchildTypes
                     {-# LINE 2736 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule297 #-}
   {-# LINE 1634 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule297 = \ ((_lhsIlocalAttrTypes) :: Map ConstructorIdent (Map Identifier Type)) con_ ->
                           {-# LINE 1634 "src-ag/ExecutionPlan2Clean.ag" #-}
                           Map.findWithDefault Map.empty con_ _lhsIlocalAttrTypes
                           {-# LINE 2742 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule298 #-}
   rule298 = \ ((_visitsIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _visitsIchildvisit
   {-# INLINE rule299 #-}
   rule299 = \ ((_rulesIerrors) :: Seq Error) ((_visitsIerrors) :: Seq Error) ->
     _rulesIerrors Seq.>< _visitsIerrors
   {-# INLINE rule300 #-}
   rule300 = \ ((_visitsIfromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _visitsIfromToStates
   {-# INLINE rule301 #-}
   rule301 = \ ((_visitsIt_visits) :: PP_Doc) ->
     _visitsIt_visits
   {-# INLINE rule302 #-}
   rule302 = \ ((_visitsIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _visitsIvisitKinds
   {-# INLINE rule303 #-}
   rule303 = \ ((_visitsIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _visitsIvisitdefs
   {-# INLINE rule304 #-}
   rule304 = \ ((_visitsIvisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _visitsIvisituses
   {-# INLINE rule305 #-}
   rule305 = \ ((_visitsIallvisits) :: [VisitStateState]) ->
     _visitsIallvisits
   {-# INLINE rule306 #-}
   rule306 = \ _sem_prod ->
     _sem_prod
   {-# INLINE rule307 #-}
   rule307 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule308 #-}
   rule308 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule309 #-}
   rule309 = \ _childTypes ->
     _childTypes
   {-# INLINE rule310 #-}
   rule310 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule311 #-}
   rule311 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule312 #-}
   rule312 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule313 #-}
   rule313 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule314 #-}
   rule314 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule315 #-}
   rule315 = \ _lazyIntras ->
     _lazyIntras
   {-# INLINE rule316 #-}
   rule316 = \ _localAttrTypes ->
     _localAttrTypes
   {-# INLINE rule317 #-}
   rule317 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule318 #-}
   rule318 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule319 #-}
   rule319 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule320 #-}
   rule320 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule321 #-}
   rule321 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule322 #-}
   rule322 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule323 #-}
   rule323 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule324 #-}
   rule324 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule325 #-}
   rule325 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule326 #-}
   rule326 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule327 #-}
   rule327 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule328 #-}
   rule328 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule329 #-}
   rule329 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule330 #-}
   rule330 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule331 #-}
   rule331 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule332 #-}
   rule332 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule333 #-}
   rule333 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule334 #-}
   rule334 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule335 #-}
   rule335 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule336 #-}
   rule336 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule337 #-}
   rule337 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule338 #-}
   rule338 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule339 #-}
   rule339 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule340 #-}
   rule340 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule341 #-}
   rule341 = \ _childTypes ->
     _childTypes
   {-# INLINE rule342 #-}
   rule342 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule343 #-}
   rule343 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) ->
     _lhsInextVisits
   {-# INLINE rule344 #-}
   rule344 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule345 #-}
   rule345 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule346 #-}
   rule346 = \ ((_lhsIparams) :: [Identifier]) ->
     _lhsIparams
   {-# INLINE rule347 #-}
   rule347 = \ ((_lhsIprevVisits) :: Map StateIdentifier StateCtx) ->
     _lhsIprevVisits
   {-# INLINE rule348 #-}
   rule348 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap

-- EProductions ------------------------------------------------
-- wrapper
data Inh_EProductions  = Inh_EProductions { allFromToStates_Inh_EProductions :: (Map VisitIdentifier (Int,Int)), allInhmap_Inh_EProductions :: (Map NontermIdent Attributes), allInitStates_Inh_EProductions :: (Map NontermIdent Int), allSynmap_Inh_EProductions :: (Map NontermIdent Attributes), allVisitKinds_Inh_EProductions :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_EProductions :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), allstates_Inh_EProductions :: (Set StateIdentifier), avisitdefs_Inh_EProductions :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_EProductions :: (Map VisitIdentifier (Set Identifier)), classCtxs_Inh_EProductions :: (ClassContext), constructorTypeMap_Inh_EProductions :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_EProductions :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_EProductions :: (String -> String -> String -> Bool -> String), importBlocks_Inh_EProductions :: (PP_Doc), inhmap_Inh_EProductions :: (Attributes), initial_Inh_EProductions :: (StateIdentifier), localAttrTypes_Inh_EProductions :: (Map ConstructorIdent (Map Identifier Type)), mainFile_Inh_EProductions :: (String), mainName_Inh_EProductions :: (String), nextVisits_Inh_EProductions :: (Map StateIdentifier StateCtx), nt_Inh_EProductions :: (NontermIdent), ntType_Inh_EProductions :: (Type), options_Inh_EProductions :: (Options), params_Inh_EProductions :: ([Identifier]), prevVisits_Inh_EProductions :: (Map StateIdentifier StateCtx), rename_Inh_EProductions :: (Bool), synmap_Inh_EProductions :: (Attributes), textBlocks_Inh_EProductions :: (PP_Doc) }
data Syn_EProductions  = Syn_EProductions { allvisits_Syn_EProductions :: ([VisitStateState]), childvisit_Syn_EProductions :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), count_Syn_EProductions :: (Int), datatype_Syn_EProductions :: ([PP_Doc]), errors_Syn_EProductions :: (Seq Error), fromToStates_Syn_EProductions :: (Map VisitIdentifier (Int,Int)), genProdIO_Syn_EProductions :: (IO ()), imports_Syn_EProductions :: ([PP_Doc]), recordtype_Syn_EProductions :: (PP_Doc), semFunBndDefs_Syn_EProductions :: (Seq PP_Doc), semFunBndTps_Syn_EProductions :: (Seq PP_Doc), sem_nt_Syn_EProductions :: (PP_Doc), sem_prod_Syn_EProductions :: (PP_Doc), sem_prod_tys_Syn_EProductions :: (PP_Doc), t_visits_Syn_EProductions :: (PP_Doc), visitKinds_Syn_EProductions :: (Map VisitIdentifier VisitKind), visitdefs_Syn_EProductions :: (Map VisitIdentifier (Set Identifier)), visituses_Syn_EProductions :: (Map VisitIdentifier (Set Identifier)) }
{-# INLINABLE wrap_EProductions #-}
wrap_EProductions :: T_EProductions  -> Inh_EProductions  -> (Syn_EProductions )
wrap_EProductions (T_EProductions act) (Inh_EProductions _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg16 = T_EProductions_vIn16 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks
        (T_EProductions_vOut16 _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses) <- return (inv_EProductions_s17 sem arg16)
        return (Syn_EProductions _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses)
   )

-- cata
{-# NOINLINE sem_EProductions #-}
sem_EProductions :: EProductions  -> T_EProductions 
sem_EProductions list = Prelude.foldr sem_EProductions_Cons sem_EProductions_Nil (Prelude.map sem_EProduction list)

-- semantic domain
newtype T_EProductions  = T_EProductions {
                                         attach_T_EProductions :: Identity (T_EProductions_s17 )
                                         }
newtype T_EProductions_s17  = C_EProductions_s17 {
                                                 inv_EProductions_s17 :: (T_EProductions_v16 )
                                                 }
data T_EProductions_s18  = C_EProductions_s18
type T_EProductions_v16  = (T_EProductions_vIn16 ) -> (T_EProductions_vOut16 )
data T_EProductions_vIn16  = T_EProductions_vIn16 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Attributes) (Map NontermIdent Int) (Map NontermIdent Attributes) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Set StateIdentifier) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (ClassContext) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (Attributes) (StateIdentifier) (Map ConstructorIdent (Map Identifier Type)) (String) (String) (Map StateIdentifier StateCtx) (NontermIdent) (Type) (Options) ([Identifier]) (Map StateIdentifier StateCtx) (Bool) (Attributes) (PP_Doc)
data T_EProductions_vOut16  = T_EProductions_vOut16 ([VisitStateState]) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Int) ([PP_Doc]) (Seq Error) (Map VisitIdentifier (Int,Int)) (IO ()) ([PP_Doc]) (PP_Doc) (Seq PP_Doc) (Seq PP_Doc) (PP_Doc) (PP_Doc) (PP_Doc) (PP_Doc) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier))
{-# NOINLINE sem_EProductions_Cons #-}
sem_EProductions_Cons :: T_EProduction  -> T_EProductions  -> T_EProductions 
sem_EProductions_Cons arg_hd_ arg_tl_ = T_EProductions (return st17) where
   {-# NOINLINE st17 #-}
   st17 = let
      v16 :: T_EProductions_v16 
      v16 = \ (T_EProductions_vIn16 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks) -> ( let
         _hdX14 = Control.Monad.Identity.runIdentity (attach_T_EProduction (arg_hd_))
         _tlX17 = Control.Monad.Identity.runIdentity (attach_T_EProductions (arg_tl_))
         (T_EProduction_vOut13 _hdIallvisits _hdIchildvisit _hdIcount _hdIdatatype _hdIerrors _hdIfromToStates _hdIgenProdIO _hdIimports _hdIrecordtype _hdIsemFunBndDefs _hdIsemFunBndTps _hdIsem_nt _hdIsem_prod _hdIsem_prod_tys _hdIt_visits _hdIvisitKinds _hdIvisitdefs _hdIvisituses) = inv_EProduction_s14 _hdX14 (T_EProduction_vIn13 _hdOallFromToStates _hdOallInhmap _hdOallInitStates _hdOallSynmap _hdOallVisitKinds _hdOallchildvisit _hdOallstates _hdOavisitdefs _hdOavisituses _hdOclassCtxs _hdOconstructorTypeMap _hdOdclModuleHeader _hdOiclModuleHeader _hdOimportBlocks _hdOinhmap _hdOinitial _hdOlocalAttrTypes _hdOmainFile _hdOmainName _hdOnextVisits _hdOnt _hdOntType _hdOoptions _hdOparams _hdOprevVisits _hdOrename _hdOsynmap _hdOtextBlocks)
         (T_EProductions_vOut16 _tlIallvisits _tlIchildvisit _tlIcount _tlIdatatype _tlIerrors _tlIfromToStates _tlIgenProdIO _tlIimports _tlIrecordtype _tlIsemFunBndDefs _tlIsemFunBndTps _tlIsem_nt _tlIsem_prod _tlIsem_prod_tys _tlIt_visits _tlIvisitKinds _tlIvisitdefs _tlIvisituses) = inv_EProductions_s17 _tlX17 (T_EProductions_vIn16 _tlOallFromToStates _tlOallInhmap _tlOallInitStates _tlOallSynmap _tlOallVisitKinds _tlOallchildvisit _tlOallstates _tlOavisitdefs _tlOavisituses _tlOclassCtxs _tlOconstructorTypeMap _tlOdclModuleHeader _tlOiclModuleHeader _tlOimportBlocks _tlOinhmap _tlOinitial _tlOlocalAttrTypes _tlOmainFile _tlOmainName _tlOnextVisits _tlOnt _tlOntType _tlOoptions _tlOparams _tlOprevVisits _tlOrename _tlOsynmap _tlOtextBlocks)
         _lhsOrecordtype :: PP_Doc
         _lhsOrecordtype = rule349 _hdIrecordtype
         _lhsOallvisits :: [VisitStateState]
         _lhsOallvisits = rule350 _hdIallvisits
         _lhsOt_visits :: PP_Doc
         _lhsOt_visits = rule351 _hdIt_visits
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule352 _hdIchildvisit _tlIchildvisit
         _lhsOcount :: Int
         _lhsOcount = rule353 _hdIcount _tlIcount
         _lhsOdatatype :: [PP_Doc]
         _lhsOdatatype = rule354 _hdIdatatype _tlIdatatype
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule355 _hdIerrors _tlIerrors
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule356 _hdIfromToStates _tlIfromToStates
         _lhsOgenProdIO :: IO ()
         _lhsOgenProdIO = rule357 _hdIgenProdIO _tlIgenProdIO
         _lhsOimports :: [PP_Doc]
         _lhsOimports = rule358 _hdIimports _tlIimports
         _lhsOsemFunBndDefs :: Seq PP_Doc
         _lhsOsemFunBndDefs = rule359 _hdIsemFunBndDefs _tlIsemFunBndDefs
         _lhsOsemFunBndTps :: Seq PP_Doc
         _lhsOsemFunBndTps = rule360 _hdIsemFunBndTps _tlIsemFunBndTps
         _lhsOsem_nt :: PP_Doc
         _lhsOsem_nt = rule361 _hdIsem_nt _tlIsem_nt
         _lhsOsem_prod :: PP_Doc
         _lhsOsem_prod = rule362 _hdIsem_prod _tlIsem_prod
         _lhsOsem_prod_tys :: PP_Doc
         _lhsOsem_prod_tys = rule363 _hdIsem_prod_tys _tlIsem_prod_tys
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule364 _hdIvisitKinds _tlIvisitKinds
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule365 _hdIvisitdefs _tlIvisitdefs
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule366 _hdIvisituses _tlIvisituses
         _hdOallFromToStates = rule367 _lhsIallFromToStates
         _hdOallInhmap = rule368 _lhsIallInhmap
         _hdOallInitStates = rule369 _lhsIallInitStates
         _hdOallSynmap = rule370 _lhsIallSynmap
         _hdOallVisitKinds = rule371 _lhsIallVisitKinds
         _hdOallchildvisit = rule372 _lhsIallchildvisit
         _hdOallstates = rule373 _lhsIallstates
         _hdOavisitdefs = rule374 _lhsIavisitdefs
         _hdOavisituses = rule375 _lhsIavisituses
         _hdOclassCtxs = rule376 _lhsIclassCtxs
         _hdOconstructorTypeMap = rule377 _lhsIconstructorTypeMap
         _hdOdclModuleHeader = rule378 _lhsIdclModuleHeader
         _hdOiclModuleHeader = rule379 _lhsIiclModuleHeader
         _hdOimportBlocks = rule380 _lhsIimportBlocks
         _hdOinhmap = rule381 _lhsIinhmap
         _hdOinitial = rule382 _lhsIinitial
         _hdOlocalAttrTypes = rule383 _lhsIlocalAttrTypes
         _hdOmainFile = rule384 _lhsImainFile
         _hdOmainName = rule385 _lhsImainName
         _hdOnextVisits = rule386 _lhsInextVisits
         _hdOnt = rule387 _lhsInt
         _hdOntType = rule388 _lhsIntType
         _hdOoptions = rule389 _lhsIoptions
         _hdOparams = rule390 _lhsIparams
         _hdOprevVisits = rule391 _lhsIprevVisits
         _hdOrename = rule392 _lhsIrename
         _hdOsynmap = rule393 _lhsIsynmap
         _hdOtextBlocks = rule394 _lhsItextBlocks
         _tlOallFromToStates = rule395 _lhsIallFromToStates
         _tlOallInhmap = rule396 _lhsIallInhmap
         _tlOallInitStates = rule397 _lhsIallInitStates
         _tlOallSynmap = rule398 _lhsIallSynmap
         _tlOallVisitKinds = rule399 _lhsIallVisitKinds
         _tlOallchildvisit = rule400 _lhsIallchildvisit
         _tlOallstates = rule401 _lhsIallstates
         _tlOavisitdefs = rule402 _lhsIavisitdefs
         _tlOavisituses = rule403 _lhsIavisituses
         _tlOclassCtxs = rule404 _lhsIclassCtxs
         _tlOconstructorTypeMap = rule405 _lhsIconstructorTypeMap
         _tlOdclModuleHeader = rule406 _lhsIdclModuleHeader
         _tlOiclModuleHeader = rule407 _lhsIiclModuleHeader
         _tlOimportBlocks = rule408 _lhsIimportBlocks
         _tlOinhmap = rule409 _lhsIinhmap
         _tlOinitial = rule410 _lhsIinitial
         _tlOlocalAttrTypes = rule411 _lhsIlocalAttrTypes
         _tlOmainFile = rule412 _lhsImainFile
         _tlOmainName = rule413 _lhsImainName
         _tlOnextVisits = rule414 _lhsInextVisits
         _tlOnt = rule415 _lhsInt
         _tlOntType = rule416 _lhsIntType
         _tlOoptions = rule417 _lhsIoptions
         _tlOparams = rule418 _lhsIparams
         _tlOprevVisits = rule419 _lhsIprevVisits
         _tlOrename = rule420 _lhsIrename
         _tlOsynmap = rule421 _lhsIsynmap
         _tlOtextBlocks = rule422 _lhsItextBlocks
         __result_ = T_EProductions_vOut16 _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_EProductions_s17 v16
   {-# INLINE rule349 #-}
   {-# LINE 224 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule349 = \ ((_hdIrecordtype) :: PP_Doc) ->
                             {-# LINE 224 "src-ag/ExecutionPlan2Clean.ag" #-}
                             _hdIrecordtype
                             {-# LINE 3038 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule350 #-}
   {-# LINE 385 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule350 = \ ((_hdIallvisits) :: [VisitStateState]) ->
                           {-# LINE 385 "src-ag/ExecutionPlan2Clean.ag" #-}
                           _hdIallvisits
                           {-# LINE 3044 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule351 #-}
   {-# LINE 450 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule351 = \ ((_hdIt_visits) :: PP_Doc) ->
                          {-# LINE 450 "src-ag/ExecutionPlan2Clean.ag" #-}
                          _hdIt_visits
                          {-# LINE 3050 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule352 #-}
   rule352 = \ ((_hdIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ((_tlIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _hdIchildvisit `Map.union` _tlIchildvisit
   {-# INLINE rule353 #-}
   rule353 = \ ((_hdIcount) :: Int) ((_tlIcount) :: Int) ->
     _hdIcount + _tlIcount
   {-# INLINE rule354 #-}
   rule354 = \ ((_hdIdatatype) :: PP_Doc) ((_tlIdatatype) :: [PP_Doc]) ->
     _hdIdatatype : _tlIdatatype
   {-# INLINE rule355 #-}
   rule355 = \ ((_hdIerrors) :: Seq Error) ((_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# INLINE rule356 #-}
   rule356 = \ ((_hdIfromToStates) :: Map VisitIdentifier (Int,Int)) ((_tlIfromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _hdIfromToStates `mappend` _tlIfromToStates
   {-# INLINE rule357 #-}
   rule357 = \ ((_hdIgenProdIO) :: IO ()) ((_tlIgenProdIO) :: IO ()) ->
     _hdIgenProdIO >> _tlIgenProdIO
   {-# INLINE rule358 #-}
   rule358 = \ ((_hdIimports) :: [PP_Doc]) ((_tlIimports) :: [PP_Doc]) ->
     _hdIimports ++ _tlIimports
   {-# INLINE rule359 #-}
   rule359 = \ ((_hdIsemFunBndDefs) :: Seq PP_Doc) ((_tlIsemFunBndDefs) :: Seq PP_Doc) ->
     _hdIsemFunBndDefs Seq.>< _tlIsemFunBndDefs
   {-# INLINE rule360 #-}
   rule360 = \ ((_hdIsemFunBndTps) :: Seq PP_Doc) ((_tlIsemFunBndTps) :: Seq PP_Doc) ->
     _hdIsemFunBndTps Seq.>< _tlIsemFunBndTps
   {-# INLINE rule361 #-}
   rule361 = \ ((_hdIsem_nt) :: PP_Doc) ((_tlIsem_nt) :: PP_Doc) ->
     _hdIsem_nt >-< _tlIsem_nt
   {-# INLINE rule362 #-}
   rule362 = \ ((_hdIsem_prod) :: PP_Doc) ((_tlIsem_prod) :: PP_Doc) ->
     _hdIsem_prod >-< _tlIsem_prod
   {-# INLINE rule363 #-}
   rule363 = \ ((_hdIsem_prod_tys) :: PP_Doc) ((_tlIsem_prod_tys) :: PP_Doc) ->
     _hdIsem_prod_tys >-< _tlIsem_prod_tys
   {-# INLINE rule364 #-}
   rule364 = \ ((_hdIvisitKinds) :: Map VisitIdentifier VisitKind) ((_tlIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _hdIvisitKinds `mappend` _tlIvisitKinds
   {-# INLINE rule365 #-}
   rule365 = \ ((_hdIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ((_tlIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _hdIvisitdefs `uwSetUnion` _tlIvisitdefs
   {-# INLINE rule366 #-}
   rule366 = \ ((_hdIvisituses) :: Map VisitIdentifier (Set Identifier)) ((_tlIvisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _hdIvisituses `uwSetUnion` _tlIvisituses
   {-# INLINE rule367 #-}
   rule367 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule368 #-}
   rule368 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule369 #-}
   rule369 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule370 #-}
   rule370 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule371 #-}
   rule371 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule372 #-}
   rule372 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule373 #-}
   rule373 = \ ((_lhsIallstates) :: Set StateIdentifier) ->
     _lhsIallstates
   {-# INLINE rule374 #-}
   rule374 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule375 #-}
   rule375 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule376 #-}
   rule376 = \ ((_lhsIclassCtxs) :: ClassContext) ->
     _lhsIclassCtxs
   {-# INLINE rule377 #-}
   rule377 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule378 #-}
   rule378 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule379 #-}
   rule379 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule380 #-}
   rule380 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule381 #-}
   rule381 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule382 #-}
   rule382 = \ ((_lhsIinitial) :: StateIdentifier) ->
     _lhsIinitial
   {-# INLINE rule383 #-}
   rule383 = \ ((_lhsIlocalAttrTypes) :: Map ConstructorIdent (Map Identifier Type)) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule384 #-}
   rule384 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule385 #-}
   rule385 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule386 #-}
   rule386 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) ->
     _lhsInextVisits
   {-# INLINE rule387 #-}
   rule387 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule388 #-}
   rule388 = \ ((_lhsIntType) :: Type) ->
     _lhsIntType
   {-# INLINE rule389 #-}
   rule389 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule390 #-}
   rule390 = \ ((_lhsIparams) :: [Identifier]) ->
     _lhsIparams
   {-# INLINE rule391 #-}
   rule391 = \ ((_lhsIprevVisits) :: Map StateIdentifier StateCtx) ->
     _lhsIprevVisits
   {-# INLINE rule392 #-}
   rule392 = \ ((_lhsIrename) :: Bool) ->
     _lhsIrename
   {-# INLINE rule393 #-}
   rule393 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule394 #-}
   rule394 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule395 #-}
   rule395 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule396 #-}
   rule396 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule397 #-}
   rule397 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule398 #-}
   rule398 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule399 #-}
   rule399 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule400 #-}
   rule400 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule401 #-}
   rule401 = \ ((_lhsIallstates) :: Set StateIdentifier) ->
     _lhsIallstates
   {-# INLINE rule402 #-}
   rule402 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule403 #-}
   rule403 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule404 #-}
   rule404 = \ ((_lhsIclassCtxs) :: ClassContext) ->
     _lhsIclassCtxs
   {-# INLINE rule405 #-}
   rule405 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule406 #-}
   rule406 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule407 #-}
   rule407 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule408 #-}
   rule408 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule409 #-}
   rule409 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule410 #-}
   rule410 = \ ((_lhsIinitial) :: StateIdentifier) ->
     _lhsIinitial
   {-# INLINE rule411 #-}
   rule411 = \ ((_lhsIlocalAttrTypes) :: Map ConstructorIdent (Map Identifier Type)) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule412 #-}
   rule412 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule413 #-}
   rule413 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule414 #-}
   rule414 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) ->
     _lhsInextVisits
   {-# INLINE rule415 #-}
   rule415 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule416 #-}
   rule416 = \ ((_lhsIntType) :: Type) ->
     _lhsIntType
   {-# INLINE rule417 #-}
   rule417 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule418 #-}
   rule418 = \ ((_lhsIparams) :: [Identifier]) ->
     _lhsIparams
   {-# INLINE rule419 #-}
   rule419 = \ ((_lhsIprevVisits) :: Map StateIdentifier StateCtx) ->
     _lhsIprevVisits
   {-# INLINE rule420 #-}
   rule420 = \ ((_lhsIrename) :: Bool) ->
     _lhsIrename
   {-# INLINE rule421 #-}
   rule421 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule422 #-}
   rule422 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
{-# NOINLINE sem_EProductions_Nil #-}
sem_EProductions_Nil ::  T_EProductions 
sem_EProductions_Nil  = T_EProductions (return st17) where
   {-# NOINLINE st17 #-}
   st17 = let
      v16 :: T_EProductions_v16 
      v16 = \ (T_EProductions_vIn16 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallstates _lhsIavisitdefs _lhsIavisituses _lhsIclassCtxs _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIinitial _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInextVisits _lhsInt _lhsIntType _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIrename _lhsIsynmap _lhsItextBlocks) -> ( let
         _lhsOrecordtype :: PP_Doc
         _lhsOrecordtype = rule423  ()
         _lhsOallvisits :: [VisitStateState]
         _lhsOallvisits = rule424  ()
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule425  ()
         _lhsOcount :: Int
         _lhsOcount = rule426  ()
         _lhsOdatatype :: [PP_Doc]
         _lhsOdatatype = rule427  ()
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule428  ()
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule429  ()
         _lhsOgenProdIO :: IO ()
         _lhsOgenProdIO = rule430  ()
         _lhsOimports :: [PP_Doc]
         _lhsOimports = rule431  ()
         _lhsOsemFunBndDefs :: Seq PP_Doc
         _lhsOsemFunBndDefs = rule432  ()
         _lhsOsemFunBndTps :: Seq PP_Doc
         _lhsOsemFunBndTps = rule433  ()
         _lhsOsem_nt :: PP_Doc
         _lhsOsem_nt = rule434  ()
         _lhsOsem_prod :: PP_Doc
         _lhsOsem_prod = rule435  ()
         _lhsOsem_prod_tys :: PP_Doc
         _lhsOsem_prod_tys = rule436  ()
         _lhsOt_visits :: PP_Doc
         _lhsOt_visits = rule437  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule438  ()
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule439  ()
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule440  ()
         __result_ = T_EProductions_vOut16 _lhsOallvisits _lhsOchildvisit _lhsOcount _lhsOdatatype _lhsOerrors _lhsOfromToStates _lhsOgenProdIO _lhsOimports _lhsOrecordtype _lhsOsemFunBndDefs _lhsOsemFunBndTps _lhsOsem_nt _lhsOsem_prod _lhsOsem_prod_tys _lhsOt_visits _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_EProductions_s17 v16
   {-# INLINE rule423 #-}
   {-# LINE 225 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule423 = \  (_ :: ()) ->
                             {-# LINE 225 "src-ag/ExecutionPlan2Clean.ag" #-}
                             empty
                             {-# LINE 3315 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule424 #-}
   {-# LINE 386 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule424 = \  (_ :: ()) ->
                           {-# LINE 386 "src-ag/ExecutionPlan2Clean.ag" #-}
                           error "Every nonterminal should have at least 1 production"
                           {-# LINE 3321 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule425 #-}
   rule425 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule426 #-}
   rule426 = \  (_ :: ()) ->
     0
   {-# INLINE rule427 #-}
   rule427 = \  (_ :: ()) ->
     []
   {-# INLINE rule428 #-}
   rule428 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule429 #-}
   rule429 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule430 #-}
   rule430 = \  (_ :: ()) ->
     return ()
   {-# INLINE rule431 #-}
   rule431 = \  (_ :: ()) ->
     []
   {-# INLINE rule432 #-}
   rule432 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule433 #-}
   rule433 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule434 #-}
   rule434 = \  (_ :: ()) ->
     empty
   {-# INLINE rule435 #-}
   rule435 = \  (_ :: ()) ->
     empty
   {-# INLINE rule436 #-}
   rule436 = \  (_ :: ()) ->
     empty
   {-# INLINE rule437 #-}
   rule437 = \  (_ :: ()) ->
     empty
   {-# INLINE rule438 #-}
   rule438 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule439 #-}
   rule439 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule440 #-}
   rule440 = \  (_ :: ()) ->
     Map.empty

-- ERule -------------------------------------------------------
-- wrapper
data Inh_ERule  = Inh_ERule { allInhmap_Inh_ERule :: (Map NontermIdent Attributes), allSynmap_Inh_ERule :: (Map NontermIdent Attributes), childTypes_Inh_ERule :: (Map Identifier Type), con_Inh_ERule :: (ConstructorIdent), constructorTypeMap_Inh_ERule :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_ERule :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_ERule :: (String -> String -> String -> Bool -> String), importBlocks_Inh_ERule :: (PP_Doc), inhmap_Inh_ERule :: (Attributes), lazyIntras_Inh_ERule :: (Set String), localAttrTypes_Inh_ERule :: (Map Identifier Type), mainFile_Inh_ERule :: (String), mainName_Inh_ERule :: (String), nt_Inh_ERule :: (NontermIdent), options_Inh_ERule :: (Options), ruleKinds_Inh_ERule :: (Map Identifier (Set VisitKind)), synmap_Inh_ERule :: (Attributes), textBlocks_Inh_ERule :: (PP_Doc), usageInfo_Inh_ERule :: (Map Identifier Int) }
data Syn_ERule  = Syn_ERule { errors_Syn_ERule :: (Seq Error), mrules_Syn_ERule :: (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)), ruledefs_Syn_ERule :: (Map Identifier (Set String)), ruleuses_Syn_ERule :: (Map Identifier (Map String (Maybe NonLocalAttr))), sem_rules_Syn_ERule :: (PP_Doc), usedArgs_Syn_ERule :: (Set String) }
{-# INLINABLE wrap_ERule #-}
wrap_ERule :: T_ERule  -> Inh_ERule  -> (Syn_ERule )
wrap_ERule (T_ERule act) (Inh_ERule _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg19 = T_ERule_vIn19 _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo
        (T_ERule_vOut19 _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs) <- return (inv_ERule_s20 sem arg19)
        return (Syn_ERule _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs)
   )

-- cata
{-# INLINE sem_ERule #-}
sem_ERule :: ERule  -> T_ERule 
sem_ERule ( ERule name_ pattern_ rhs_ owrt_ origin_ explicit_ pure_ mbError_ ) = sem_ERule_ERule name_ ( sem_Pattern pattern_ ) ( sem_Expression rhs_ ) owrt_ origin_ explicit_ pure_ mbError_

-- semantic domain
newtype T_ERule  = T_ERule {
                           attach_T_ERule :: Identity (T_ERule_s20 )
                           }
newtype T_ERule_s20  = C_ERule_s20 {
                                   inv_ERule_s20 :: (T_ERule_v19 )
                                   }
data T_ERule_s21  = C_ERule_s21
type T_ERule_v19  = (T_ERule_vIn19 ) -> (T_ERule_vOut19 )
data T_ERule_vIn19  = T_ERule_vIn19 (Map NontermIdent Attributes) (Map NontermIdent Attributes) (Map Identifier Type) (ConstructorIdent) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (Attributes) (Set String) (Map Identifier Type) (String) (String) (NontermIdent) (Options) (Map Identifier (Set VisitKind)) (Attributes) (PP_Doc) (Map Identifier Int)
data T_ERule_vOut19  = T_ERule_vOut19 (Seq Error) (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) (Map Identifier (Set String)) (Map Identifier (Map String (Maybe NonLocalAttr))) (PP_Doc) (Set String)
{-# NOINLINE sem_ERule_ERule #-}
sem_ERule_ERule :: (Identifier) -> T_Pattern  -> T_Expression  -> (Bool) -> (String) -> (Bool) -> (Bool) -> (Maybe Error) -> T_ERule 
sem_ERule_ERule arg_name_ arg_pattern_ arg_rhs_ _ _ arg_explicit_ arg_pure_ arg_mbError_ = T_ERule (return st20) where
   {-# NOINLINE st20 #-}
   st20 = let
      v19 :: T_ERule_v19 
      v19 = \ (T_ERule_vIn19 _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo) -> ( let
         _patternX41 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pattern_))
         _rhsX29 = Control.Monad.Identity.runIdentity (attach_T_Expression (arg_rhs_))
         (T_Pattern_vOut40 _patternIattrTypes _patternIattrs _patternIcopy _patternIisUnderscore _patternIsem_lhs) = inv_Pattern_s41 _patternX41 (T_Pattern_vIn40 _patternOallInhmap _patternOallSynmap _patternOanyLazyKind _patternOinhmap _patternOlocalAttrTypes _patternOoptions _patternOsynmap)
         (T_Expression_vOut28 _rhsIattrs _rhsIpos _rhsIsemfunc _rhsItks) = inv_Expression_s29 _rhsX29 (T_Expression_vIn28 _rhsOoptions)
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule441 _usedArgs_augmented_f1 _usedArgs_augmented_syn
         _usedArgs_augmented_f1 = rule442 _rhsIattrs
         _lhsOsem_rules :: PP_Doc
         _lhsOsem_rules = rule443 _rulecode _used
         _rulecode = rule444 _endpragma _genpragma _lambda _pragma _rhsIpos _rhsIsemfunc
         _pragma = rule445 _rhsIpos
         _endpragma = rule446 _lhsImainFile
         _genpragma = rule447 _haspos _lhsIoptions arg_explicit_
         _haspos = rule448 _rhsIpos
         _lambda = rule449 _argPats _lhsIoptions _rhsIattrs arg_name_
         _argPats = rule450 _addbang1 _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIlazyIntras _lhsIlocalAttrTypes _lhsIoptions _rhsIattrs
         _argExprs = rule451 _rhsIattrs
         _stepcode = rule452 _argExprs _lhsIoptions _patternIattrTypes _patternIsem_lhs _rhsIattrs arg_name_ arg_pure_
         _lhsOmrules :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)
         _lhsOmrules = rule453 _stepcode arg_name_
         _used = rule454 _lhsIusageInfo arg_name_
         _kinds = rule455 _lhsIruleKinds arg_name_
         _anyLazyKind = rule456 _kinds
         _lhsOruledefs :: Map Identifier (Set String)
         _lhsOruledefs = rule457 _patternIattrs arg_name_
         _lhsOruleuses :: Map Identifier (Map String (Maybe NonLocalAttr))
         _lhsOruleuses = rule458 _rhsIattrs arg_name_
         _addbang = rule459 _lhsIoptions
         _addbang1 = rule460 _addbang _anyLazyKind
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule461 _used arg_mbError_
         _usedArgs_augmented_syn = rule462  ()
         _patternOallInhmap = rule463 _lhsIallInhmap
         _patternOallSynmap = rule464 _lhsIallSynmap
         _patternOanyLazyKind = rule465 _anyLazyKind
         _patternOinhmap = rule466 _lhsIinhmap
         _patternOlocalAttrTypes = rule467 _lhsIlocalAttrTypes
         _patternOoptions = rule468 _lhsIoptions
         _patternOsynmap = rule469 _lhsIsynmap
         _rhsOoptions = rule470 _lhsIoptions
         __result_ = T_ERule_vOut19 _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs
         in __result_ )
     in C_ERule_s20 v19
   {-# INLINE rule441 #-}
   rule441 = \ _usedArgs_augmented_f1 _usedArgs_augmented_syn ->
     foldr ($) _usedArgs_augmented_syn [_usedArgs_augmented_f1]
   {-# INLINE rule442 #-}
   rule442 = \ ((_rhsIattrs) :: Map String (Maybe NonLocalAttr)) ->
                        Set.union $ Map.keysSet $ Map.mapKeys (\a -> "arg_" ++ a) $ Map.filter isNothing _rhsIattrs
   {-# INLINE rule443 #-}
   {-# LINE 1011 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule443 = \ _rulecode _used ->
                          {-# LINE 1011 "src-ag/ExecutionPlan2Clean.ag" #-}
                          if _used     == 0
                          then empty
                          else _rulecode
                          {-# LINE 3464 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule444 #-}
   {-# LINE 1014 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule444 = \ _endpragma _genpragma _lambda _pragma ((_rhsIpos) :: Pos) ((_rhsIsemfunc) :: PP_Doc) ->
                          {-# LINE 1014 "src-ag/ExecutionPlan2Clean.ag" #-}
                          ( if _genpragma
                            then _pragma
                            else empty
                          )
                          >-< _lambda
                          >-< indent ((column _rhsIpos - 2) `max` 2)
                                ( if _genpragma
                                  then _pragma     >-< _rhsIsemfunc >-< _endpragma
                                  else _rhsIsemfunc
                                )
                          {-# LINE 3479 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule445 #-}
   {-# LINE 1026 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule445 = \ ((_rhsIpos) :: Pos) ->
                           {-# LINE 1026 "src-ag/ExecutionPlan2Clean.ag" #-}
                           "/*# LINE" >#< show (line _rhsIpos) >#< show (file _rhsIpos) >#< "#*/"
                           {-# LINE 3485 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule446 #-}
   {-# LINE 1027 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule446 = \ ((_lhsImainFile) :: String) ->
                           {-# LINE 1027 "src-ag/ExecutionPlan2Clean.ag" #-}
                           ppWithLineNr (\ln -> "/*# LINE " ++ show (ln+1) ++ " " ++ show _lhsImainFile ++ "#*/")
                           {-# LINE 3491 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule447 #-}
   {-# LINE 1028 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule447 = \ _haspos ((_lhsIoptions) :: Options) explicit_ ->
                           {-# LINE 1028 "src-ag/ExecutionPlan2Clean.ag" #-}
                           genLinePragmas _lhsIoptions && explicit_ && _haspos
                           {-# LINE 3497 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule448 #-}
   {-# LINE 1029 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule448 = \ ((_rhsIpos) :: Pos) ->
                           {-# LINE 1029 "src-ag/ExecutionPlan2Clean.ag" #-}
                           line _rhsIpos > 0 && column _rhsIpos >= 0 && not (null (file _rhsIpos))
                           {-# LINE 3503 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule449 #-}
   {-# LINE 1042 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule449 = \ _argPats ((_lhsIoptions) :: Options) ((_rhsIattrs) :: Map String (Maybe NonLocalAttr)) name_ ->
                           {-# LINE 1042 "src-ag/ExecutionPlan2Clean.ag" #-}
                           name_ >#< _argPats     >#< dummyPat _lhsIoptions (Map.null _rhsIattrs) >#< "="
                           {-# LINE 3509 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule450 #-}
   {-# LINE 1044 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule450 = \ _addbang1 ((_lhsIallInhmap) :: Map NontermIdent Attributes) ((_lhsIallSynmap) :: Map NontermIdent Attributes) ((_lhsIchildTypes) :: Map Identifier Type) ((_lhsIlazyIntras) :: Set String) ((_lhsIlocalAttrTypes) :: Map Identifier Type) ((_lhsIoptions) :: Options) ((_rhsIattrs) :: Map String (Maybe NonLocalAttr)) ->
                           {-# LINE 1044 "src-ag/ExecutionPlan2Clean.ag" #-}
                           ppSpaced [ let match | str `Set.member` _lhsIlazyIntras = pp str
                                                | otherwise                        = _addbang1     (pp str)
                                      in case mbAttr of
                                           Just (AttrSyn child nm) | child == _LOC && not (noPerStateTypeSigs _lhsIoptions) ->
                                             case Map.lookup nm _lhsIlocalAttrTypes of
                                               Just tp -> pp_parens (pp_parens match)
                                               Nothing -> match
                                           Just attr | not (noPerRuleTypeSigs _lhsIoptions) ->
                                             case lookupAttrType attr _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes of
                                               Just tpDoc -> pp_parens (pp_parens match)
                                               Nothing    -> match
                                           _ -> match
                                    | (str,mbAttr) <- Map.assocs _rhsIattrs
                                    ]
                           {-# LINE 3528 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule451 #-}
   {-# LINE 1058 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule451 = \ ((_rhsIattrs) :: Map String (Maybe NonLocalAttr)) ->
                           {-# LINE 1058 "src-ag/ExecutionPlan2Clean.ag" #-}
                           ppSpaced [ case mbAttr of
                                        Nothing -> "arg_" >|< str
                                        _       -> text str
                                    | (str,mbAttr) <- Map.assocs _rhsIattrs
                                    ]
                           {-# LINE 3538 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule452 #-}
   {-# LINE 1063 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule452 = \ _argExprs ((_lhsIoptions) :: Options) ((_patternIattrTypes) :: PP_Doc) ((_patternIsem_lhs) ::  PP_Doc ) ((_rhsIattrs) :: Map String (Maybe NonLocalAttr)) name_ pure_ ->
                           {-# LINE 1063 "src-ag/ExecutionPlan2Clean.ag" #-}
                           \kind fmtMode -> if kind `compatibleRule` pure_
                                            then Right $ let oper | pure_     = "="
                                                                  | otherwise = "<-"
                                                             decl = _patternIsem_lhs >#< oper >#< name_ >#< _argExprs     >#< dummyArg _lhsIoptions (Map.null _rhsIattrs)
                                                             tp   = if pure_ && not (noPerRuleTypeSigs _lhsIoptions)
                                                                      then _patternIattrTypes
                                                                      else empty
                                                         in fmtDecl pure_ fmtMode (tp >-< decl)
                                            else Left $ IncompatibleRuleKind name_ kind
                           {-# LINE 3552 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule453 #-}
   {-# LINE 1073 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule453 = \ _stepcode name_ ->
                           {-# LINE 1073 "src-ag/ExecutionPlan2Clean.ag" #-}
                           Map.singleton name_ _stepcode
                           {-# LINE 3558 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule454 #-}
   {-# LINE 1279 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule454 = \ ((_lhsIusageInfo) :: Map Identifier Int) name_ ->
                                                 {-# LINE 1279 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                 Map.findWithDefault 0 name_ _lhsIusageInfo
                                                 {-# LINE 3564 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule455 #-}
   {-# LINE 1295 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule455 = \ ((_lhsIruleKinds) :: Map Identifier (Set VisitKind)) name_ ->
                {-# LINE 1295 "src-ag/ExecutionPlan2Clean.ag" #-}
                Map.findWithDefault Set.empty name_ _lhsIruleKinds
                {-# LINE 3570 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule456 #-}
   {-# LINE 1296 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule456 = \ _kinds ->
                      {-# LINE 1296 "src-ag/ExecutionPlan2Clean.ag" #-}
                      Set.fold (\k r -> isLazyKind k || r) False _kinds
                      {-# LINE 3576 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule457 #-}
   {-# LINE 1342 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule457 = \ ((_patternIattrs) :: Set String) name_ ->
                           {-# LINE 1342 "src-ag/ExecutionPlan2Clean.ag" #-}
                           Map.singleton name_ _patternIattrs
                           {-# LINE 3582 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule458 #-}
   {-# LINE 1343 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule458 = \ ((_rhsIattrs) :: Map String (Maybe NonLocalAttr)) name_ ->
                           {-# LINE 1343 "src-ag/ExecutionPlan2Clean.ag" #-}
                           Map.singleton name_ _rhsIattrs
                           {-# LINE 3588 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule459 #-}
   {-# LINE 1564 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule459 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1564 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 3594 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule460 #-}
   {-# LINE 1575 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule460 = \ _addbang _anyLazyKind ->
                                                     {-# LINE 1575 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     if _anyLazyKind     then id else _addbang
                                                     {-# LINE 3600 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule461 #-}
   {-# LINE 1681 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule461 = \ _used mbError_ ->
                 {-# LINE 1681 "src-ag/ExecutionPlan2Clean.ag" #-}
                 case mbError_ of
                   Just e | _used     > 0 -> Seq.singleton e
                   _                      -> Seq.empty
                 {-# LINE 3608 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule462 #-}
   rule462 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule463 #-}
   rule463 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule464 #-}
   rule464 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule465 #-}
   rule465 = \ _anyLazyKind ->
     _anyLazyKind
   {-# INLINE rule466 #-}
   rule466 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule467 #-}
   rule467 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule468 #-}
   rule468 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule469 #-}
   rule469 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule470 #-}
   rule470 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions

-- ERules ------------------------------------------------------
-- wrapper
data Inh_ERules  = Inh_ERules { allInhmap_Inh_ERules :: (Map NontermIdent Attributes), allSynmap_Inh_ERules :: (Map NontermIdent Attributes), childTypes_Inh_ERules :: (Map Identifier Type), con_Inh_ERules :: (ConstructorIdent), constructorTypeMap_Inh_ERules :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_ERules :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_ERules :: (String -> String -> String -> Bool -> String), importBlocks_Inh_ERules :: (PP_Doc), inhmap_Inh_ERules :: (Attributes), lazyIntras_Inh_ERules :: (Set String), localAttrTypes_Inh_ERules :: (Map Identifier Type), mainFile_Inh_ERules :: (String), mainName_Inh_ERules :: (String), nt_Inh_ERules :: (NontermIdent), options_Inh_ERules :: (Options), ruleKinds_Inh_ERules :: (Map Identifier (Set VisitKind)), synmap_Inh_ERules :: (Attributes), textBlocks_Inh_ERules :: (PP_Doc), usageInfo_Inh_ERules :: (Map Identifier Int) }
data Syn_ERules  = Syn_ERules { errors_Syn_ERules :: (Seq Error), mrules_Syn_ERules :: (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)), ruledefs_Syn_ERules :: (Map Identifier (Set String)), ruleuses_Syn_ERules :: (Map Identifier (Map String (Maybe NonLocalAttr))), sem_rules_Syn_ERules :: (PP_Doc), usedArgs_Syn_ERules :: (Set String) }
{-# INLINABLE wrap_ERules #-}
wrap_ERules :: T_ERules  -> Inh_ERules  -> (Syn_ERules )
wrap_ERules (T_ERules act) (Inh_ERules _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg22 = T_ERules_vIn22 _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo
        (T_ERules_vOut22 _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs) <- return (inv_ERules_s23 sem arg22)
        return (Syn_ERules _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs)
   )

-- cata
{-# NOINLINE sem_ERules #-}
sem_ERules :: ERules  -> T_ERules 
sem_ERules list = Prelude.foldr sem_ERules_Cons sem_ERules_Nil (Prelude.map sem_ERule list)

-- semantic domain
newtype T_ERules  = T_ERules {
                             attach_T_ERules :: Identity (T_ERules_s23 )
                             }
newtype T_ERules_s23  = C_ERules_s23 {
                                     inv_ERules_s23 :: (T_ERules_v22 )
                                     }
data T_ERules_s24  = C_ERules_s24
type T_ERules_v22  = (T_ERules_vIn22 ) -> (T_ERules_vOut22 )
data T_ERules_vIn22  = T_ERules_vIn22 (Map NontermIdent Attributes) (Map NontermIdent Attributes) (Map Identifier Type) (ConstructorIdent) (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (Attributes) (Set String) (Map Identifier Type) (String) (String) (NontermIdent) (Options) (Map Identifier (Set VisitKind)) (Attributes) (PP_Doc) (Map Identifier Int)
data T_ERules_vOut22  = T_ERules_vOut22 (Seq Error) (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) (Map Identifier (Set String)) (Map Identifier (Map String (Maybe NonLocalAttr))) (PP_Doc) (Set String)
{-# NOINLINE sem_ERules_Cons #-}
sem_ERules_Cons :: T_ERule  -> T_ERules  -> T_ERules 
sem_ERules_Cons arg_hd_ arg_tl_ = T_ERules (return st23) where
   {-# NOINLINE st23 #-}
   st23 = let
      v22 :: T_ERules_v22 
      v22 = \ (T_ERules_vIn22 _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo) -> ( let
         _hdX20 = Control.Monad.Identity.runIdentity (attach_T_ERule (arg_hd_))
         _tlX23 = Control.Monad.Identity.runIdentity (attach_T_ERules (arg_tl_))
         (T_ERule_vOut19 _hdIerrors _hdImrules _hdIruledefs _hdIruleuses _hdIsem_rules _hdIusedArgs) = inv_ERule_s20 _hdX20 (T_ERule_vIn19 _hdOallInhmap _hdOallSynmap _hdOchildTypes _hdOcon _hdOconstructorTypeMap _hdOdclModuleHeader _hdOiclModuleHeader _hdOimportBlocks _hdOinhmap _hdOlazyIntras _hdOlocalAttrTypes _hdOmainFile _hdOmainName _hdOnt _hdOoptions _hdOruleKinds _hdOsynmap _hdOtextBlocks _hdOusageInfo)
         (T_ERules_vOut22 _tlIerrors _tlImrules _tlIruledefs _tlIruleuses _tlIsem_rules _tlIusedArgs) = inv_ERules_s23 _tlX23 (T_ERules_vIn22 _tlOallInhmap _tlOallSynmap _tlOchildTypes _tlOcon _tlOconstructorTypeMap _tlOdclModuleHeader _tlOiclModuleHeader _tlOimportBlocks _tlOinhmap _tlOlazyIntras _tlOlocalAttrTypes _tlOmainFile _tlOmainName _tlOnt _tlOoptions _tlOruleKinds _tlOsynmap _tlOtextBlocks _tlOusageInfo)
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule471 _hdIerrors _tlIerrors
         _lhsOmrules :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)
         _lhsOmrules = rule472 _hdImrules _tlImrules
         _lhsOruledefs :: Map Identifier (Set String)
         _lhsOruledefs = rule473 _hdIruledefs _tlIruledefs
         _lhsOruleuses :: Map Identifier (Map String (Maybe NonLocalAttr))
         _lhsOruleuses = rule474 _hdIruleuses _tlIruleuses
         _lhsOsem_rules :: PP_Doc
         _lhsOsem_rules = rule475 _hdIsem_rules _tlIsem_rules
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule476 _hdIusedArgs _tlIusedArgs
         _hdOallInhmap = rule477 _lhsIallInhmap
         _hdOallSynmap = rule478 _lhsIallSynmap
         _hdOchildTypes = rule479 _lhsIchildTypes
         _hdOcon = rule480 _lhsIcon
         _hdOconstructorTypeMap = rule481 _lhsIconstructorTypeMap
         _hdOdclModuleHeader = rule482 _lhsIdclModuleHeader
         _hdOiclModuleHeader = rule483 _lhsIiclModuleHeader
         _hdOimportBlocks = rule484 _lhsIimportBlocks
         _hdOinhmap = rule485 _lhsIinhmap
         _hdOlazyIntras = rule486 _lhsIlazyIntras
         _hdOlocalAttrTypes = rule487 _lhsIlocalAttrTypes
         _hdOmainFile = rule488 _lhsImainFile
         _hdOmainName = rule489 _lhsImainName
         _hdOnt = rule490 _lhsInt
         _hdOoptions = rule491 _lhsIoptions
         _hdOruleKinds = rule492 _lhsIruleKinds
         _hdOsynmap = rule493 _lhsIsynmap
         _hdOtextBlocks = rule494 _lhsItextBlocks
         _hdOusageInfo = rule495 _lhsIusageInfo
         _tlOallInhmap = rule496 _lhsIallInhmap
         _tlOallSynmap = rule497 _lhsIallSynmap
         _tlOchildTypes = rule498 _lhsIchildTypes
         _tlOcon = rule499 _lhsIcon
         _tlOconstructorTypeMap = rule500 _lhsIconstructorTypeMap
         _tlOdclModuleHeader = rule501 _lhsIdclModuleHeader
         _tlOiclModuleHeader = rule502 _lhsIiclModuleHeader
         _tlOimportBlocks = rule503 _lhsIimportBlocks
         _tlOinhmap = rule504 _lhsIinhmap
         _tlOlazyIntras = rule505 _lhsIlazyIntras
         _tlOlocalAttrTypes = rule506 _lhsIlocalAttrTypes
         _tlOmainFile = rule507 _lhsImainFile
         _tlOmainName = rule508 _lhsImainName
         _tlOnt = rule509 _lhsInt
         _tlOoptions = rule510 _lhsIoptions
         _tlOruleKinds = rule511 _lhsIruleKinds
         _tlOsynmap = rule512 _lhsIsynmap
         _tlOtextBlocks = rule513 _lhsItextBlocks
         _tlOusageInfo = rule514 _lhsIusageInfo
         __result_ = T_ERules_vOut22 _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs
         in __result_ )
     in C_ERules_s23 v22
   {-# INLINE rule471 #-}
   rule471 = \ ((_hdIerrors) :: Seq Error) ((_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# INLINE rule472 #-}
   rule472 = \ ((_hdImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ((_tlImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _hdImrules `Map.union` _tlImrules
   {-# INLINE rule473 #-}
   rule473 = \ ((_hdIruledefs) :: Map Identifier (Set String)) ((_tlIruledefs) :: Map Identifier (Set String)) ->
     _hdIruledefs `uwSetUnion` _tlIruledefs
   {-# INLINE rule474 #-}
   rule474 = \ ((_hdIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ((_tlIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _hdIruleuses `uwMapUnion` _tlIruleuses
   {-# INLINE rule475 #-}
   rule475 = \ ((_hdIsem_rules) :: PP_Doc) ((_tlIsem_rules) :: PP_Doc) ->
     _hdIsem_rules >-< _tlIsem_rules
   {-# INLINE rule476 #-}
   rule476 = \ ((_hdIusedArgs) :: Set String) ((_tlIusedArgs) :: Set String) ->
     _hdIusedArgs `Set.union` _tlIusedArgs
   {-# INLINE rule477 #-}
   rule477 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule478 #-}
   rule478 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule479 #-}
   rule479 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule480 #-}
   rule480 = \ ((_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule481 #-}
   rule481 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule482 #-}
   rule482 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule483 #-}
   rule483 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule484 #-}
   rule484 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule485 #-}
   rule485 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule486 #-}
   rule486 = \ ((_lhsIlazyIntras) :: Set String) ->
     _lhsIlazyIntras
   {-# INLINE rule487 #-}
   rule487 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule488 #-}
   rule488 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule489 #-}
   rule489 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule490 #-}
   rule490 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule491 #-}
   rule491 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule492 #-}
   rule492 = \ ((_lhsIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _lhsIruleKinds
   {-# INLINE rule493 #-}
   rule493 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule494 #-}
   rule494 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule495 #-}
   rule495 = \ ((_lhsIusageInfo) :: Map Identifier Int) ->
     _lhsIusageInfo
   {-# INLINE rule496 #-}
   rule496 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule497 #-}
   rule497 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule498 #-}
   rule498 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule499 #-}
   rule499 = \ ((_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule500 #-}
   rule500 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule501 #-}
   rule501 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule502 #-}
   rule502 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule503 #-}
   rule503 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule504 #-}
   rule504 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule505 #-}
   rule505 = \ ((_lhsIlazyIntras) :: Set String) ->
     _lhsIlazyIntras
   {-# INLINE rule506 #-}
   rule506 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule507 #-}
   rule507 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule508 #-}
   rule508 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule509 #-}
   rule509 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule510 #-}
   rule510 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule511 #-}
   rule511 = \ ((_lhsIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _lhsIruleKinds
   {-# INLINE rule512 #-}
   rule512 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule513 #-}
   rule513 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks
   {-# INLINE rule514 #-}
   rule514 = \ ((_lhsIusageInfo) :: Map Identifier Int) ->
     _lhsIusageInfo
{-# NOINLINE sem_ERules_Nil #-}
sem_ERules_Nil ::  T_ERules 
sem_ERules_Nil  = T_ERules (return st23) where
   {-# NOINLINE st23 #-}
   st23 = let
      v22 :: T_ERules_v22 
      v22 = \ (T_ERules_vIn22 _lhsIallInhmap _lhsIallSynmap _lhsIchildTypes _lhsIcon _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlazyIntras _lhsIlocalAttrTypes _lhsImainFile _lhsImainName _lhsInt _lhsIoptions _lhsIruleKinds _lhsIsynmap _lhsItextBlocks _lhsIusageInfo) -> ( let
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule515  ()
         _lhsOmrules :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)
         _lhsOmrules = rule516  ()
         _lhsOruledefs :: Map Identifier (Set String)
         _lhsOruledefs = rule517  ()
         _lhsOruleuses :: Map Identifier (Map String (Maybe NonLocalAttr))
         _lhsOruleuses = rule518  ()
         _lhsOsem_rules :: PP_Doc
         _lhsOsem_rules = rule519  ()
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule520  ()
         __result_ = T_ERules_vOut22 _lhsOerrors _lhsOmrules _lhsOruledefs _lhsOruleuses _lhsOsem_rules _lhsOusedArgs
         in __result_ )
     in C_ERules_s23 v22
   {-# INLINE rule515 #-}
   rule515 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule516 #-}
   rule516 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule517 #-}
   rule517 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule518 #-}
   rule518 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule519 #-}
   rule519 = \  (_ :: ()) ->
     empty
   {-# INLINE rule520 #-}
   rule520 = \  (_ :: ()) ->
     Set.empty

-- ExecutionPlan -----------------------------------------------
-- wrapper
data Inh_ExecutionPlan  = Inh_ExecutionPlan { constructorTypeMap_Inh_ExecutionPlan :: (Map NontermIdent ConstructorType), dclModuleHeader_Inh_ExecutionPlan :: (String -> String -> String -> Bool -> String), iclModuleHeader_Inh_ExecutionPlan :: (String -> String -> String -> Bool -> String), importBlocks_Inh_ExecutionPlan :: (PP_Doc), inhmap_Inh_ExecutionPlan :: (Map NontermIdent Attributes), localAttrTypes_Inh_ExecutionPlan :: (Map NontermIdent (Map ConstructorIdent (Map Identifier Type))), mainBlocksDoc_Inh_ExecutionPlan :: (PP_Doc), mainFile_Inh_ExecutionPlan :: (String), mainName_Inh_ExecutionPlan :: (String), options_Inh_ExecutionPlan :: (Options), synmap_Inh_ExecutionPlan :: (Map NontermIdent Attributes), textBlockMap_Inh_ExecutionPlan :: (Map BlockInfo PP_Doc), textBlocks_Inh_ExecutionPlan :: (PP_Doc) }
data Syn_ExecutionPlan  = Syn_ExecutionPlan { errors_Syn_ExecutionPlan :: (Seq Error), genIO_Syn_ExecutionPlan :: (IO ()), output_Syn_ExecutionPlan :: (PP_Doc), output_dcl_Syn_ExecutionPlan :: (PP_Doc) }
{-# INLINABLE wrap_ExecutionPlan #-}
wrap_ExecutionPlan :: T_ExecutionPlan  -> Inh_ExecutionPlan  -> (Syn_ExecutionPlan )
wrap_ExecutionPlan (T_ExecutionPlan act) (Inh_ExecutionPlan _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainBlocksDoc _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlockMap _lhsItextBlocks) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg25 = T_ExecutionPlan_vIn25 _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainBlocksDoc _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlockMap _lhsItextBlocks
        (T_ExecutionPlan_vOut25 _lhsOerrors _lhsOgenIO _lhsOoutput _lhsOoutput_dcl) <- return (inv_ExecutionPlan_s26 sem arg25)
        return (Syn_ExecutionPlan _lhsOerrors _lhsOgenIO _lhsOoutput _lhsOoutput_dcl)
   )

-- cata
{-# INLINE sem_ExecutionPlan #-}
sem_ExecutionPlan :: ExecutionPlan  -> T_ExecutionPlan 
sem_ExecutionPlan ( ExecutionPlan nonts_ typeSyns_ wrappers_ derivings_ ) = sem_ExecutionPlan_ExecutionPlan ( sem_ENonterminals nonts_ ) typeSyns_ wrappers_ derivings_

-- semantic domain
newtype T_ExecutionPlan  = T_ExecutionPlan {
                                           attach_T_ExecutionPlan :: Identity (T_ExecutionPlan_s26 )
                                           }
newtype T_ExecutionPlan_s26  = C_ExecutionPlan_s26 {
                                                   inv_ExecutionPlan_s26 :: (T_ExecutionPlan_v25 )
                                                   }
data T_ExecutionPlan_s27  = C_ExecutionPlan_s27
type T_ExecutionPlan_v25  = (T_ExecutionPlan_vIn25 ) -> (T_ExecutionPlan_vOut25 )
data T_ExecutionPlan_vIn25  = T_ExecutionPlan_vIn25 (Map NontermIdent ConstructorType) (String -> String -> String -> Bool -> String) (String -> String -> String -> Bool -> String) (PP_Doc) (Map NontermIdent Attributes) (Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) (PP_Doc) (String) (String) (Options) (Map NontermIdent Attributes) (Map BlockInfo PP_Doc) (PP_Doc)
data T_ExecutionPlan_vOut25  = T_ExecutionPlan_vOut25 (Seq Error) (IO ()) (PP_Doc) (PP_Doc)
{-# NOINLINE sem_ExecutionPlan_ExecutionPlan #-}
sem_ExecutionPlan_ExecutionPlan :: T_ENonterminals  -> (TypeSyns) -> (Set NontermIdent) -> (Derivings) -> T_ExecutionPlan 
sem_ExecutionPlan_ExecutionPlan arg_nonts_ arg_typeSyns_ arg_wrappers_ arg_derivings_ = T_ExecutionPlan (return st26) where
   {-# NOINLINE st26 #-}
   st26 = let
      v25 :: T_ExecutionPlan_v25 
      v25 = \ (T_ExecutionPlan_vIn25 _lhsIconstructorTypeMap _lhsIdclModuleHeader _lhsIiclModuleHeader _lhsIimportBlocks _lhsIinhmap _lhsIlocalAttrTypes _lhsImainBlocksDoc _lhsImainFile _lhsImainName _lhsIoptions _lhsIsynmap _lhsItextBlockMap _lhsItextBlocks) -> ( let
         _nontsX11 = Control.Monad.Identity.runIdentity (attach_T_ENonterminals (arg_nonts_))
         (T_ENonterminals_vOut10 _nontsIappendCommon _nontsIappendMain _nontsIchildvisit _nontsIerrors _nontsIfromToStates _nontsIgenProdIO _nontsIimports _nontsIinitStates _nontsIoutput _nontsIoutput_dcl _nontsIsemFunBndDefs _nontsIsemFunBndTps _nontsIvisitKinds _nontsIvisitdefs _nontsIvisituses) = inv_ENonterminals_s11 _nontsX11 (T_ENonterminals_vIn10 _nontsOallFromToStates _nontsOallInitStates _nontsOallVisitKinds _nontsOallchildvisit _nontsOavisitdefs _nontsOavisituses _nontsOconstructorTypeMap _nontsOdclModuleHeader _nontsOderivings _nontsOiclModuleHeader _nontsOimportBlocks _nontsOinhmap _nontsOlocalAttrTypes _nontsOmainFile _nontsOmainName _nontsOoptions _nontsOsynmap _nontsOtextBlocks _nontsOtypeSyns _nontsOwrappers)
         _lhsOoutput :: PP_Doc
         _lhsOoutput = rule521 _commonExtra _nontsIoutput _wrappersExtra
         _lhsOoutput_dcl :: PP_Doc
         _lhsOoutput_dcl = rule522 _nontsIoutput_dcl
         _nontsOwrappers = rule523 arg_wrappers_
         _nontsOtypeSyns = rule524 arg_typeSyns_
         _nontsOderivings = rule525 arg_derivings_
         _wrappersExtra = rule526 _lateSemBndDef _lhsIoptions
         _commonExtra = rule527 _lateSemBndTp _lhsIoptions
         _lateSemBndTp = rule528 _lhsImainName _nontsIsemFunBndTps
         _lateSemBndDef = rule529 _lhsImainName _nontsIsemFunBndDefs
         _nontsOallchildvisit = rule530 _nontsIchildvisit
         _nontsOavisitdefs = rule531 _nontsIvisitdefs
         _nontsOavisituses = rule532 _nontsIvisituses
         _lhsOgenIO :: IO ()
         _lhsOgenIO = rule533 _genCommonModule _genMainModule _nontsIgenProdIO
         _mainModuleFile = rule534 _lhsImainFile
         _ppMonadImports = rule535  ()
         _genMainModule = rule536 _lhsIiclModuleHeader _lhsImainBlocksDoc _lhsImainName _mainModuleFile _nontsIappendMain _nontsIimports _ppMonadImports _wrappersExtra
         _commonFile = rule537 _lhsImainFile
         _genCommonModule = rule538 _commonExtra _commonFile _lhsIiclModuleHeader _lhsIimportBlocks _lhsImainName _lhsItextBlocks _nontsIappendCommon _ppMonadImports
         _nontsOallFromToStates = rule539 _nontsIfromToStates
         _nontsOallVisitKinds = rule540 _nontsIvisitKinds
         _nontsOallInitStates = rule541 _nontsIinitStates
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule542 _nontsIerrors
         _nontsOconstructorTypeMap = rule543 _lhsIconstructorTypeMap
         _nontsOdclModuleHeader = rule544 _lhsIdclModuleHeader
         _nontsOiclModuleHeader = rule545 _lhsIiclModuleHeader
         _nontsOimportBlocks = rule546 _lhsIimportBlocks
         _nontsOinhmap = rule547 _lhsIinhmap
         _nontsOlocalAttrTypes = rule548 _lhsIlocalAttrTypes
         _nontsOmainFile = rule549 _lhsImainFile
         _nontsOmainName = rule550 _lhsImainName
         _nontsOoptions = rule551 _lhsIoptions
         _nontsOsynmap = rule552 _lhsIsynmap
         _nontsOtextBlocks = rule553 _lhsItextBlocks
         __result_ = T_ExecutionPlan_vOut25 _lhsOerrors _lhsOgenIO _lhsOoutput _lhsOoutput_dcl
         in __result_ )
     in C_ExecutionPlan_s26 v25
   {-# INLINE rule521 #-}
   {-# LINE 91 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule521 = \ _commonExtra ((_nontsIoutput) :: PP_Doc) _wrappersExtra ->
                                 {-# LINE 91 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _nontsIoutput >-< _commonExtra     >-< _wrappersExtra
                                 {-# LINE 3988 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule522 #-}
   {-# LINE 92 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule522 = \ ((_nontsIoutput_dcl) :: PP_Doc) ->
                                     {-# LINE 92 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     _nontsIoutput_dcl
                                     {-# LINE 3994 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule523 #-}
   {-# LINE 99 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule523 = \ wrappers_ ->
                                     {-# LINE 99 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     wrappers_
                                     {-# LINE 4000 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule524 #-}
   {-# LINE 159 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule524 = \ typeSyns_ ->
                                     {-# LINE 159 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     typeSyns_
                                     {-# LINE 4006 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule525 #-}
   {-# LINE 160 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule525 = \ derivings_ ->
                                      {-# LINE 160 "src-ag/ExecutionPlan2Clean.ag" #-}
                                      derivings_
                                      {-# LINE 4012 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule526 #-}
   {-# LINE 599 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule526 = \ _lateSemBndDef ((_lhsIoptions) :: Options) ->
                        {-# LINE 599 "src-ag/ExecutionPlan2Clean.ag" #-}
                        if lateHigherOrderBinding _lhsIoptions
                        then _lateSemBndDef
                        else empty
                        {-# LINE 4020 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule527 #-}
   {-# LINE 602 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule527 = \ _lateSemBndTp ((_lhsIoptions) :: Options) ->
                        {-# LINE 602 "src-ag/ExecutionPlan2Clean.ag" #-}
                        if lateHigherOrderBinding _lhsIoptions
                        then _lateSemBndTp
                        else empty
                        {-# LINE 4028 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule528 #-}
   {-# LINE 605 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule528 = \ ((_lhsImainName) :: String) ((_nontsIsemFunBndTps) :: Seq PP_Doc) ->
                       {-# LINE 605 "src-ag/ExecutionPlan2Clean.ag" #-}
                       "::" >#< lateBindingTypeNm _lhsImainName >#< "=" >#< lateBindingTypeNm _lhsImainName
                        >-< (indent 2 $ pp_block "{" "}" "," $ toList _nontsIsemFunBndTps)
                       {-# LINE 4035 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule529 #-}
   {-# LINE 607 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule529 = \ ((_lhsImainName) :: String) ((_nontsIsemFunBndDefs) :: Seq PP_Doc) ->
                        {-# LINE 607 "src-ag/ExecutionPlan2Clean.ag" #-}
                        lateBindingFieldNm _lhsImainName >#< "::" >#< lateBindingTypeNm _lhsImainName
                        >-< lateBindingFieldNm _lhsImainName >#< "=" >#< lateBindingTypeNm _lhsImainName
                        >-< (indent 2 $ pp_block "{" "}" "," $ toList _nontsIsemFunBndDefs )
                        {-# LINE 4043 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule530 #-}
   {-# LINE 1223 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule530 = \ ((_nontsIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
                                          {-# LINE 1223 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          _nontsIchildvisit
                                          {-# LINE 4049 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule531 #-}
   {-# LINE 1367 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule531 = \ ((_nontsIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
                                       {-# LINE 1367 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       _nontsIvisitdefs
                                       {-# LINE 4055 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule532 #-}
   {-# LINE 1368 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule532 = \ ((_nontsIvisituses) :: Map VisitIdentifier (Set Identifier)) ->
                                       {-# LINE 1368 "src-ag/ExecutionPlan2Clean.ag" #-}
                                       _nontsIvisituses
                                       {-# LINE 4061 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule533 #-}
   {-# LINE 1439 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule533 = \ _genCommonModule _genMainModule ((_nontsIgenProdIO) :: IO ()) ->
                                          {-# LINE 1439 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          do _genMainModule
                                             _genCommonModule
                                             _nontsIgenProdIO
                                          {-# LINE 4069 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule534 #-}
   {-# LINE 1442 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule534 = \ ((_lhsImainFile) :: String) ->
                                          {-# LINE 1442 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          _lhsImainFile
                                          {-# LINE 4075 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule535 #-}
   {-# LINE 1443 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule535 = \  (_ :: ()) ->
                                          {-# LINE 1443 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          pp "import qualified Control.Monad.Identity"
                                          {-# LINE 4081 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule536 #-}
   {-# LINE 1444 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule536 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ((_lhsImainBlocksDoc) :: PP_Doc) ((_lhsImainName) :: String) _mainModuleFile ((_nontsIappendMain) :: [PP_Doc]) ((_nontsIimports) :: [PP_Doc]) _ppMonadImports _wrappersExtra ->
                                          {-# LINE 1444 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          writeModule _mainModuleFile
                                            ( [ pp $ _lhsIiclModuleHeader _lhsImainName "" "" False
                                              , _ppMonadImports
                                              , pp $ "import " ++ _lhsImainName ++ "_common"
                                              ]
                                              ++ _nontsIimports
                                              ++ [_lhsImainBlocksDoc]
                                              ++ [_wrappersExtra    ]
                                              ++ _nontsIappendMain
                                            )
                                          {-# LINE 4096 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule537 #-}
   {-# LINE 1454 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule537 = \ ((_lhsImainFile) :: String) ->
                                          {-# LINE 1454 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          replaceBaseName _lhsImainFile (takeBaseName _lhsImainFile ++ "_common")
                                          {-# LINE 4102 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule538 #-}
   {-# LINE 1455 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule538 = \ _commonExtra _commonFile ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ((_lhsIimportBlocks) :: PP_Doc) ((_lhsImainName) :: String) ((_lhsItextBlocks) :: PP_Doc) ((_nontsIappendCommon) :: [PP_Doc]) _ppMonadImports ->
                                          {-# LINE 1455 "src-ag/ExecutionPlan2Clean.ag" #-}
                                          writeModule _commonFile
                                            ( [ pp $ _lhsIiclModuleHeader _lhsImainName "_common" "" True
                                              , _ppMonadImports
                                              , _lhsIimportBlocks
                                              , _lhsItextBlocks
                                              , _commonExtra
                                              ]
                                              ++ _nontsIappendCommon
                                            )
                                          {-# LINE 4116 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule539 #-}
   {-# LINE 1603 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule539 = \ ((_nontsIfromToStates) :: Map VisitIdentifier (Int,Int)) ->
                            {-# LINE 1603 "src-ag/ExecutionPlan2Clean.ag" #-}
                            _nontsIfromToStates
                            {-# LINE 4122 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule540 #-}
   {-# LINE 1647 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule540 = \ ((_nontsIvisitKinds) :: Map VisitIdentifier VisitKind) ->
                          {-# LINE 1647 "src-ag/ExecutionPlan2Clean.ag" #-}
                          _nontsIvisitKinds
                          {-# LINE 4128 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule541 #-}
   {-# LINE 1661 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule541 = \ ((_nontsIinitStates) :: Map NontermIdent Int) ->
                          {-# LINE 1661 "src-ag/ExecutionPlan2Clean.ag" #-}
                          _nontsIinitStates
                          {-# LINE 4134 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule542 #-}
   rule542 = \ ((_nontsIerrors) :: Seq Error) ->
     _nontsIerrors
   {-# INLINE rule543 #-}
   rule543 = \ ((_lhsIconstructorTypeMap) :: Map NontermIdent ConstructorType) ->
     _lhsIconstructorTypeMap
   {-# INLINE rule544 #-}
   rule544 = \ ((_lhsIdclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIdclModuleHeader
   {-# INLINE rule545 #-}
   rule545 = \ ((_lhsIiclModuleHeader) :: String -> String -> String -> Bool -> String) ->
     _lhsIiclModuleHeader
   {-# INLINE rule546 #-}
   rule546 = \ ((_lhsIimportBlocks) :: PP_Doc) ->
     _lhsIimportBlocks
   {-# INLINE rule547 #-}
   rule547 = \ ((_lhsIinhmap) :: Map NontermIdent Attributes) ->
     _lhsIinhmap
   {-# INLINE rule548 #-}
   rule548 = \ ((_lhsIlocalAttrTypes) :: Map NontermIdent (Map ConstructorIdent (Map Identifier Type))) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule549 #-}
   rule549 = \ ((_lhsImainFile) :: String) ->
     _lhsImainFile
   {-# INLINE rule550 #-}
   rule550 = \ ((_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule551 #-}
   rule551 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule552 #-}
   rule552 = \ ((_lhsIsynmap) :: Map NontermIdent Attributes) ->
     _lhsIsynmap
   {-# INLINE rule553 #-}
   rule553 = \ ((_lhsItextBlocks) :: PP_Doc) ->
     _lhsItextBlocks

-- Expression --------------------------------------------------
-- wrapper
data Inh_Expression  = Inh_Expression { options_Inh_Expression :: (Options) }
data Syn_Expression  = Syn_Expression { attrs_Syn_Expression :: (Map String (Maybe NonLocalAttr)), pos_Syn_Expression :: (Pos), semfunc_Syn_Expression :: (PP_Doc), tks_Syn_Expression :: ([HsToken]) }
{-# INLINABLE wrap_Expression #-}
wrap_Expression :: T_Expression  -> Inh_Expression  -> (Syn_Expression )
wrap_Expression (T_Expression act) (Inh_Expression _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg28 = T_Expression_vIn28 _lhsIoptions
        (T_Expression_vOut28 _lhsOattrs _lhsOpos _lhsOsemfunc _lhsOtks) <- return (inv_Expression_s29 sem arg28)
        return (Syn_Expression _lhsOattrs _lhsOpos _lhsOsemfunc _lhsOtks)
   )

-- cata
{-# INLINE sem_Expression #-}
sem_Expression :: Expression  -> T_Expression 
sem_Expression ( Expression pos_ tks_ ) = sem_Expression_Expression pos_ tks_

-- semantic domain
newtype T_Expression  = T_Expression {
                                     attach_T_Expression :: Identity (T_Expression_s29 )
                                     }
newtype T_Expression_s29  = C_Expression_s29 {
                                             inv_Expression_s29 :: (T_Expression_v28 )
                                             }
data T_Expression_s30  = C_Expression_s30
type T_Expression_v28  = (T_Expression_vIn28 ) -> (T_Expression_vOut28 )
data T_Expression_vIn28  = T_Expression_vIn28 (Options)
data T_Expression_vOut28  = T_Expression_vOut28 (Map String (Maybe NonLocalAttr)) (Pos) (PP_Doc) ([HsToken])
{-# NOINLINE sem_Expression_Expression #-}
sem_Expression_Expression :: (Pos) -> ([HsToken]) -> T_Expression 
sem_Expression_Expression arg_pos_ arg_tks_ = T_Expression (return st29) where
   {-# NOINLINE st29 #-}
   st29 = let
      v28 :: T_Expression_v28 
      v28 = \ (T_Expression_vIn28 _lhsIoptions) -> ( let
         _lhsOtks :: [HsToken]
         _lhsOtks = rule554 arg_tks_
         _lhsOpos :: Pos
         _lhsOpos = rule555 arg_pos_
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule556 _inhhstoken arg_tks_
         _lhsOsemfunc :: PP_Doc
         _lhsOsemfunc = rule557 _inhhstoken arg_tks_
         _inhhstoken = rule558 _lhsIoptions
         __result_ = T_Expression_vOut28 _lhsOattrs _lhsOpos _lhsOsemfunc _lhsOtks
         in __result_ )
     in C_Expression_s29 v28
   {-# INLINE rule554 #-}
   {-# LINE 1077 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule554 = \ tks_ ->
                           {-# LINE 1077 "src-ag/ExecutionPlan2Clean.ag" #-}
                           tks_
                           {-# LINE 4226 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule555 #-}
   {-# LINE 1120 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule555 = \ pos_ ->
                                        {-# LINE 1120 "src-ag/ExecutionPlan2Clean.ag" #-}
                                        pos_
                                        {-# LINE 4232 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule556 #-}
   {-# LINE 1207 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule556 = \ _inhhstoken tks_ ->
                               {-# LINE 1207 "src-ag/ExecutionPlan2Clean.ag" #-}
                               Map.unions $ map (\tok -> attrs_Syn_HsToken (wrap_HsToken (sem_HsToken tok) _inhhstoken    )) tks_
                               {-# LINE 4238 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule557 #-}
   {-# LINE 1208 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule557 = \ _inhhstoken tks_ ->
                               {-# LINE 1208 "src-ag/ExecutionPlan2Clean.ag" #-}
                               vlist $ showTokens $ map (\tok -> tok_Syn_HsToken (wrap_HsToken (sem_HsToken tok) _inhhstoken    )) tks_
                               {-# LINE 4244 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule558 #-}
   {-# LINE 1209 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule558 = \ ((_lhsIoptions) :: Options) ->
                                  {-# LINE 1209 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  Inh_HsToken _lhsIoptions
                                  {-# LINE 4250 "src-generated/ExecutionPlan2Clean.hs" #-}

-- HsToken -----------------------------------------------------
-- wrapper
data Inh_HsToken  = Inh_HsToken { options_Inh_HsToken :: (Options) }
data Syn_HsToken  = Syn_HsToken { attrs_Syn_HsToken :: (Map String (Maybe NonLocalAttr)), tok_Syn_HsToken :: ((Pos,String)) }
{-# INLINABLE wrap_HsToken #-}
wrap_HsToken :: T_HsToken  -> Inh_HsToken  -> (Syn_HsToken )
wrap_HsToken (T_HsToken act) (Inh_HsToken _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg31 = T_HsToken_vIn31 _lhsIoptions
        (T_HsToken_vOut31 _lhsOattrs _lhsOtok) <- return (inv_HsToken_s32 sem arg31)
        return (Syn_HsToken _lhsOattrs _lhsOtok)
   )

-- cata
{-# NOINLINE sem_HsToken #-}
sem_HsToken :: HsToken  -> T_HsToken 
sem_HsToken ( AGLocal var_ pos_ rdesc_ ) = sem_HsToken_AGLocal var_ pos_ rdesc_
sem_HsToken ( AGField field_ attr_ pos_ rdesc_ ) = sem_HsToken_AGField field_ attr_ pos_ rdesc_
sem_HsToken ( HsToken value_ pos_ ) = sem_HsToken_HsToken value_ pos_
sem_HsToken ( CharToken value_ pos_ ) = sem_HsToken_CharToken value_ pos_
sem_HsToken ( StrToken value_ pos_ ) = sem_HsToken_StrToken value_ pos_
sem_HsToken ( Err mesg_ pos_ ) = sem_HsToken_Err mesg_ pos_

-- semantic domain
newtype T_HsToken  = T_HsToken {
                               attach_T_HsToken :: Identity (T_HsToken_s32 )
                               }
newtype T_HsToken_s32  = C_HsToken_s32 {
                                       inv_HsToken_s32 :: (T_HsToken_v31 )
                                       }
data T_HsToken_s33  = C_HsToken_s33
type T_HsToken_v31  = (T_HsToken_vIn31 ) -> (T_HsToken_vOut31 )
data T_HsToken_vIn31  = T_HsToken_vIn31 (Options)
data T_HsToken_vOut31  = T_HsToken_vOut31 (Map String (Maybe NonLocalAttr)) ((Pos,String))
{-# NOINLINE sem_HsToken_AGLocal #-}
sem_HsToken_AGLocal :: (Identifier) -> (Pos) -> (Maybe String) -> T_HsToken 
sem_HsToken_AGLocal arg_var_ arg_pos_ _ = T_HsToken (return st32) where
   {-# NOINLINE st32 #-}
   st32 = let
      v31 :: T_HsToken_v31 
      v31 = \ (T_HsToken_vIn31 _lhsIoptions) -> ( let
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule559 arg_var_
         _tok = rule560 arg_pos_ arg_var_
         _lhsOtok :: (Pos,String)
         _lhsOtok = rule561 _tok
         __result_ = T_HsToken_vOut31 _lhsOattrs _lhsOtok
         in __result_ )
     in C_HsToken_s32 v31
   {-# INLINE rule559 #-}
   {-# LINE 1166 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule559 = \ var_ ->
                              {-# LINE 1166 "src-ag/ExecutionPlan2Clean.ag" #-}
                              Map.singleton (fieldname var_) Nothing
                              {-# LINE 4307 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule560 #-}
   {-# LINE 1412 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule560 = \ pos_ var_ ->
                          {-# LINE 1412 "src-ag/ExecutionPlan2Clean.ag" #-}
                          (pos_,fieldname var_)
                          {-# LINE 4313 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule561 #-}
   rule561 = \ _tok ->
     _tok
{-# NOINLINE sem_HsToken_AGField #-}
sem_HsToken_AGField :: (Identifier) -> (Identifier) -> (Pos) -> (Maybe String) -> T_HsToken 
sem_HsToken_AGField arg_field_ arg_attr_ arg_pos_ arg_rdesc_ = T_HsToken (return st32) where
   {-# NOINLINE st32 #-}
   st32 = let
      v31 :: T_HsToken_v31 
      v31 = \ (T_HsToken_vIn31 _lhsIoptions) -> ( let
         _mbAttr = rule562 arg_attr_ arg_field_
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule563 _lhsIoptions _mbAttr arg_attr_ arg_field_
         _addTrace = rule564 arg_attr_ arg_field_ arg_rdesc_
         _lhsOtok :: (Pos,String)
         _lhsOtok = rule565 _addTrace _lhsIoptions arg_attr_ arg_field_ arg_pos_
         __result_ = T_HsToken_vOut31 _lhsOattrs _lhsOtok
         in __result_ )
     in C_HsToken_s32 v31
   {-# INLINE rule562 #-}
   {-# LINE 1167 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule562 = \ attr_ field_ ->
                              {-# LINE 1167 "src-ag/ExecutionPlan2Clean.ag" #-}
                              if field_ == _INST || field_ == _FIELD || field_ == _INST'
                              then Nothing
                              else Just $ mkNonLocalAttr (field_ == _LHS) field_ attr_
                              {-# LINE 4340 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule563 #-}
   {-# LINE 1170 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule563 = \ ((_lhsIoptions) :: Options) _mbAttr attr_ field_ ->
                              {-# LINE 1170 "src-ag/ExecutionPlan2Clean.ag" #-}
                              Map.singleton (attrname _lhsIoptions True field_ attr_) _mbAttr
                              {-# LINE 4346 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule564 #-}
   {-# LINE 1416 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule564 = \ attr_ field_ rdesc_ ->
                        {-# LINE 1416 "src-ag/ExecutionPlan2Clean.ag" #-}
                        case rdesc_ of
                          Just d  -> \x -> "(trace_n " ++ show (d ++ " -> " ++ show field_ ++ "." ++ show attr_) ++ " (" ++ x ++ "))"
                          Nothing -> id
                        {-# LINE 4354 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule565 #-}
   {-# LINE 1419 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule565 = \ _addTrace ((_lhsIoptions) :: Options) attr_ field_ pos_ ->
                   {-# LINE 1419 "src-ag/ExecutionPlan2Clean.ag" #-}
                   (pos_, _addTrace     $ attrname _lhsIoptions True field_ attr_)
                   {-# LINE 4360 "src-generated/ExecutionPlan2Clean.hs" #-}
{-# NOINLINE sem_HsToken_HsToken #-}
sem_HsToken_HsToken :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_HsToken arg_value_ arg_pos_ = T_HsToken (return st32) where
   {-# NOINLINE st32 #-}
   st32 = let
      v31 :: T_HsToken_v31 
      v31 = \ (T_HsToken_vIn31 _lhsIoptions) -> ( let
         _lhsOtok :: (Pos,String)
         _lhsOtok = rule566 arg_pos_ arg_value_
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule567  ()
         __result_ = T_HsToken_vOut31 _lhsOattrs _lhsOtok
         in __result_ )
     in C_HsToken_s32 v31
   {-# INLINE rule566 #-}
   {-# LINE 1421 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule566 = \ pos_ value_ ->
                         {-# LINE 1421 "src-ag/ExecutionPlan2Clean.ag" #-}
                         (pos_, value_)
                         {-# LINE 4380 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule567 #-}
   rule567 = \  (_ :: ()) ->
     Map.empty
{-# NOINLINE sem_HsToken_CharToken #-}
sem_HsToken_CharToken :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_CharToken arg_value_ arg_pos_ = T_HsToken (return st32) where
   {-# NOINLINE st32 #-}
   st32 = let
      v31 :: T_HsToken_v31 
      v31 = \ (T_HsToken_vIn31 _lhsIoptions) -> ( let
         _lhsOtok :: (Pos,String)
         _lhsOtok = rule568 arg_pos_ arg_value_
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule569  ()
         __result_ = T_HsToken_vOut31 _lhsOattrs _lhsOtok
         in __result_ )
     in C_HsToken_s32 v31
   {-# INLINE rule568 #-}
   {-# LINE 1423 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule568 = \ pos_ value_ ->
                           {-# LINE 1423 "src-ag/ExecutionPlan2Clean.ag" #-}
                           (pos_, if null value_
                                     then ""
                                     else showCharShort (head value_)
                           )
                           {-# LINE 4406 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule569 #-}
   rule569 = \  (_ :: ()) ->
     Map.empty
{-# NOINLINE sem_HsToken_StrToken #-}
sem_HsToken_StrToken :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_StrToken arg_value_ arg_pos_ = T_HsToken (return st32) where
   {-# NOINLINE st32 #-}
   st32 = let
      v31 :: T_HsToken_v31 
      v31 = \ (T_HsToken_vIn31 _lhsIoptions) -> ( let
         _lhsOtok :: (Pos,String)
         _lhsOtok = rule570 arg_pos_ arg_value_
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule571  ()
         __result_ = T_HsToken_vOut31 _lhsOattrs _lhsOtok
         in __result_ )
     in C_HsToken_s32 v31
   {-# INLINE rule570 #-}
   {-# LINE 1428 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule570 = \ pos_ value_ ->
                           {-# LINE 1428 "src-ag/ExecutionPlan2Clean.ag" #-}
                           (pos_, showStrShort value_)
                           {-# LINE 4429 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule571 #-}
   rule571 = \  (_ :: ()) ->
     Map.empty
{-# NOINLINE sem_HsToken_Err #-}
sem_HsToken_Err :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_Err _ arg_pos_ = T_HsToken (return st32) where
   {-# NOINLINE st32 #-}
   st32 = let
      v31 :: T_HsToken_v31 
      v31 = \ (T_HsToken_vIn31 _lhsIoptions) -> ( let
         _lhsOtok :: (Pos,String)
         _lhsOtok = rule572 arg_pos_
         _lhsOattrs :: Map String (Maybe NonLocalAttr)
         _lhsOattrs = rule573  ()
         __result_ = T_HsToken_vOut31 _lhsOattrs _lhsOtok
         in __result_ )
     in C_HsToken_s32 v31
   {-# INLINE rule572 #-}
   {-# LINE 1429 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule572 = \ pos_ ->
                           {-# LINE 1429 "src-ag/ExecutionPlan2Clean.ag" #-}
                           (pos_, "")
                           {-# LINE 4452 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule573 #-}
   rule573 = \  (_ :: ()) ->
     Map.empty

-- HsTokens ----------------------------------------------------
-- wrapper
data Inh_HsTokens  = Inh_HsTokens { options_Inh_HsTokens :: (Options) }
data Syn_HsTokens  = Syn_HsTokens { tks_Syn_HsTokens :: ([(Pos,String)]) }
{-# INLINABLE wrap_HsTokens #-}
wrap_HsTokens :: T_HsTokens  -> Inh_HsTokens  -> (Syn_HsTokens )
wrap_HsTokens (T_HsTokens act) (Inh_HsTokens _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg34 = T_HsTokens_vIn34 _lhsIoptions
        (T_HsTokens_vOut34 _lhsOtks) <- return (inv_HsTokens_s35 sem arg34)
        return (Syn_HsTokens _lhsOtks)
   )

-- cata
{-# NOINLINE sem_HsTokens #-}
sem_HsTokens :: HsTokens  -> T_HsTokens 
sem_HsTokens list = Prelude.foldr sem_HsTokens_Cons sem_HsTokens_Nil (Prelude.map sem_HsToken list)

-- semantic domain
newtype T_HsTokens  = T_HsTokens {
                                 attach_T_HsTokens :: Identity (T_HsTokens_s35 )
                                 }
newtype T_HsTokens_s35  = C_HsTokens_s35 {
                                         inv_HsTokens_s35 :: (T_HsTokens_v34 )
                                         }
data T_HsTokens_s36  = C_HsTokens_s36
type T_HsTokens_v34  = (T_HsTokens_vIn34 ) -> (T_HsTokens_vOut34 )
data T_HsTokens_vIn34  = T_HsTokens_vIn34 (Options)
data T_HsTokens_vOut34  = T_HsTokens_vOut34 ([(Pos,String)])
{-# NOINLINE sem_HsTokens_Cons #-}
sem_HsTokens_Cons :: T_HsToken  -> T_HsTokens  -> T_HsTokens 
sem_HsTokens_Cons arg_hd_ arg_tl_ = T_HsTokens (return st35) where
   {-# NOINLINE st35 #-}
   st35 = let
      v34 :: T_HsTokens_v34 
      v34 = \ (T_HsTokens_vIn34 _lhsIoptions) -> ( let
         _hdX32 = Control.Monad.Identity.runIdentity (attach_T_HsToken (arg_hd_))
         _tlX35 = Control.Monad.Identity.runIdentity (attach_T_HsTokens (arg_tl_))
         (T_HsToken_vOut31 _hdIattrs _hdItok) = inv_HsToken_s32 _hdX32 (T_HsToken_vIn31 _hdOoptions)
         (T_HsTokens_vOut34 _tlItks) = inv_HsTokens_s35 _tlX35 (T_HsTokens_vIn34 _tlOoptions)
         _lhsOtks :: [(Pos,String)]
         _lhsOtks = rule574 _hdItok _tlItks
         _hdOoptions = rule575 _lhsIoptions
         _tlOoptions = rule576 _lhsIoptions
         __result_ = T_HsTokens_vOut34 _lhsOtks
         in __result_ )
     in C_HsTokens_s35 v34
   {-# INLINE rule574 #-}
   {-# LINE 1408 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule574 = \ ((_hdItok) :: (Pos,String)) ((_tlItks) :: [(Pos,String)]) ->
                     {-# LINE 1408 "src-ag/ExecutionPlan2Clean.ag" #-}
                     _hdItok : _tlItks
                     {-# LINE 4510 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule575 #-}
   rule575 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule576 #-}
   rule576 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
{-# NOINLINE sem_HsTokens_Nil #-}
sem_HsTokens_Nil ::  T_HsTokens 
sem_HsTokens_Nil  = T_HsTokens (return st35) where
   {-# NOINLINE st35 #-}
   st35 = let
      v34 :: T_HsTokens_v34 
      v34 = \ (T_HsTokens_vIn34 _lhsIoptions) -> ( let
         _lhsOtks :: [(Pos,String)]
         _lhsOtks = rule577  ()
         __result_ = T_HsTokens_vOut34 _lhsOtks
         in __result_ )
     in C_HsTokens_s35 v34
   {-# INLINE rule577 #-}
   {-# LINE 1409 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule577 = \  (_ :: ()) ->
                     {-# LINE 1409 "src-ag/ExecutionPlan2Clean.ag" #-}
                     []
                     {-# LINE 4534 "src-generated/ExecutionPlan2Clean.hs" #-}

-- HsTokensRoot ------------------------------------------------
-- wrapper
data Inh_HsTokensRoot  = Inh_HsTokensRoot { options_Inh_HsTokensRoot :: (Options) }
data Syn_HsTokensRoot  = Syn_HsTokensRoot {  }
{-# INLINABLE wrap_HsTokensRoot #-}
wrap_HsTokensRoot :: T_HsTokensRoot  -> Inh_HsTokensRoot  -> (Syn_HsTokensRoot )
wrap_HsTokensRoot (T_HsTokensRoot act) (Inh_HsTokensRoot _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg37 = T_HsTokensRoot_vIn37 _lhsIoptions
        (T_HsTokensRoot_vOut37 ) <- return (inv_HsTokensRoot_s38 sem arg37)
        return (Syn_HsTokensRoot )
   )

-- cata
{-# INLINE sem_HsTokensRoot #-}
sem_HsTokensRoot :: HsTokensRoot  -> T_HsTokensRoot 
sem_HsTokensRoot ( HsTokensRoot tokens_ ) = sem_HsTokensRoot_HsTokensRoot ( sem_HsTokens tokens_ )

-- semantic domain
newtype T_HsTokensRoot  = T_HsTokensRoot {
                                         attach_T_HsTokensRoot :: Identity (T_HsTokensRoot_s38 )
                                         }
newtype T_HsTokensRoot_s38  = C_HsTokensRoot_s38 {
                                                 inv_HsTokensRoot_s38 :: (T_HsTokensRoot_v37 )
                                                 }
data T_HsTokensRoot_s39  = C_HsTokensRoot_s39
type T_HsTokensRoot_v37  = (T_HsTokensRoot_vIn37 ) -> (T_HsTokensRoot_vOut37 )
data T_HsTokensRoot_vIn37  = T_HsTokensRoot_vIn37 (Options)
data T_HsTokensRoot_vOut37  = T_HsTokensRoot_vOut37 
{-# NOINLINE sem_HsTokensRoot_HsTokensRoot #-}
sem_HsTokensRoot_HsTokensRoot :: T_HsTokens  -> T_HsTokensRoot 
sem_HsTokensRoot_HsTokensRoot arg_tokens_ = T_HsTokensRoot (return st38) where
   {-# NOINLINE st38 #-}
   st38 = let
      v37 :: T_HsTokensRoot_v37 
      v37 = \ (T_HsTokensRoot_vIn37 _lhsIoptions) -> ( let
         _tokensX35 = Control.Monad.Identity.runIdentity (attach_T_HsTokens (arg_tokens_))
         (T_HsTokens_vOut34 _tokensItks) = inv_HsTokens_s35 _tokensX35 (T_HsTokens_vIn34 _tokensOoptions)
         _tokensOoptions = rule578 _lhsIoptions
         __result_ = T_HsTokensRoot_vOut37 
         in __result_ )
     in C_HsTokensRoot_s38 v37
   {-# INLINE rule578 #-}
   rule578 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions

-- Pattern -----------------------------------------------------
-- wrapper
data Inh_Pattern  = Inh_Pattern { allInhmap_Inh_Pattern :: (Map NontermIdent Attributes), allSynmap_Inh_Pattern :: (Map NontermIdent Attributes), anyLazyKind_Inh_Pattern :: (Bool), inhmap_Inh_Pattern :: (Attributes), localAttrTypes_Inh_Pattern :: (Map Identifier Type), options_Inh_Pattern :: (Options), synmap_Inh_Pattern :: (Attributes) }
data Syn_Pattern  = Syn_Pattern { attrTypes_Syn_Pattern :: (PP_Doc), attrs_Syn_Pattern :: (Set String), copy_Syn_Pattern :: (Pattern), isUnderscore_Syn_Pattern :: (Bool), sem_lhs_Syn_Pattern :: ( PP_Doc ) }
{-# INLINABLE wrap_Pattern #-}
wrap_Pattern :: T_Pattern  -> Inh_Pattern  -> (Syn_Pattern )
wrap_Pattern (T_Pattern act) (Inh_Pattern _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg40 = T_Pattern_vIn40 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap
        (T_Pattern_vOut40 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs) <- return (inv_Pattern_s41 sem arg40)
        return (Syn_Pattern _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs)
   )

-- cata
{-# NOINLINE sem_Pattern #-}
sem_Pattern :: Pattern  -> T_Pattern 
sem_Pattern ( Constr name_ pats_ ) = sem_Pattern_Constr name_ ( sem_Patterns pats_ )
sem_Pattern ( Product pos_ pats_ ) = sem_Pattern_Product pos_ ( sem_Patterns pats_ )
sem_Pattern ( Alias field_ attr_ pat_ ) = sem_Pattern_Alias field_ attr_ ( sem_Pattern pat_ )
sem_Pattern ( Irrefutable pat_ ) = sem_Pattern_Irrefutable ( sem_Pattern pat_ )
sem_Pattern ( Underscore pos_ ) = sem_Pattern_Underscore pos_

-- semantic domain
newtype T_Pattern  = T_Pattern {
                               attach_T_Pattern :: Identity (T_Pattern_s41 )
                               }
newtype T_Pattern_s41  = C_Pattern_s41 {
                                       inv_Pattern_s41 :: (T_Pattern_v40 )
                                       }
data T_Pattern_s42  = C_Pattern_s42
type T_Pattern_v40  = (T_Pattern_vIn40 ) -> (T_Pattern_vOut40 )
data T_Pattern_vIn40  = T_Pattern_vIn40 (Map NontermIdent Attributes) (Map NontermIdent Attributes) (Bool) (Attributes) (Map Identifier Type) (Options) (Attributes)
data T_Pattern_vOut40  = T_Pattern_vOut40 (PP_Doc) (Set String) (Pattern) (Bool) ( PP_Doc )
{-# NOINLINE sem_Pattern_Constr #-}
sem_Pattern_Constr :: (ConstructorIdent) -> T_Patterns  -> T_Pattern 
sem_Pattern_Constr arg_name_ arg_pats_ = T_Pattern (return st41) where
   {-# NOINLINE st41 #-}
   st41 = let
      v40 :: T_Pattern_v40 
      v40 = \ (T_Pattern_vIn40 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _patsX44 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_))
         (T_Patterns_vOut43 _patsIattrTypes _patsIattrs _patsIcopy _patsIsem_lhs) = inv_Patterns_s44 _patsX44 (T_Patterns_vIn43 _patsOallInhmap _patsOallSynmap _patsOanyLazyKind _patsOinhmap _patsOlocalAttrTypes _patsOoptions _patsOsynmap)
         _lhsOsem_lhs ::  PP_Doc 
         _lhsOsem_lhs = rule579 _addbang1 _patsIsem_lhs arg_name_
         _lhsOisUnderscore :: Bool
         _lhsOisUnderscore = rule580  ()
         _addbang = rule581 _lhsIoptions
         _addbang1 = rule582 _addbang _lhsIanyLazyKind
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule583 _patsIattrTypes
         _lhsOattrs :: Set String
         _lhsOattrs = rule584 _patsIattrs
         _copy = rule585 _patsIcopy arg_name_
         _lhsOcopy :: Pattern
         _lhsOcopy = rule586 _copy
         _patsOallInhmap = rule587 _lhsIallInhmap
         _patsOallSynmap = rule588 _lhsIallSynmap
         _patsOanyLazyKind = rule589 _lhsIanyLazyKind
         _patsOinhmap = rule590 _lhsIinhmap
         _patsOlocalAttrTypes = rule591 _lhsIlocalAttrTypes
         _patsOoptions = rule592 _lhsIoptions
         _patsOsynmap = rule593 _lhsIsynmap
         __result_ = T_Pattern_vOut40 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs
         in __result_ )
     in C_Pattern_s41 v40
   {-# INLINE rule579 #-}
   {-# LINE 1134 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule579 = \ _addbang1 ((_patsIsem_lhs) :: [PP_Doc]) name_ ->
                                  {-# LINE 1134 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  _addbang1     $ pp_parens $ name_ >#< hv_sp _patsIsem_lhs
                                  {-# LINE 4654 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule580 #-}
   {-# LINE 1141 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule580 = \  (_ :: ()) ->
                                    {-# LINE 1141 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    False
                                    {-# LINE 4660 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule581 #-}
   {-# LINE 1571 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule581 = \ ((_lhsIoptions) :: Options) ->
                                                     {-# LINE 1571 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                     {-# LINE 4666 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule582 #-}
   {-# LINE 1576 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule582 = \ _addbang ((_lhsIanyLazyKind) :: Bool) ->
                                                     {-# LINE 1576 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     if _lhsIanyLazyKind then id else _addbang
                                                     {-# LINE 4672 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule583 #-}
   rule583 = \ ((_patsIattrTypes) :: PP_Doc) ->
     _patsIattrTypes
   {-# INLINE rule584 #-}
   rule584 = \ ((_patsIattrs) :: Set String) ->
     _patsIattrs
   {-# INLINE rule585 #-}
   rule585 = \ ((_patsIcopy) :: Patterns) name_ ->
     Constr name_ _patsIcopy
   {-# INLINE rule586 #-}
   rule586 = \ _copy ->
     _copy
   {-# INLINE rule587 #-}
   rule587 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule588 #-}
   rule588 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule589 #-}
   rule589 = \ ((_lhsIanyLazyKind) :: Bool) ->
     _lhsIanyLazyKind
   {-# INLINE rule590 #-}
   rule590 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule591 #-}
   rule591 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule592 #-}
   rule592 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule593 #-}
   rule593 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
{-# NOINLINE sem_Pattern_Product #-}
sem_Pattern_Product :: (Pos) -> T_Patterns  -> T_Pattern 
sem_Pattern_Product arg_pos_ arg_pats_ = T_Pattern (return st41) where
   {-# NOINLINE st41 #-}
   st41 = let
      v40 :: T_Pattern_v40 
      v40 = \ (T_Pattern_vIn40 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _patsX44 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_))
         (T_Patterns_vOut43 _patsIattrTypes _patsIattrs _patsIcopy _patsIsem_lhs) = inv_Patterns_s44 _patsX44 (T_Patterns_vIn43 _patsOallInhmap _patsOallSynmap _patsOanyLazyKind _patsOinhmap _patsOlocalAttrTypes _patsOoptions _patsOsynmap)
         _lhsOsem_lhs ::  PP_Doc 
         _lhsOsem_lhs = rule594 _addbang1 _patsIsem_lhs
         _lhsOisUnderscore :: Bool
         _lhsOisUnderscore = rule595  ()
         _addbang = rule596 _lhsIoptions
         _addbang1 = rule597 _addbang _lhsIanyLazyKind
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule598 _patsIattrTypes
         _lhsOattrs :: Set String
         _lhsOattrs = rule599 _patsIattrs
         _copy = rule600 _patsIcopy arg_pos_
         _lhsOcopy :: Pattern
         _lhsOcopy = rule601 _copy
         _patsOallInhmap = rule602 _lhsIallInhmap
         _patsOallSynmap = rule603 _lhsIallSynmap
         _patsOanyLazyKind = rule604 _lhsIanyLazyKind
         _patsOinhmap = rule605 _lhsIinhmap
         _patsOlocalAttrTypes = rule606 _lhsIlocalAttrTypes
         _patsOoptions = rule607 _lhsIoptions
         _patsOsynmap = rule608 _lhsIsynmap
         __result_ = T_Pattern_vOut40 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs
         in __result_ )
     in C_Pattern_s41 v40
   {-# INLINE rule594 #-}
   {-# LINE 1133 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule594 = \ _addbang1 ((_patsIsem_lhs) :: [PP_Doc]) ->
                                  {-# LINE 1133 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  _addbang1     $ pp_block "(" ")" "," _patsIsem_lhs
                                  {-# LINE 4743 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule595 #-}
   {-# LINE 1142 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule595 = \  (_ :: ()) ->
                                    {-# LINE 1142 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    False
                                    {-# LINE 4749 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule596 #-}
   {-# LINE 1571 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule596 = \ ((_lhsIoptions) :: Options) ->
                                                     {-# LINE 1571 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                     {-# LINE 4755 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule597 #-}
   {-# LINE 1576 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule597 = \ _addbang ((_lhsIanyLazyKind) :: Bool) ->
                                                     {-# LINE 1576 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     if _lhsIanyLazyKind then id else _addbang
                                                     {-# LINE 4761 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule598 #-}
   rule598 = \ ((_patsIattrTypes) :: PP_Doc) ->
     _patsIattrTypes
   {-# INLINE rule599 #-}
   rule599 = \ ((_patsIattrs) :: Set String) ->
     _patsIattrs
   {-# INLINE rule600 #-}
   rule600 = \ ((_patsIcopy) :: Patterns) pos_ ->
     Product pos_ _patsIcopy
   {-# INLINE rule601 #-}
   rule601 = \ _copy ->
     _copy
   {-# INLINE rule602 #-}
   rule602 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule603 #-}
   rule603 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule604 #-}
   rule604 = \ ((_lhsIanyLazyKind) :: Bool) ->
     _lhsIanyLazyKind
   {-# INLINE rule605 #-}
   rule605 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule606 #-}
   rule606 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule607 #-}
   rule607 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule608 #-}
   rule608 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
{-# NOINLINE sem_Pattern_Alias #-}
sem_Pattern_Alias :: (Identifier) -> (Identifier) -> T_Pattern  -> T_Pattern 
sem_Pattern_Alias arg_field_ arg_attr_ arg_pat_ = T_Pattern (return st41) where
   {-# NOINLINE st41 #-}
   st41 = let
      v40 :: T_Pattern_v40 
      v40 = \ (T_Pattern_vIn40 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _patX41 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_))
         (T_Pattern_vOut40 _patIattrTypes _patIattrs _patIcopy _patIisUnderscore _patIsem_lhs) = inv_Pattern_s41 _patX41 (T_Pattern_vIn40 _patOallInhmap _patOallSynmap _patOanyLazyKind _patOinhmap _patOlocalAttrTypes _patOoptions _patOsynmap)
         _varPat = rule609 _lhsIoptions arg_attr_ arg_field_
         _patExpr = rule610 _patIisUnderscore _patIsem_lhs _varPat
         _lhsOsem_lhs ::  PP_Doc 
         _lhsOsem_lhs = rule611 _addbang1 _patExpr
         _lhsOisUnderscore :: Bool
         _lhsOisUnderscore = rule612  ()
         _lhsOattrs :: Set String
         _lhsOattrs = rule613 _lhsIoptions _patIattrs arg_attr_ arg_field_
         _mbTp = rule614 _lhsIlocalAttrTypes _lhsIsynmap arg_attr_ arg_field_
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule615  ()
         _addbang = rule616 _lhsIoptions
         _addbang1 = rule617 _addbang _lhsIanyLazyKind
         _copy = rule618 _patIcopy arg_attr_ arg_field_
         _lhsOcopy :: Pattern
         _lhsOcopy = rule619 _copy
         _patOallInhmap = rule620 _lhsIallInhmap
         _patOallSynmap = rule621 _lhsIallSynmap
         _patOanyLazyKind = rule622 _lhsIanyLazyKind
         _patOinhmap = rule623 _lhsIinhmap
         _patOlocalAttrTypes = rule624 _lhsIlocalAttrTypes
         _patOoptions = rule625 _lhsIoptions
         _patOsynmap = rule626 _lhsIsynmap
         __result_ = T_Pattern_vOut40 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs
         in __result_ )
     in C_Pattern_s41 v40
   {-# INLINE rule609 #-}
   {-# LINE 1128 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule609 = \ ((_lhsIoptions) :: Options) attr_ field_ ->
                                  {-# LINE 1128 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  text $ attrname _lhsIoptions False field_ attr_
                                  {-# LINE 4835 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule610 #-}
   {-# LINE 1129 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule610 = \ ((_patIisUnderscore) :: Bool) ((_patIsem_lhs) ::  PP_Doc ) _varPat ->
                                  {-# LINE 1129 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  if _patIisUnderscore
                                  then _varPat
                                  else _varPat     >|< "@" >|< _patIsem_lhs
                                  {-# LINE 4843 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule611 #-}
   {-# LINE 1132 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule611 = \ _addbang1 _patExpr ->
                                  {-# LINE 1132 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  _addbang1     _patExpr
                                  {-# LINE 4849 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule612 #-}
   {-# LINE 1143 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule612 = \  (_ :: ()) ->
                                    {-# LINE 1143 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    False
                                    {-# LINE 4855 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule613 #-}
   {-# LINE 1149 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule613 = \ ((_lhsIoptions) :: Options) ((_patIattrs) :: Set String) attr_ field_ ->
                    {-# LINE 1149 "src-ag/ExecutionPlan2Clean.ag" #-}
                    Set.insert (attrname _lhsIoptions False field_ attr_) _patIattrs
                    {-# LINE 4861 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule614 #-}
   {-# LINE 1154 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule614 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ((_lhsIsynmap) :: Attributes) attr_ field_ ->
                    {-# LINE 1154 "src-ag/ExecutionPlan2Clean.ag" #-}
                    if field_ == _LHS
                    then Map.lookup attr_ _lhsIsynmap
                    else if field_ == _LOC
                         then Map.lookup attr_ _lhsIlocalAttrTypes
                         else Nothing
                    {-# LINE 4871 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule615 #-}
   {-# LINE 1159 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule615 = \  (_ :: ()) ->
                    {-# LINE 1159 "src-ag/ExecutionPlan2Clean.ag" #-}
                    empty
                    {-# LINE 4877 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule616 #-}
   {-# LINE 1571 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule616 = \ ((_lhsIoptions) :: Options) ->
                                                     {-# LINE 1571 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                     {-# LINE 4883 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule617 #-}
   {-# LINE 1576 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule617 = \ _addbang ((_lhsIanyLazyKind) :: Bool) ->
                                                     {-# LINE 1576 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     if _lhsIanyLazyKind then id else _addbang
                                                     {-# LINE 4889 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule618 #-}
   rule618 = \ ((_patIcopy) :: Pattern) attr_ field_ ->
     Alias field_ attr_ _patIcopy
   {-# INLINE rule619 #-}
   rule619 = \ _copy ->
     _copy
   {-# INLINE rule620 #-}
   rule620 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule621 #-}
   rule621 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule622 #-}
   rule622 = \ ((_lhsIanyLazyKind) :: Bool) ->
     _lhsIanyLazyKind
   {-# INLINE rule623 #-}
   rule623 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule624 #-}
   rule624 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule625 #-}
   rule625 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule626 #-}
   rule626 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
{-# NOINLINE sem_Pattern_Irrefutable #-}
sem_Pattern_Irrefutable :: T_Pattern  -> T_Pattern 
sem_Pattern_Irrefutable arg_pat_ = T_Pattern (return st41) where
   {-# NOINLINE st41 #-}
   st41 = let
      v40 :: T_Pattern_v40 
      v40 = \ (T_Pattern_vIn40 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _patX41 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_))
         (T_Pattern_vOut40 _patIattrTypes _patIattrs _patIcopy _patIisUnderscore _patIsem_lhs) = inv_Pattern_s41 _patX41 (T_Pattern_vIn40 _patOallInhmap _patOallSynmap _patOanyLazyKind _patOinhmap _patOlocalAttrTypes _patOoptions _patOsynmap)
         _lhsOsem_lhs ::  PP_Doc 
         _lhsOsem_lhs = rule627 _patIsem_lhs
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule628 _patIattrTypes
         _lhsOattrs :: Set String
         _lhsOattrs = rule629 _patIattrs
         _copy = rule630 _patIcopy
         _lhsOcopy :: Pattern
         _lhsOcopy = rule631 _copy
         _lhsOisUnderscore :: Bool
         _lhsOisUnderscore = rule632 _patIisUnderscore
         _patOallInhmap = rule633 _lhsIallInhmap
         _patOallSynmap = rule634 _lhsIallSynmap
         _patOanyLazyKind = rule635 _lhsIanyLazyKind
         _patOinhmap = rule636 _lhsIinhmap
         _patOlocalAttrTypes = rule637 _lhsIlocalAttrTypes
         _patOoptions = rule638 _lhsIoptions
         _patOsynmap = rule639 _lhsIsynmap
         __result_ = T_Pattern_vOut40 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs
         in __result_ )
     in C_Pattern_s41 v40
   {-# INLINE rule627 #-}
   {-# LINE 1136 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule627 = \ ((_patIsem_lhs) ::  PP_Doc ) ->
                                  {-# LINE 1136 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  text "~" >|< pp_parens _patIsem_lhs
                                  {-# LINE 4952 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule628 #-}
   rule628 = \ ((_patIattrTypes) :: PP_Doc) ->
     _patIattrTypes
   {-# INLINE rule629 #-}
   rule629 = \ ((_patIattrs) :: Set String) ->
     _patIattrs
   {-# INLINE rule630 #-}
   rule630 = \ ((_patIcopy) :: Pattern) ->
     Irrefutable _patIcopy
   {-# INLINE rule631 #-}
   rule631 = \ _copy ->
     _copy
   {-# INLINE rule632 #-}
   rule632 = \ ((_patIisUnderscore) :: Bool) ->
     _patIisUnderscore
   {-# INLINE rule633 #-}
   rule633 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule634 #-}
   rule634 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule635 #-}
   rule635 = \ ((_lhsIanyLazyKind) :: Bool) ->
     _lhsIanyLazyKind
   {-# INLINE rule636 #-}
   rule636 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule637 #-}
   rule637 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule638 #-}
   rule638 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule639 #-}
   rule639 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
{-# NOINLINE sem_Pattern_Underscore #-}
sem_Pattern_Underscore :: (Pos) -> T_Pattern 
sem_Pattern_Underscore arg_pos_ = T_Pattern (return st41) where
   {-# NOINLINE st41 #-}
   st41 = let
      v40 :: T_Pattern_v40 
      v40 = \ (T_Pattern_vIn40 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _lhsOsem_lhs ::  PP_Doc 
         _lhsOsem_lhs = rule640  ()
         _lhsOisUnderscore :: Bool
         _lhsOisUnderscore = rule641  ()
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule642  ()
         _lhsOattrs :: Set String
         _lhsOattrs = rule643  ()
         _copy = rule644 arg_pos_
         _lhsOcopy :: Pattern
         _lhsOcopy = rule645 _copy
         __result_ = T_Pattern_vOut40 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOisUnderscore _lhsOsem_lhs
         in __result_ )
     in C_Pattern_s41 v40
   {-# INLINE rule640 #-}
   {-# LINE 1135 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule640 = \  (_ :: ()) ->
                                  {-# LINE 1135 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  text "_"
                                  {-# LINE 5015 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule641 #-}
   {-# LINE 1144 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule641 = \  (_ :: ()) ->
                                    {-# LINE 1144 "src-ag/ExecutionPlan2Clean.ag" #-}
                                    True
                                    {-# LINE 5021 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule642 #-}
   rule642 = \  (_ :: ()) ->
     empty
   {-# INLINE rule643 #-}
   rule643 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule644 #-}
   rule644 = \ pos_ ->
     Underscore pos_
   {-# INLINE rule645 #-}
   rule645 = \ _copy ->
     _copy

-- Patterns ----------------------------------------------------
-- wrapper
data Inh_Patterns  = Inh_Patterns { allInhmap_Inh_Patterns :: (Map NontermIdent Attributes), allSynmap_Inh_Patterns :: (Map NontermIdent Attributes), anyLazyKind_Inh_Patterns :: (Bool), inhmap_Inh_Patterns :: (Attributes), localAttrTypes_Inh_Patterns :: (Map Identifier Type), options_Inh_Patterns :: (Options), synmap_Inh_Patterns :: (Attributes) }
data Syn_Patterns  = Syn_Patterns { attrTypes_Syn_Patterns :: (PP_Doc), attrs_Syn_Patterns :: (Set String), copy_Syn_Patterns :: (Patterns), sem_lhs_Syn_Patterns :: ([PP_Doc]) }
{-# INLINABLE wrap_Patterns #-}
wrap_Patterns :: T_Patterns  -> Inh_Patterns  -> (Syn_Patterns )
wrap_Patterns (T_Patterns act) (Inh_Patterns _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg43 = T_Patterns_vIn43 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap
        (T_Patterns_vOut43 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOsem_lhs) <- return (inv_Patterns_s44 sem arg43)
        return (Syn_Patterns _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOsem_lhs)
   )

-- cata
{-# NOINLINE sem_Patterns #-}
sem_Patterns :: Patterns  -> T_Patterns 
sem_Patterns list = Prelude.foldr sem_Patterns_Cons sem_Patterns_Nil (Prelude.map sem_Pattern list)

-- semantic domain
newtype T_Patterns  = T_Patterns {
                                 attach_T_Patterns :: Identity (T_Patterns_s44 )
                                 }
newtype T_Patterns_s44  = C_Patterns_s44 {
                                         inv_Patterns_s44 :: (T_Patterns_v43 )
                                         }
data T_Patterns_s45  = C_Patterns_s45
type T_Patterns_v43  = (T_Patterns_vIn43 ) -> (T_Patterns_vOut43 )
data T_Patterns_vIn43  = T_Patterns_vIn43 (Map NontermIdent Attributes) (Map NontermIdent Attributes) (Bool) (Attributes) (Map Identifier Type) (Options) (Attributes)
data T_Patterns_vOut43  = T_Patterns_vOut43 (PP_Doc) (Set String) (Patterns) ([PP_Doc])
{-# NOINLINE sem_Patterns_Cons #-}
sem_Patterns_Cons :: T_Pattern  -> T_Patterns  -> T_Patterns 
sem_Patterns_Cons arg_hd_ arg_tl_ = T_Patterns (return st44) where
   {-# NOINLINE st44 #-}
   st44 = let
      v43 :: T_Patterns_v43 
      v43 = \ (T_Patterns_vIn43 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _hdX41 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_))
         _tlX44 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_))
         (T_Pattern_vOut40 _hdIattrTypes _hdIattrs _hdIcopy _hdIisUnderscore _hdIsem_lhs) = inv_Pattern_s41 _hdX41 (T_Pattern_vIn40 _hdOallInhmap _hdOallSynmap _hdOanyLazyKind _hdOinhmap _hdOlocalAttrTypes _hdOoptions _hdOsynmap)
         (T_Patterns_vOut43 _tlIattrTypes _tlIattrs _tlIcopy _tlIsem_lhs) = inv_Patterns_s44 _tlX44 (T_Patterns_vIn43 _tlOallInhmap _tlOallSynmap _tlOanyLazyKind _tlOinhmap _tlOlocalAttrTypes _tlOoptions _tlOsynmap)
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule646 _hdIattrTypes _tlIattrTypes
         _lhsOattrs :: Set String
         _lhsOattrs = rule647 _hdIattrs _tlIattrs
         _lhsOsem_lhs :: [PP_Doc]
         _lhsOsem_lhs = rule648 _hdIsem_lhs _tlIsem_lhs
         _copy = rule649 _hdIcopy _tlIcopy
         _lhsOcopy :: Patterns
         _lhsOcopy = rule650 _copy
         _hdOallInhmap = rule651 _lhsIallInhmap
         _hdOallSynmap = rule652 _lhsIallSynmap
         _hdOanyLazyKind = rule653 _lhsIanyLazyKind
         _hdOinhmap = rule654 _lhsIinhmap
         _hdOlocalAttrTypes = rule655 _lhsIlocalAttrTypes
         _hdOoptions = rule656 _lhsIoptions
         _hdOsynmap = rule657 _lhsIsynmap
         _tlOallInhmap = rule658 _lhsIallInhmap
         _tlOallSynmap = rule659 _lhsIallSynmap
         _tlOanyLazyKind = rule660 _lhsIanyLazyKind
         _tlOinhmap = rule661 _lhsIinhmap
         _tlOlocalAttrTypes = rule662 _lhsIlocalAttrTypes
         _tlOoptions = rule663 _lhsIoptions
         _tlOsynmap = rule664 _lhsIsynmap
         __result_ = T_Patterns_vOut43 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOsem_lhs
         in __result_ )
     in C_Patterns_s44 v43
   {-# INLINE rule646 #-}
   rule646 = \ ((_hdIattrTypes) :: PP_Doc) ((_tlIattrTypes) :: PP_Doc) ->
     _hdIattrTypes >-< _tlIattrTypes
   {-# INLINE rule647 #-}
   rule647 = \ ((_hdIattrs) :: Set String) ((_tlIattrs) :: Set String) ->
     _hdIattrs `Set.union` _tlIattrs
   {-# INLINE rule648 #-}
   rule648 = \ ((_hdIsem_lhs) ::  PP_Doc ) ((_tlIsem_lhs) :: [PP_Doc]) ->
     _hdIsem_lhs : _tlIsem_lhs
   {-# INLINE rule649 #-}
   rule649 = \ ((_hdIcopy) :: Pattern) ((_tlIcopy) :: Patterns) ->
     (:) _hdIcopy _tlIcopy
   {-# INLINE rule650 #-}
   rule650 = \ _copy ->
     _copy
   {-# INLINE rule651 #-}
   rule651 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule652 #-}
   rule652 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule653 #-}
   rule653 = \ ((_lhsIanyLazyKind) :: Bool) ->
     _lhsIanyLazyKind
   {-# INLINE rule654 #-}
   rule654 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule655 #-}
   rule655 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule656 #-}
   rule656 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule657 #-}
   rule657 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule658 #-}
   rule658 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule659 #-}
   rule659 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule660 #-}
   rule660 = \ ((_lhsIanyLazyKind) :: Bool) ->
     _lhsIanyLazyKind
   {-# INLINE rule661 #-}
   rule661 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule662 #-}
   rule662 = \ ((_lhsIlocalAttrTypes) :: Map Identifier Type) ->
     _lhsIlocalAttrTypes
   {-# INLINE rule663 #-}
   rule663 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule664 #-}
   rule664 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
{-# NOINLINE sem_Patterns_Nil #-}
sem_Patterns_Nil ::  T_Patterns 
sem_Patterns_Nil  = T_Patterns (return st44) where
   {-# NOINLINE st44 #-}
   st44 = let
      v43 :: T_Patterns_v43 
      v43 = \ (T_Patterns_vIn43 _lhsIallInhmap _lhsIallSynmap _lhsIanyLazyKind _lhsIinhmap _lhsIlocalAttrTypes _lhsIoptions _lhsIsynmap) -> ( let
         _lhsOattrTypes :: PP_Doc
         _lhsOattrTypes = rule665  ()
         _lhsOattrs :: Set String
         _lhsOattrs = rule666  ()
         _lhsOsem_lhs :: [PP_Doc]
         _lhsOsem_lhs = rule667  ()
         _copy = rule668  ()
         _lhsOcopy :: Patterns
         _lhsOcopy = rule669 _copy
         __result_ = T_Patterns_vOut43 _lhsOattrTypes _lhsOattrs _lhsOcopy _lhsOsem_lhs
         in __result_ )
     in C_Patterns_s44 v43
   {-# INLINE rule665 #-}
   rule665 = \  (_ :: ()) ->
     empty
   {-# INLINE rule666 #-}
   rule666 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule667 #-}
   rule667 = \  (_ :: ()) ->
     []
   {-# INLINE rule668 #-}
   rule668 = \  (_ :: ()) ->
     []
   {-# INLINE rule669 #-}
   rule669 = \ _copy ->
     _copy

-- Visit -------------------------------------------------------
-- wrapper
data Inh_Visit  = Inh_Visit { allFromToStates_Inh_Visit :: (Map VisitIdentifier (Int,Int)), allInhmap_Inh_Visit :: (Map NontermIdent Attributes), allInitStates_Inh_Visit :: (Map NontermIdent Int), allSynmap_Inh_Visit :: (Map NontermIdent Attributes), allVisitKinds_Inh_Visit :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_Visit :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), allintramap_Inh_Visit :: (Map StateIdentifier (Map String (Maybe NonLocalAttr))), avisitdefs_Inh_Visit :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_Visit :: (Map VisitIdentifier (Set Identifier)), childTypes_Inh_Visit :: (Map Identifier Type), childintros_Inh_Visit :: (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))), con_Inh_Visit :: (ConstructorIdent), inhmap_Inh_Visit :: (Attributes), mrules_Inh_Visit :: (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)), nextVisits_Inh_Visit :: (Map StateIdentifier StateCtx), nt_Inh_Visit :: (NontermIdent), options_Inh_Visit :: (Options), params_Inh_Visit :: ([Identifier]), prevVisits_Inh_Visit :: (Map StateIdentifier StateCtx), ruledefs_Inh_Visit :: (Map Identifier (Set String)), ruleuses_Inh_Visit :: (Map Identifier (Map String (Maybe NonLocalAttr))), synmap_Inh_Visit :: (Attributes), terminaldefs_Inh_Visit :: (Set String) }
data Syn_Visit  = Syn_Visit { allvisits_Syn_Visit :: ( VisitStateState ), childvisit_Syn_Visit :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), errors_Syn_Visit :: (Seq Error), fromToStates_Syn_Visit :: (Map VisitIdentifier (Int,Int)), intramap_Syn_Visit :: (Map StateIdentifier (Map String (Maybe NonLocalAttr))), lazyIntras_Syn_Visit :: (Set String), ruleKinds_Syn_Visit :: (Map Identifier (Set VisitKind)), ruleUsage_Syn_Visit :: (Map Identifier Int), sem_visit_Syn_Visit :: (  (StateIdentifier,Bool -> PP_Doc)  ), t_visits_Syn_Visit :: (PP_Doc), usedArgs_Syn_Visit :: (Set String), visitKinds_Syn_Visit :: (Map VisitIdentifier VisitKind), visitdefs_Syn_Visit :: (Map VisitIdentifier (Set Identifier)), visituses_Syn_Visit :: (Map VisitIdentifier (Set Identifier)) }
{-# INLINABLE wrap_Visit #-}
wrap_Visit :: T_Visit  -> Inh_Visit  -> (Syn_Visit )
wrap_Visit (T_Visit act) (Inh_Visit _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg46 = T_Visit_vIn46 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs
        (T_Visit_vOut46 _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses) <- return (inv_Visit_s47 sem arg46)
        return (Syn_Visit _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses)
   )

-- cata
{-# INLINE sem_Visit #-}
sem_Visit :: Visit  -> T_Visit 
sem_Visit ( Visit ident_ from_ to_ inh_ syn_ steps_ kind_ ) = sem_Visit_Visit ident_ from_ to_ inh_ syn_ ( sem_VisitSteps steps_ ) kind_

-- semantic domain
newtype T_Visit  = T_Visit {
                           attach_T_Visit :: Identity (T_Visit_s47 )
                           }
newtype T_Visit_s47  = C_Visit_s47 {
                                   inv_Visit_s47 :: (T_Visit_v46 )
                                   }
data T_Visit_s48  = C_Visit_s48
type T_Visit_v46  = (T_Visit_vIn46 ) -> (T_Visit_vOut46 )
data T_Visit_vIn46  = T_Visit_vIn46 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Attributes) (Map NontermIdent Int) (Map NontermIdent Attributes) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Map StateIdentifier (Map String (Maybe NonLocalAttr))) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (Map Identifier Type) (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) (ConstructorIdent) (Attributes) (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) (Map StateIdentifier StateCtx) (NontermIdent) (Options) ([Identifier]) (Map StateIdentifier StateCtx) (Map Identifier (Set String)) (Map Identifier (Map String (Maybe NonLocalAttr))) (Attributes) (Set String)
data T_Visit_vOut46  = T_Visit_vOut46 ( VisitStateState ) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Seq Error) (Map VisitIdentifier (Int,Int)) (Map StateIdentifier (Map String (Maybe NonLocalAttr))) (Set String) (Map Identifier (Set VisitKind)) (Map Identifier Int) (  (StateIdentifier,Bool -> PP_Doc)  ) (PP_Doc) (Set String) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier))
{-# NOINLINE sem_Visit_Visit #-}
sem_Visit_Visit :: (VisitIdentifier) -> (StateIdentifier) -> (StateIdentifier) -> (Set Identifier) -> (Set Identifier) -> T_VisitSteps  -> (VisitKind) -> T_Visit 
sem_Visit_Visit arg_ident_ arg_from_ arg_to_ arg_inh_ arg_syn_ arg_steps_ arg_kind_ = T_Visit (return st47) where
   {-# NOINLINE st47 #-}
   st47 = let
      v46 :: T_Visit_v46 
      v46 = \ (T_Visit_vIn46 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs) -> ( let
         _stepsX53 = Control.Monad.Identity.runIdentity (attach_T_VisitSteps (arg_steps_))
         (T_VisitSteps_vOut52 _stepsIdefs _stepsIerrors _stepsIindex _stepsIisLast _stepsIlazyIntras _stepsIruleKinds _stepsIruleUsage _stepsIsem_steps _stepsIsize _stepsIusedArgs _stepsIuses _stepsIvisitKinds) = inv_VisitSteps_s53 _stepsX53 (T_VisitSteps_vIn52 _stepsOallFromToStates _stepsOallInitStates _stepsOallVisitKinds _stepsOallchildvisit _stepsOavisitdefs _stepsOavisituses _stepsOchildTypes _stepsOchildintros _stepsOfmtMode _stepsOindex _stepsOkind _stepsOmrules _stepsOoptions _stepsOruledefs _stepsOruleuses)
         _lhsOallvisits ::  VisitStateState 
         _lhsOallvisits = rule670 arg_from_ arg_ident_ arg_to_
         _nameT_visit = rule671 _lhsInt arg_ident_
         _nameTIn_visit = rule672 _lhsInt arg_ident_
         _nameTOut_visit = rule673 _lhsInt arg_ident_
         _nameTNext_visit = rule674 _lhsInt arg_to_
         _nextVisitInfo = rule675 _lhsInextVisits arg_to_
         _typecon = rule676 _lhsIoptions arg_kind_
         _t_params = rule677 _lhsIparams
         _lhsOt_visits :: PP_Doc
         _lhsOt_visits = rule678 _addbang1 _inhpart _lhsIoptions _nameTIn_visit _nameTNext_visit _nameTOut_visit _nameT_visit _nextVisitInfo _synpart _t_params _typecon
         _inhpart = rule679 _lhsIinhmap _ppTypeList arg_inh_
         _synpart = rule680 _lhsIsynmap _ppTypeList arg_syn_
         _ppTypeList = rule681 _addbang1
         _lhsOsem_visit ::   (StateIdentifier,Bool -> PP_Doc)  
         _lhsOsem_visit = rule682 _addbang _inhpats _lhsIoptions _nameTIn_visit _stepsClosing _stepsInitial _stepsIsem_steps arg_from_ arg_ident_
         _stepsInitial = rule683 arg_kind_
         _stepsClosing = rule684 _addbang _nextStBuild _resultval arg_kind_
         _vname = rule685 arg_ident_
         _inhpats = rule686 _lhsIoptions arg_inh_
         _inhargs = rule687 _lhsIoptions arg_inh_
         _synargs = rule688 _lhsIoptions arg_syn_
         _nextargsMp = rule689 _lhsIallintramap arg_to_
         _nextargs = rule690 _nextargsMp
         _nextst = rule691 _lhsIoptions _nextargs _nextargsMp arg_to_
         _resultval = rule692 _nameTOut_visit _nextStRef _synargs
         (_nextStBuild,_nextStRef) = rule693 _addbang _nextVisitInfo _nextst
         _stepsOkind = rule694 arg_kind_
         _stepsOfmtMode = rule695 arg_kind_
         _stepsOindex = rule696  ()
         _prevVisitInfo = rule697 _lhsInextVisits arg_from_
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule698 _invokecode arg_ident_
         _invokecode = rule699 _addbang _inhargs _lhsInt _lhsIoptions _nameTIn_visit _nameTOut_visit _nextVisitInfo _prevVisitInfo arg_from_ arg_ident_ arg_kind_ arg_syn_ arg_to_
         _thisintra = rule700 _defsAsMap _nextintra _uses
         _lhsOintramap :: Map StateIdentifier (Map String (Maybe NonLocalAttr))
         _lhsOintramap = rule701 _thisintra arg_from_
         _nextintra = rule702 _lhsIallintramap arg_to_
         _uses = rule703 _lhsIoptions _stepsIuses arg_syn_
         _inhVarNms = rule704 _lhsIoptions arg_inh_
         _defs = rule705 _inhVarNms _lhsIterminaldefs _stepsIdefs
         _defsAsMap = rule706 _defs
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule707 arg_ident_ arg_syn_
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule708 arg_ident_ arg_inh_
         _lazyIntrasInh = rule709 _inhVarNms _stepsIdefs arg_kind_
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule710 _lazyIntrasInh _stepsIlazyIntras
         _addbang = rule711 _lhsIoptions
         _addbang1 = rule712 _addbang arg_kind_
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule713 arg_from_ arg_ident_ arg_to_
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule714 arg_ident_ arg_kind_
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule715 _stepsIerrors
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule716 _stepsIruleKinds
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule717 _stepsIruleUsage
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule718 _stepsIusedArgs
         _stepsOallFromToStates = rule719 _lhsIallFromToStates
         _stepsOallInitStates = rule720 _lhsIallInitStates
         _stepsOallVisitKinds = rule721 _lhsIallVisitKinds
         _stepsOallchildvisit = rule722 _lhsIallchildvisit
         _stepsOavisitdefs = rule723 _lhsIavisitdefs
         _stepsOavisituses = rule724 _lhsIavisituses
         _stepsOchildTypes = rule725 _lhsIchildTypes
         _stepsOchildintros = rule726 _lhsIchildintros
         _stepsOmrules = rule727 _lhsImrules
         _stepsOoptions = rule728 _lhsIoptions
         _stepsOruledefs = rule729 _lhsIruledefs
         _stepsOruleuses = rule730 _lhsIruleuses
         __result_ = T_Visit_vOut46 _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_Visit_s47 v46
   {-# INLINE rule670 #-}
   {-# LINE 382 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule670 = \ from_ ident_ to_ ->
                            {-# LINE 382 "src-ag/ExecutionPlan2Clean.ag" #-}
                            (ident_, from_, to_)
                            {-# LINE 5316 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule671 #-}
   {-# LINE 453 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule671 = \ ((_lhsInt) :: NontermIdent) ident_ ->
                                  {-# LINE 453 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  conNmTVisit _lhsInt ident_
                                  {-# LINE 5322 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule672 #-}
   {-# LINE 454 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule672 = \ ((_lhsInt) :: NontermIdent) ident_ ->
                                  {-# LINE 454 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  conNmTVisitIn _lhsInt ident_
                                  {-# LINE 5328 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule673 #-}
   {-# LINE 455 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule673 = \ ((_lhsInt) :: NontermIdent) ident_ ->
                                  {-# LINE 455 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  conNmTVisitOut _lhsInt ident_
                                  {-# LINE 5334 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule674 #-}
   {-# LINE 456 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule674 = \ ((_lhsInt) :: NontermIdent) to_ ->
                                  {-# LINE 456 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  conNmTNextVisit _lhsInt to_
                                  {-# LINE 5340 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule675 #-}
   {-# LINE 458 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule675 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) to_ ->
                                  {-# LINE 458 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  Map.findWithDefault ManyVis to_ _lhsInextVisits
                                  {-# LINE 5346 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule676 #-}
   {-# LINE 459 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule676 = \ ((_lhsIoptions) :: Options) kind_ ->
                                  {-# LINE 459 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  case kind_ of
                                    VisitPure _  -> empty
                                    VisitMonadic -> ppMonadType _lhsIoptions
                                  {-# LINE 5354 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule677 #-}
   {-# LINE 463 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule677 = \ ((_lhsIparams) :: [Identifier]) ->
                            {-# LINE 463 "src-ag/ExecutionPlan2Clean.ag" #-}
                            ppSpaced _lhsIparams
                            {-# LINE 5360 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule678 #-}
   {-# LINE 464 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule678 = \ _addbang1 _inhpart ((_lhsIoptions) :: Options) _nameTIn_visit _nameTNext_visit _nameTOut_visit _nameT_visit _nextVisitInfo _synpart _t_params _typecon ->
                           {-# LINE 464 "src-ag/ExecutionPlan2Clean.ag" #-}
                           "::" >#< _nameT_visit     >#< _t_params     >#< ":==" >#<
                             pp_parens (_nameTIn_visit     >#< _t_params    )
                               >#< ( if dummyTokenVisit _lhsIoptions
                                     then "->" >#< dummyType _lhsIoptions True
                                     else empty
                                   )
                               >#< "->" >#< _typecon     >#< pp_parens (_nameTOut_visit     >#< _t_params    )
                           >-< "::" >#< _nameTIn_visit     >#< _t_params     >#< "=" >#< _nameTIn_visit     >#<
                                _inhpart
                           >-< "::" >#< _nameTOut_visit     >#< _t_params     >#< "=" >#< _nameTOut_visit     >#<
                                _synpart     >#< case _nextVisitInfo     of
                                                   NoneVis    -> empty
                                                   _          -> _addbang1     $ pp_parens (_nameTNext_visit     >#< _t_params    )
                           {-# LINE 5378 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule679 #-}
   {-# LINE 478 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule679 = \ ((_lhsIinhmap) :: Attributes) _ppTypeList inh_ ->
                            {-# LINE 478 "src-ag/ExecutionPlan2Clean.ag" #-}
                            _ppTypeList     inh_ _lhsIinhmap
                            {-# LINE 5384 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule680 #-}
   {-# LINE 479 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule680 = \ ((_lhsIsynmap) :: Attributes) _ppTypeList syn_ ->
                            {-# LINE 479 "src-ag/ExecutionPlan2Clean.ag" #-}
                            _ppTypeList     syn_ _lhsIsynmap
                            {-# LINE 5390 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule681 #-}
   {-# LINE 480 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule681 = \ _addbang1 ->
                             {-# LINE 480 "src-ag/ExecutionPlan2Clean.ag" #-}
                             \s m -> ppSpaced $ map (\i -> _addbang1     $ pp_parens $ case Map.lookup i m of
                                                                                        Just tp -> ppTp tp ) $ Set.toList s
                             {-# LINE 5397 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule682 #-}
   {-# LINE 773 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule682 = \ _addbang _inhpats ((_lhsIoptions) :: Options) _nameTIn_visit _stepsClosing _stepsInitial ((_stepsIsem_steps) :: PP_Doc) from_ ident_ ->
                            {-# LINE 773 "src-ag/ExecutionPlan2Clean.ag" #-}
                            ( from_
                            , \_ ->
                                 "v" >|< ident_ >#< (_addbang     $ pp_parens (_nameTIn_visit     >#< _inhpats    )) >#< "="
                                 >#< ( if dummyTokenVisit _lhsIoptions
                                       then pp $ dummyPat _lhsIoptions True
                                       else empty
                                     )
                                 >-< indent 10 (_stepsInitial
                                 >-< indent 4 _stepsIsem_steps) >-< indent 10 _stepsClosing
                            )
                            {-# LINE 5412 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule683 #-}
   {-# LINE 791 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule683 = \ kind_ ->
                               {-# LINE 791 "src-ag/ExecutionPlan2Clean.ag" #-}
                               case kind_ of
                                 VisitPure False -> text "let"
                                 VisitPure True  -> empty
                                 VisitMonadic    -> text "do"
                               {-# LINE 5421 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule684 #-}
   {-# LINE 795 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule684 = \ _addbang _nextStBuild _resultval kind_ ->
                                {-# LINE 795 "src-ag/ExecutionPlan2Clean.ag" #-}
                                let decls =  _nextStBuild
                                             >-<  _addbang     (pp resultValName) >#< "=" >#< _resultval
                                in case kind_ of
                                     VisitPure False -> indent 4 decls
                                                        >-< "in" >#< resultValName
                                     VisitPure True  -> "let" >#< decls
                                                        >-< indent 1 ("in" >#< resultValName)
                                     VisitMonadic    -> "let" >#< decls
                                                        >-< "lift" >#< resultValName
                                {-# LINE 5435 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule685 #-}
   {-# LINE 804 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule685 = \ ident_ ->
                            {-# LINE 804 "src-ag/ExecutionPlan2Clean.ag" #-}
                            "v" >|< ident_
                            {-# LINE 5441 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule686 #-}
   {-# LINE 805 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule686 = \ ((_lhsIoptions) :: Options) inh_ ->
                            {-# LINE 805 "src-ag/ExecutionPlan2Clean.ag" #-}
                            ppSpaced $ map (\arg -> pp $ attrname _lhsIoptions True _LHS arg) $ Set.toList inh_
                            {-# LINE 5447 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule687 #-}
   {-# LINE 806 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule687 = \ ((_lhsIoptions) :: Options) inh_ ->
                            {-# LINE 806 "src-ag/ExecutionPlan2Clean.ag" #-}
                            \chn -> ppSpaced $ map (attrname _lhsIoptions False chn) $ Set.toList inh_
                            {-# LINE 5453 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule688 #-}
   {-# LINE 807 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule688 = \ ((_lhsIoptions) :: Options) syn_ ->
                            {-# LINE 807 "src-ag/ExecutionPlan2Clean.ag" #-}
                            ppSpaced $ map (\arg -> attrname _lhsIoptions False _LHS arg) $ Set.toList syn_
                            {-# LINE 5459 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule689 #-}
   {-# LINE 808 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule689 = \ ((_lhsIallintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) to_ ->
                             {-# LINE 808 "src-ag/ExecutionPlan2Clean.ag" #-}
                             maybe Map.empty id $ Map.lookup to_ _lhsIallintramap
                             {-# LINE 5465 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule690 #-}
   {-# LINE 809 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule690 = \ _nextargsMp ->
                            {-# LINE 809 "src-ag/ExecutionPlan2Clean.ag" #-}
                            ppSpaced $ Map.keys $ _nextargsMp
                            {-# LINE 5471 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule691 #-}
   {-# LINE 810 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule691 = \ ((_lhsIoptions) :: Options) _nextargs _nextargsMp to_ ->
                            {-# LINE 810 "src-ag/ExecutionPlan2Clean.ag" #-}
                            "st" >|< to_ >#< _nextargs     >#< dummyArg _lhsIoptions (Map.null _nextargsMp    )
                            {-# LINE 5477 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule692 #-}
   {-# LINE 811 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule692 = \ _nameTOut_visit _nextStRef _synargs ->
                            {-# LINE 811 "src-ag/ExecutionPlan2Clean.ag" #-}
                            _nameTOut_visit     >#< _synargs     >#< _nextStRef
                            {-# LINE 5483 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule693 #-}
   {-# LINE 813 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule693 = \ _addbang _nextVisitInfo _nextst ->
                {-# LINE 813 "src-ag/ExecutionPlan2Clean.ag" #-}
                case _nextVisitInfo     of
                  NoneVis  -> (empty, empty)
                  _        -> (_addbang     (pp nextStName) >#< "=" >#< _nextst    , pp nextStName)
                {-# LINE 5491 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule694 #-}
   {-# LINE 827 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule694 = \ kind_ ->
                                  {-# LINE 827 "src-ag/ExecutionPlan2Clean.ag" #-}
                                  kind_
                                  {-# LINE 5497 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule695 #-}
   {-# LINE 868 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule695 = \ kind_ ->
                    {-# LINE 868 "src-ag/ExecutionPlan2Clean.ag" #-}
                    case kind_ of
                      VisitPure False -> FormatLetDecl
                      VisitPure True  -> FormatLetLine
                      VisitMonadic    -> FormatDo
                    {-# LINE 5506 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule696 #-}
   {-# LINE 917 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule696 = \  (_ :: ()) ->
                                     {-# LINE 917 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     0
                                     {-# LINE 5512 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule697 #-}
   {-# LINE 1227 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule697 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) from_ ->
                           {-# LINE 1227 "src-ag/ExecutionPlan2Clean.ag" #-}
                           Map.findWithDefault ManyVis from_ _lhsInextVisits
                           {-# LINE 5518 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule698 #-}
   {-# LINE 1228 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule698 = \ _invokecode ident_ ->
                        {-# LINE 1228 "src-ag/ExecutionPlan2Clean.ag" #-}
                        Map.singleton ident_ _invokecode
                        {-# LINE 5524 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule699 #-}
   {-# LINE 1229 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule699 = \ _addbang _inhargs ((_lhsInt) :: NontermIdent) ((_lhsIoptions) :: Options) _nameTIn_visit _nameTOut_visit _nextVisitInfo _prevVisitInfo from_ ident_ kind_ syn_ to_ ->
                        {-# LINE 1229 "src-ag/ExecutionPlan2Clean.ag" #-}
                        \chn kind ->
                          if kind `compatibleKind` kind_
                          then Right $
                            let pat | isLazyKind kind_ = pat0
                                    | otherwise        = _addbang     pat0
                                pat0  = pp_parens pat1
                                pat1  = _nameTOut_visit     >#< (ppSpaced $ map (attrname _lhsIoptions True chn) $ Set.toList syn_)
                                                            >#< cont
                                cont  = case _nextVisitInfo     of
                                          NoneVis  -> empty
                                          _        -> ch1
                                ch0   = text $ stname chn from_
                                ch1   = text $ stname chn to_
                                expr  = case (kind, kind_) of
                                          (VisitPure _,  VisitPure _)  -> expr0
                                          (VisitPure _,  VisitMonadic) -> unMon _lhsIoptions >#< expr0
                                          (VisitMonadic, VisitPure _)  -> "lift" >#< expr0
                                          (VisitMonadic, VisitMonadic) -> expr0
                                expr0 = case _prevVisitInfo     of
                                          NoneVis  -> error "error: invocation of a visit from a state that has no next visits"
                                          OneVis _ -> "inv_" >|< _lhsInt >|< "_s" >|< from_ >#< ch0 >#< args
                                          ManyVis  -> "inv_" >|< _lhsInt >|< "_s" >|< from_ >#< ch0
                                                      >#< "K_" >|< _lhsInt >|< "_v" >|< ident_ >#< args
                                args  = pp_parens args0 >#< args1
                                args0 = _nameTIn_visit     >#< _inhargs     chn
                                args1 | dummyTokenVisit _lhsIoptions = pp $ dummyArg _lhsIoptions True
                                      | otherwise                    = empty
                            in (pat, expr)
                          else Left $ IncompatibleVisitKind chn ident_ kind kind_
                        {-# LINE 5558 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule700 #-}
   {-# LINE 1325 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule700 = \ _defsAsMap _nextintra _uses ->
                            {-# LINE 1325 "src-ag/ExecutionPlan2Clean.ag" #-}
                            (_uses     `Map.union` _nextintra    ) `Map.difference` _defsAsMap
                            {-# LINE 5564 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule701 #-}
   {-# LINE 1326 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule701 = \ _thisintra from_ ->
                            {-# LINE 1326 "src-ag/ExecutionPlan2Clean.ag" #-}
                            Map.singleton from_ _thisintra
                            {-# LINE 5570 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule702 #-}
   {-# LINE 1327 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule702 = \ ((_lhsIallintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) to_ ->
                            {-# LINE 1327 "src-ag/ExecutionPlan2Clean.ag" #-}
                            maybe Map.empty id $ Map.lookup to_ _lhsIallintramap
                            {-# LINE 5576 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule703 #-}
   {-# LINE 1328 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule703 = \ ((_lhsIoptions) :: Options) ((_stepsIuses) :: Map String (Maybe NonLocalAttr)) syn_ ->
                            {-# LINE 1328 "src-ag/ExecutionPlan2Clean.ag" #-}
                            let mp1 = _stepsIuses
                                mp2 = Map.fromList [ (lhsname _lhsIoptions False i, Just (AttrSyn _LHS i)) | i <- Set.elems syn_ ]
                            in mp1 `Map.union` mp2
                            {-# LINE 5584 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule704 #-}
   {-# LINE 1331 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule704 = \ ((_lhsIoptions) :: Options) inh_ ->
                            {-# LINE 1331 "src-ag/ExecutionPlan2Clean.ag" #-}
                            Set.map (lhsname _lhsIoptions True) inh_
                            {-# LINE 5590 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule705 #-}
   {-# LINE 1332 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule705 = \ _inhVarNms ((_lhsIterminaldefs) :: Set String) ((_stepsIdefs) :: Set String) ->
                            {-# LINE 1332 "src-ag/ExecutionPlan2Clean.ag" #-}
                            _stepsIdefs `Set.union` _inhVarNms     `Set.union` _lhsIterminaldefs
                            {-# LINE 5596 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule706 #-}
   {-# LINE 1333 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule706 = \ _defs ->
                            {-# LINE 1333 "src-ag/ExecutionPlan2Clean.ag" #-}
                            Map.fromList [ (a, Nothing) | a <- Set.elems _defs     ]
                            {-# LINE 5602 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule707 #-}
   {-# LINE 1357 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule707 = \ ident_ syn_ ->
                            {-# LINE 1357 "src-ag/ExecutionPlan2Clean.ag" #-}
                            Map.singleton ident_ syn_
                            {-# LINE 5608 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule708 #-}
   {-# LINE 1358 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule708 = \ ident_ inh_ ->
                            {-# LINE 1358 "src-ag/ExecutionPlan2Clean.ag" #-}
                            Map.singleton ident_ inh_
                            {-# LINE 5614 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule709 #-}
   {-# LINE 1390 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule709 = \ _inhVarNms ((_stepsIdefs) :: Set String) kind_ ->
                        {-# LINE 1390 "src-ag/ExecutionPlan2Clean.ag" #-}
                        case kind_ of
                          VisitPure False -> _inhVarNms     `Set.union` _stepsIdefs
                          _               -> Set.empty
                        {-# LINE 5622 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule710 #-}
   {-# LINE 1393 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule710 = \ _lazyIntrasInh ((_stepsIlazyIntras) :: Set String) ->
                     {-# LINE 1393 "src-ag/ExecutionPlan2Clean.ag" #-}
                     _lazyIntrasInh     `Set.union` _stepsIlazyIntras
                     {-# LINE 5628 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule711 #-}
   {-# LINE 1565 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule711 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1565 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 5634 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule712 #-}
   {-# LINE 1573 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule712 = \ _addbang kind_ ->
                                                     {-# LINE 1573 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                     if isLazyKind kind_ then id else _addbang
                                                     {-# LINE 5640 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule713 #-}
   {-# LINE 1600 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule713 = \ from_ ident_ to_ ->
                       {-# LINE 1600 "src-ag/ExecutionPlan2Clean.ag" #-}
                       Map.singleton ident_ (from_, to_)
                       {-# LINE 5646 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule714 #-}
   {-# LINE 1644 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule714 = \ ident_ kind_ ->
                     {-# LINE 1644 "src-ag/ExecutionPlan2Clean.ag" #-}
                     Map.singleton ident_ kind_
                     {-# LINE 5652 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule715 #-}
   rule715 = \ ((_stepsIerrors) :: Seq Error) ->
     _stepsIerrors
   {-# INLINE rule716 #-}
   rule716 = \ ((_stepsIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _stepsIruleKinds
   {-# INLINE rule717 #-}
   rule717 = \ ((_stepsIruleUsage) :: Map Identifier Int) ->
     _stepsIruleUsage
   {-# INLINE rule718 #-}
   rule718 = \ ((_stepsIusedArgs) :: Set String) ->
     _stepsIusedArgs
   {-# INLINE rule719 #-}
   rule719 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule720 #-}
   rule720 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule721 #-}
   rule721 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule722 #-}
   rule722 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule723 #-}
   rule723 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule724 #-}
   rule724 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule725 #-}
   rule725 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule726 #-}
   rule726 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule727 #-}
   rule727 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule728 #-}
   rule728 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule729 #-}
   rule729 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule730 #-}
   rule730 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses

-- VisitStep ---------------------------------------------------
-- wrapper
data Inh_VisitStep  = Inh_VisitStep { allFromToStates_Inh_VisitStep :: (Map VisitIdentifier (Int,Int)), allInitStates_Inh_VisitStep :: (Map NontermIdent Int), allVisitKinds_Inh_VisitStep :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_VisitStep :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), avisitdefs_Inh_VisitStep :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_VisitStep :: (Map VisitIdentifier (Set Identifier)), childTypes_Inh_VisitStep :: (Map Identifier Type), childintros_Inh_VisitStep :: (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))), fmtMode_Inh_VisitStep :: (FormatMode), index_Inh_VisitStep :: (Int), isLast_Inh_VisitStep :: (Bool), kind_Inh_VisitStep :: (VisitKind), mrules_Inh_VisitStep :: (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)), options_Inh_VisitStep :: (Options), ruledefs_Inh_VisitStep :: (Map Identifier (Set String)), ruleuses_Inh_VisitStep :: (Map Identifier (Map String (Maybe NonLocalAttr))) }
data Syn_VisitStep  = Syn_VisitStep { defs_Syn_VisitStep :: (Set String), errors_Syn_VisitStep :: (Seq Error), index_Syn_VisitStep :: (Int), isLast_Syn_VisitStep :: (Bool), lazyIntras_Syn_VisitStep :: (Set String), ruleKinds_Syn_VisitStep :: (Map Identifier (Set VisitKind)), ruleUsage_Syn_VisitStep :: (Map Identifier Int), sem_steps_Syn_VisitStep :: (PP_Doc), usedArgs_Syn_VisitStep :: (Set String), uses_Syn_VisitStep :: (Map String (Maybe NonLocalAttr)), visitKinds_Syn_VisitStep :: (Map VisitIdentifier VisitKind) }
{-# INLINABLE wrap_VisitStep #-}
wrap_VisitStep :: T_VisitStep  -> Inh_VisitStep  -> (Syn_VisitStep )
wrap_VisitStep (T_VisitStep act) (Inh_VisitStep _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg49 = T_VisitStep_vIn49 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses
        (T_VisitStep_vOut49 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds) <- return (inv_VisitStep_s50 sem arg49)
        return (Syn_VisitStep _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds)
   )

-- cata
{-# NOINLINE sem_VisitStep #-}
sem_VisitStep :: VisitStep  -> T_VisitStep 
sem_VisitStep ( Sem name_ ) = sem_VisitStep_Sem name_
sem_VisitStep ( ChildVisit child_ nonterm_ visit_ ) = sem_VisitStep_ChildVisit child_ nonterm_ visit_
sem_VisitStep ( PureGroup steps_ ordered_ ) = sem_VisitStep_PureGroup ( sem_VisitSteps steps_ ) ordered_
sem_VisitStep ( Sim steps_ ) = sem_VisitStep_Sim ( sem_VisitSteps steps_ )
sem_VisitStep ( ChildIntro child_ ) = sem_VisitStep_ChildIntro child_

-- semantic domain
newtype T_VisitStep  = T_VisitStep {
                                   attach_T_VisitStep :: Identity (T_VisitStep_s50 )
                                   }
newtype T_VisitStep_s50  = C_VisitStep_s50 {
                                           inv_VisitStep_s50 :: (T_VisitStep_v49 )
                                           }
data T_VisitStep_s51  = C_VisitStep_s51
type T_VisitStep_v49  = (T_VisitStep_vIn49 ) -> (T_VisitStep_vOut49 )
data T_VisitStep_vIn49  = T_VisitStep_vIn49 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Int) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (Map Identifier Type) (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) (FormatMode) (Int) (Bool) (VisitKind) (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) (Options) (Map Identifier (Set String)) (Map Identifier (Map String (Maybe NonLocalAttr)))
data T_VisitStep_vOut49  = T_VisitStep_vOut49 (Set String) (Seq Error) (Int) (Bool) (Set String) (Map Identifier (Set VisitKind)) (Map Identifier Int) (PP_Doc) (Set String) (Map String (Maybe NonLocalAttr)) (Map VisitIdentifier VisitKind)
{-# NOINLINE sem_VisitStep_Sem #-}
sem_VisitStep_Sem :: (Identifier) -> T_VisitStep 
sem_VisitStep_Sem arg_name_ = T_VisitStep (return st50) where
   {-# NOINLINE st50 #-}
   st50 = let
      v49 :: T_VisitStep_v49 
      v49 = \ (T_VisitStep_vIn49 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _ruleItf = rule731 _lhsImrules arg_name_
         _lhsOerrors :: Seq Error
         (_lhsOerrors,_sem_steps) = rule732 _lhsIfmtMode _lhsIkind _ruleItf
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule733 arg_name_
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule734 _lhsIkind arg_name_
         _lhsOdefs :: Set String
         _lhsOdefs = rule735 _lhsIruledefs arg_name_
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         _lhsOuses = rule736 _lhsIruleuses arg_name_
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule737  ()
         _lhsOsem_steps :: PP_Doc
         _lhsOsem_steps = rule738 _sem_steps
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule739  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule740  ()
         _lhsOindex :: Int
         _lhsOindex = rule741 _lhsIindex
         _lhsOisLast :: Bool
         _lhsOisLast = rule742 _lhsIisLast
         __result_ = T_VisitStep_vOut49 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitStep_s50 v49
   {-# INLINE rule731 #-}
   {-# LINE 836 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule731 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) name_ ->
                               {-# LINE 836 "src-ag/ExecutionPlan2Clean.ag" #-}
                               Map.findWithDefault (error $ "Rule "  ++ show name_  ++ " not found") name_ _lhsImrules
                               {-# LINE 5774 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule732 #-}
   {-# LINE 837 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule732 = \ ((_lhsIfmtMode) :: FormatMode) ((_lhsIkind) :: VisitKind) _ruleItf ->
                                               {-# LINE 837 "src-ag/ExecutionPlan2Clean.ag" #-}
                                               case _ruleItf     _lhsIkind _lhsIfmtMode of
                                                 Left e     -> (Seq.singleton e, empty)
                                                 Right stmt -> (Seq.empty, stmt)
                                               {-# LINE 5782 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule733 #-}
   {-# LINE 1278 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule733 = \ name_ ->
                                                 {-# LINE 1278 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                 Map.singleton name_ 1
                                                 {-# LINE 5788 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule734 #-}
   {-# LINE 1288 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule734 = \ ((_lhsIkind) :: VisitKind) name_ ->
                    {-# LINE 1288 "src-ag/ExecutionPlan2Clean.ag" #-}
                    Map.singleton name_ (Set.singleton _lhsIkind)
                    {-# LINE 5794 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule735 #-}
   {-# LINE 1373 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule735 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) name_ ->
                            {-# LINE 1373 "src-ag/ExecutionPlan2Clean.ag" #-}
                            maybe (error "Rule not found") id $ Map.lookup name_ _lhsIruledefs
                            {-# LINE 5800 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule736 #-}
   {-# LINE 1374 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule736 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) name_ ->
                            {-# LINE 1374 "src-ag/ExecutionPlan2Clean.ag" #-}
                            maybe (error "Rule not found") id $ Map.lookup name_ _lhsIruleuses
                            {-# LINE 5806 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule737 #-}
   rule737 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule738 #-}
   rule738 = \ _sem_steps ->
     _sem_steps
   {-# INLINE rule739 #-}
   rule739 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule740 #-}
   rule740 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule741 #-}
   rule741 = \ ((_lhsIindex) :: Int) ->
     _lhsIindex
   {-# INLINE rule742 #-}
   rule742 = \ ((_lhsIisLast) :: Bool) ->
     _lhsIisLast
{-# NOINLINE sem_VisitStep_ChildVisit #-}
sem_VisitStep_ChildVisit :: (Identifier) -> (NontermIdent) -> (VisitIdentifier) -> T_VisitStep 
sem_VisitStep_ChildVisit arg_child_ _ arg_visit_ = T_VisitStep (return st50) where
   {-# NOINLINE st50 #-}
   st50 = let
      v49 :: T_VisitStep_v49 
      v49 = \ (T_VisitStep_vIn49 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _visitItf = rule743 _lhsIallchildvisit arg_visit_
         _lhsOerrors :: Seq Error
         (_lhsOerrors,_patPP,_exprPP) = rule744 _lhsIkind _visitItf arg_child_
         _lhsOsem_steps :: PP_Doc
         _lhsOsem_steps = rule745 _exprPP _lhsIfmtMode _lhsIkind _patPP
         _convToMonad = rule746 _callKind
         _callKind = rule747 _lhsIallVisitKinds arg_visit_
         _lhsOdefs :: Set String
         _lhsOdefs = rule748 _lhsIavisitdefs _lhsIoptions _to arg_child_ arg_visit_
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         _lhsOuses = rule749 _from _lhsIavisituses _lhsIoptions arg_child_ arg_visit_
         _addbang = rule750 _lhsIoptions
         (_from,_to) = rule751 _lhsIallFromToStates arg_visit_
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule752  ()
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule753  ()
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule754  ()
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule755  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule756  ()
         _lhsOindex :: Int
         _lhsOindex = rule757 _lhsIindex
         _lhsOisLast :: Bool
         _lhsOisLast = rule758 _lhsIisLast
         __result_ = T_VisitStep_vOut49 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitStep_s50 v49
   {-# INLINE rule743 #-}
   {-# LINE 845 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule743 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) visit_ ->
                                {-# LINE 845 "src-ag/ExecutionPlan2Clean.ag" #-}
                                Map.findWithDefault (error $ "Visit " ++ show visit_ ++ " not found") visit_ _lhsIallchildvisit
                                {-# LINE 5867 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule744 #-}
   {-# LINE 846 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule744 = \ ((_lhsIkind) :: VisitKind) _visitItf child_ ->
                                                       {-# LINE 846 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                       case _visitItf     child_ _lhsIkind of
                                                         Left e           -> (Seq.singleton e, empty, empty)
                                                         Right (pat,expr) -> (Seq.empty, pat, expr)
                                                       {-# LINE 5875 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule745 #-}
   {-# LINE 850 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule745 = \ _exprPP ((_lhsIfmtMode) :: FormatMode) ((_lhsIkind) :: VisitKind) _patPP ->
                                 {-# LINE 850 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 let decl = case _lhsIkind of
                                              VisitPure _  -> _patPP     >#< "=" >#< _exprPP
                                              VisitMonadic -> _exprPP     >#< ">>= \\" >#< _patPP     >#< "->"
                                 in fmtDecl False _lhsIfmtMode decl
                                 {-# LINE 5884 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule746 #-}
   {-# LINE 854 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule746 = \ _callKind ->
                                   {-# LINE 854 "src-ag/ExecutionPlan2Clean.ag" #-}
                                   case _callKind     of
                                     VisitPure _  -> text "lift"
                                     VisitMonadic -> empty
                                   {-# LINE 5892 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule747 #-}
   {-# LINE 857 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule747 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) visit_ ->
                                 {-# LINE 857 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 Map.findWithDefault (error "visit kind should be in the map") visit_ _lhsIallVisitKinds
                                 {-# LINE 5898 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule748 #-}
   {-# LINE 1375 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule748 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ((_lhsIoptions) :: Options) _to child_ visit_ ->
                            {-# LINE 1375 "src-ag/ExecutionPlan2Clean.ag" #-}
                            Set.insert (stname child_ _to) $ maybe (error "Visit not found") (Set.map $ attrname _lhsIoptions True child_) $ Map.lookup visit_ _lhsIavisitdefs
                            {-# LINE 5904 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule749 #-}
   {-# LINE 1376 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule749 = \ _from ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ((_lhsIoptions) :: Options) child_ visit_ ->
                            {-# LINE 1376 "src-ag/ExecutionPlan2Clean.ag" #-}
                            let convert attrs = Map.fromList [ (attrname _lhsIoptions False child_ attr, Just $ mkNonLocalAttr True child_ attr) | attr <- Set.elems attrs ]
                            in Map.insert (stname child_ _from) Nothing $ convert $
                                 maybe (error "Visit not found") id $ Map.lookup visit_ _lhsIavisituses
                            {-# LINE 5912 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule750 #-}
   {-# LINE 1570 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule750 = \ ((_lhsIoptions) :: Options) ->
                                                    {-# LINE 1570 "src-ag/ExecutionPlan2Clean.ag" #-}
                                                    \x -> if bangpats _lhsIoptions then "!" >|< x else x
                                                    {-# LINE 5918 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule751 #-}
   {-# LINE 1606 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule751 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) visit_ ->
                         {-# LINE 1606 "src-ag/ExecutionPlan2Clean.ag" #-}
                         Map.findWithDefault (error "visit not in allFromToStates") visit_ _lhsIallFromToStates
                         {-# LINE 5924 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule752 #-}
   rule752 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule753 #-}
   rule753 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule754 #-}
   rule754 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule755 #-}
   rule755 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule756 #-}
   rule756 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule757 #-}
   rule757 = \ ((_lhsIindex) :: Int) ->
     _lhsIindex
   {-# INLINE rule758 #-}
   rule758 = \ ((_lhsIisLast) :: Bool) ->
     _lhsIisLast
{-# NOINLINE sem_VisitStep_PureGroup #-}
sem_VisitStep_PureGroup :: T_VisitSteps  -> (Bool) -> T_VisitStep 
sem_VisitStep_PureGroup arg_steps_ arg_ordered_ = T_VisitStep (return st50) where
   {-# NOINLINE st50 #-}
   st50 = let
      v49 :: T_VisitStep_v49 
      v49 = \ (T_VisitStep_vIn49 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _stepsX53 = Control.Monad.Identity.runIdentity (attach_T_VisitSteps (arg_steps_))
         (T_VisitSteps_vOut52 _stepsIdefs _stepsIerrors _stepsIindex _stepsIisLast _stepsIlazyIntras _stepsIruleKinds _stepsIruleUsage _stepsIsem_steps _stepsIsize _stepsIusedArgs _stepsIuses _stepsIvisitKinds) = inv_VisitSteps_s53 _stepsX53 (T_VisitSteps_vIn52 _stepsOallFromToStates _stepsOallInitStates _stepsOallVisitKinds _stepsOallchildvisit _stepsOavisitdefs _stepsOavisituses _stepsOchildTypes _stepsOchildintros _stepsOfmtMode _stepsOindex _stepsOkind _stepsOmrules _stepsOoptions _stepsOruledefs _stepsOruleuses)
         _stepsOkind = rule759 arg_ordered_
         _lhsOsem_steps :: PP_Doc
         _lhsOsem_steps = rule760 _lhsIfmtMode _stepsIsem_steps
         _stepsOfmtMode = rule761 _lhsIfmtMode
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule762 _stepsIdefs _stepsIlazyIntras arg_ordered_
         _lhsOdefs :: Set String
         _lhsOdefs = rule763 _stepsIdefs
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule764 _stepsIerrors
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule765 _stepsIruleKinds
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule766 _stepsIruleUsage
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule767 _stepsIusedArgs
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         _lhsOuses = rule768 _stepsIuses
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule769 _stepsIvisitKinds
         _lhsOindex :: Int
         _lhsOindex = rule770 _stepsIindex
         _lhsOisLast :: Bool
         _lhsOisLast = rule771 _stepsIisLast
         _stepsOallFromToStates = rule772 _lhsIallFromToStates
         _stepsOallInitStates = rule773 _lhsIallInitStates
         _stepsOallVisitKinds = rule774 _lhsIallVisitKinds
         _stepsOallchildvisit = rule775 _lhsIallchildvisit
         _stepsOavisitdefs = rule776 _lhsIavisitdefs
         _stepsOavisituses = rule777 _lhsIavisituses
         _stepsOchildTypes = rule778 _lhsIchildTypes
         _stepsOchildintros = rule779 _lhsIchildintros
         _stepsOindex = rule780 _lhsIindex
         _stepsOmrules = rule781 _lhsImrules
         _stepsOoptions = rule782 _lhsIoptions
         _stepsOruledefs = rule783 _lhsIruledefs
         _stepsOruleuses = rule784 _lhsIruleuses
         __result_ = T_VisitStep_vOut49 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitStep_s50 v49
   {-# INLINE rule759 #-}
   {-# LINE 831 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule759 = \ ordered_ ->
                 {-# LINE 831 "src-ag/ExecutionPlan2Clean.ag" #-}
                 VisitPure ordered_
                 {-# LINE 6000 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule760 #-}
   {-# LINE 859 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule760 = \ ((_lhsIfmtMode) :: FormatMode) ((_stepsIsem_steps) :: PP_Doc) ->
                                 {-# LINE 859 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 case _lhsIfmtMode of
                                   FormatDo -> "let" >#< _stepsIsem_steps
                                   _        -> _stepsIsem_steps
                                 {-# LINE 6008 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule761 #-}
   {-# LINE 874 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule761 = \ ((_lhsIfmtMode) :: FormatMode) ->
                    {-# LINE 874 "src-ag/ExecutionPlan2Clean.ag" #-}
                    case _lhsIfmtMode of
                      FormatDo      -> FormatLetDecl
                      mode          -> mode
                    {-# LINE 6016 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule762 #-}
   {-# LINE 1396 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule762 = \ ((_stepsIdefs) :: Set String) ((_stepsIlazyIntras) :: Set String) ordered_ ->
                     {-# LINE 1396 "src-ag/ExecutionPlan2Clean.ag" #-}
                     if ordered_
                     then _stepsIlazyIntras
                     else _stepsIdefs
                     {-# LINE 6024 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule763 #-}
   rule763 = \ ((_stepsIdefs) :: Set String) ->
     _stepsIdefs
   {-# INLINE rule764 #-}
   rule764 = \ ((_stepsIerrors) :: Seq Error) ->
     _stepsIerrors
   {-# INLINE rule765 #-}
   rule765 = \ ((_stepsIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _stepsIruleKinds
   {-# INLINE rule766 #-}
   rule766 = \ ((_stepsIruleUsage) :: Map Identifier Int) ->
     _stepsIruleUsage
   {-# INLINE rule767 #-}
   rule767 = \ ((_stepsIusedArgs) :: Set String) ->
     _stepsIusedArgs
   {-# INLINE rule768 #-}
   rule768 = \ ((_stepsIuses) :: Map String (Maybe NonLocalAttr)) ->
     _stepsIuses
   {-# INLINE rule769 #-}
   rule769 = \ ((_stepsIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _stepsIvisitKinds
   {-# INLINE rule770 #-}
   rule770 = \ ((_stepsIindex) :: Int) ->
     _stepsIindex
   {-# INLINE rule771 #-}
   rule771 = \ ((_stepsIisLast) :: Bool) ->
     _stepsIisLast
   {-# INLINE rule772 #-}
   rule772 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule773 #-}
   rule773 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule774 #-}
   rule774 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule775 #-}
   rule775 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule776 #-}
   rule776 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule777 #-}
   rule777 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule778 #-}
   rule778 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule779 #-}
   rule779 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule780 #-}
   rule780 = \ ((_lhsIindex) :: Int) ->
     _lhsIindex
   {-# INLINE rule781 #-}
   rule781 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule782 #-}
   rule782 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule783 #-}
   rule783 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule784 #-}
   rule784 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses
{-# NOINLINE sem_VisitStep_Sim #-}
sem_VisitStep_Sim :: T_VisitSteps  -> T_VisitStep 
sem_VisitStep_Sim arg_steps_ = T_VisitStep (return st50) where
   {-# NOINLINE st50 #-}
   st50 = let
      v49 :: T_VisitStep_v49 
      v49 = \ (T_VisitStep_vIn49 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _stepsX53 = Control.Monad.Identity.runIdentity (attach_T_VisitSteps (arg_steps_))
         (T_VisitSteps_vOut52 _stepsIdefs _stepsIerrors _stepsIindex _stepsIisLast _stepsIlazyIntras _stepsIruleKinds _stepsIruleUsage _stepsIsem_steps _stepsIsize _stepsIusedArgs _stepsIuses _stepsIvisitKinds) = inv_VisitSteps_s53 _stepsX53 (T_VisitSteps_vIn52 _stepsOallFromToStates _stepsOallInitStates _stepsOallVisitKinds _stepsOallchildvisit _stepsOavisitdefs _stepsOavisituses _stepsOchildTypes _stepsOchildintros _stepsOfmtMode _stepsOindex _stepsOkind _stepsOmrules _stepsOoptions _stepsOruledefs _stepsOruleuses)
         _lhsOsem_steps :: PP_Doc
         _lhsOsem_steps = rule785 _stepsIsem_steps
         _stepsOindex = rule786  ()
         _lhsOindex :: Int
         _lhsOindex = rule787 _lhsIindex
         _isMonadic = rule788 _lhsIkind
         _lhsOdefs :: Set String
         _lhsOdefs = rule789 _stepsIdefs
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule790 _stepsIerrors
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule791 _stepsIlazyIntras
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule792 _stepsIruleKinds
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule793 _stepsIruleUsage
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule794 _stepsIusedArgs
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         _lhsOuses = rule795 _stepsIuses
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule796 _stepsIvisitKinds
         _lhsOisLast :: Bool
         _lhsOisLast = rule797 _stepsIisLast
         _stepsOallFromToStates = rule798 _lhsIallFromToStates
         _stepsOallInitStates = rule799 _lhsIallInitStates
         _stepsOallVisitKinds = rule800 _lhsIallVisitKinds
         _stepsOallchildvisit = rule801 _lhsIallchildvisit
         _stepsOavisitdefs = rule802 _lhsIavisitdefs
         _stepsOavisituses = rule803 _lhsIavisituses
         _stepsOchildTypes = rule804 _lhsIchildTypes
         _stepsOchildintros = rule805 _lhsIchildintros
         _stepsOfmtMode = rule806 _lhsIfmtMode
         _stepsOkind = rule807 _lhsIkind
         _stepsOmrules = rule808 _lhsImrules
         _stepsOoptions = rule809 _lhsIoptions
         _stepsOruledefs = rule810 _lhsIruledefs
         _stepsOruleuses = rule811 _lhsIruleuses
         __result_ = T_VisitStep_vOut49 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitStep_s50 v49
   {-# INLINE rule785 #-}
   {-# LINE 858 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule785 = \ ((_stepsIsem_steps) :: PP_Doc) ->
                                 {-# LINE 858 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 _stepsIsem_steps
                                 {-# LINE 6146 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule786 #-}
   {-# LINE 918 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule786 = \  (_ :: ()) ->
                                     {-# LINE 918 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     0
                                     {-# LINE 6152 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule787 #-}
   {-# LINE 919 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule787 = \ ((_lhsIindex) :: Int) ->
                                     {-# LINE 919 "src-ag/ExecutionPlan2Clean.ag" #-}
                                     _lhsIindex
                                     {-# LINE 6158 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule788 #-}
   {-# LINE 930 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule788 = \ ((_lhsIkind) :: VisitKind) ->
                                         {-# LINE 930 "src-ag/ExecutionPlan2Clean.ag" #-}
                                         case _lhsIkind of
                                           VisitMonadic -> True
                                           _            -> False
                                         {-# LINE 6166 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule789 #-}
   rule789 = \ ((_stepsIdefs) :: Set String) ->
     _stepsIdefs
   {-# INLINE rule790 #-}
   rule790 = \ ((_stepsIerrors) :: Seq Error) ->
     _stepsIerrors
   {-# INLINE rule791 #-}
   rule791 = \ ((_stepsIlazyIntras) :: Set String) ->
     _stepsIlazyIntras
   {-# INLINE rule792 #-}
   rule792 = \ ((_stepsIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _stepsIruleKinds
   {-# INLINE rule793 #-}
   rule793 = \ ((_stepsIruleUsage) :: Map Identifier Int) ->
     _stepsIruleUsage
   {-# INLINE rule794 #-}
   rule794 = \ ((_stepsIusedArgs) :: Set String) ->
     _stepsIusedArgs
   {-# INLINE rule795 #-}
   rule795 = \ ((_stepsIuses) :: Map String (Maybe NonLocalAttr)) ->
     _stepsIuses
   {-# INLINE rule796 #-}
   rule796 = \ ((_stepsIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _stepsIvisitKinds
   {-# INLINE rule797 #-}
   rule797 = \ ((_stepsIisLast) :: Bool) ->
     _stepsIisLast
   {-# INLINE rule798 #-}
   rule798 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule799 #-}
   rule799 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule800 #-}
   rule800 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule801 #-}
   rule801 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule802 #-}
   rule802 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule803 #-}
   rule803 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule804 #-}
   rule804 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule805 #-}
   rule805 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule806 #-}
   rule806 = \ ((_lhsIfmtMode) :: FormatMode) ->
     _lhsIfmtMode
   {-# INLINE rule807 #-}
   rule807 = \ ((_lhsIkind) :: VisitKind) ->
     _lhsIkind
   {-# INLINE rule808 #-}
   rule808 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule809 #-}
   rule809 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule810 #-}
   rule810 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule811 #-}
   rule811 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses
{-# NOINLINE sem_VisitStep_ChildIntro #-}
sem_VisitStep_ChildIntro :: (Identifier) -> T_VisitStep 
sem_VisitStep_ChildIntro arg_child_ = T_VisitStep (return st50) where
   {-# NOINLINE st50 #-}
   st50 = let
      v49 :: T_VisitStep_v49 
      v49 = \ (T_VisitStep_vIn49 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIisLast _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _attachItf = rule812 _lhsIchildintros arg_child_
         _lhsOerrors :: Seq Error
         _lhsOsem_steps :: PP_Doc
         _lhsOdefs :: Set String
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         (_lhsOerrors,_lhsOsem_steps,_lhsOdefs,_lhsOuses) = rule813 _attachItf _lhsIfmtMode _lhsIkind
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule814  ()
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule815  ()
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule816  ()
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule817  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule818  ()
         _lhsOindex :: Int
         _lhsOindex = rule819 _lhsIindex
         _lhsOisLast :: Bool
         _lhsOisLast = rule820 _lhsIisLast
         __result_ = T_VisitStep_vOut49 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitStep_s50 v49
   {-# INLINE rule812 #-}
   {-# LINE 840 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule812 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) child_ ->
                                 {-# LINE 840 "src-ag/ExecutionPlan2Clean.ag" #-}
                                 Map.findWithDefault (error $ "Child " ++ show child_ ++ " not found") child_ _lhsIchildintros
                                 {-# LINE 6271 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule813 #-}
   {-# LINE 842 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule813 = \ _attachItf ((_lhsIfmtMode) :: FormatMode) ((_lhsIkind) :: VisitKind) ->
                     {-# LINE 842 "src-ag/ExecutionPlan2Clean.ag" #-}
                     case _attachItf     _lhsIkind _lhsIfmtMode of
                       Left e                   -> (Seq.singleton e, empty, Set.empty, Map.empty)
                       Right (code, defs, uses) -> (Seq.empty, code, defs, uses)
                     {-# LINE 6279 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule814 #-}
   rule814 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule815 #-}
   rule815 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule816 #-}
   rule816 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule817 #-}
   rule817 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule818 #-}
   rule818 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule819 #-}
   rule819 = \ ((_lhsIindex) :: Int) ->
     _lhsIindex
   {-# INLINE rule820 #-}
   rule820 = \ ((_lhsIisLast) :: Bool) ->
     _lhsIisLast

-- VisitSteps --------------------------------------------------
-- wrapper
data Inh_VisitSteps  = Inh_VisitSteps { allFromToStates_Inh_VisitSteps :: (Map VisitIdentifier (Int,Int)), allInitStates_Inh_VisitSteps :: (Map NontermIdent Int), allVisitKinds_Inh_VisitSteps :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_VisitSteps :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), avisitdefs_Inh_VisitSteps :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_VisitSteps :: (Map VisitIdentifier (Set Identifier)), childTypes_Inh_VisitSteps :: (Map Identifier Type), childintros_Inh_VisitSteps :: (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))), fmtMode_Inh_VisitSteps :: (FormatMode), index_Inh_VisitSteps :: (Int), kind_Inh_VisitSteps :: (VisitKind), mrules_Inh_VisitSteps :: (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)), options_Inh_VisitSteps :: (Options), ruledefs_Inh_VisitSteps :: (Map Identifier (Set String)), ruleuses_Inh_VisitSteps :: (Map Identifier (Map String (Maybe NonLocalAttr))) }
data Syn_VisitSteps  = Syn_VisitSteps { defs_Syn_VisitSteps :: (Set String), errors_Syn_VisitSteps :: (Seq Error), index_Syn_VisitSteps :: (Int), isLast_Syn_VisitSteps :: (Bool), lazyIntras_Syn_VisitSteps :: (Set String), ruleKinds_Syn_VisitSteps :: (Map Identifier (Set VisitKind)), ruleUsage_Syn_VisitSteps :: (Map Identifier Int), sem_steps_Syn_VisitSteps :: (PP_Doc), size_Syn_VisitSteps :: (Int), usedArgs_Syn_VisitSteps :: (Set String), uses_Syn_VisitSteps :: (Map String (Maybe NonLocalAttr)), visitKinds_Syn_VisitSteps :: (Map VisitIdentifier VisitKind) }
{-# INLINABLE wrap_VisitSteps #-}
wrap_VisitSteps :: T_VisitSteps  -> Inh_VisitSteps  -> (Syn_VisitSteps )
wrap_VisitSteps (T_VisitSteps act) (Inh_VisitSteps _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg52 = T_VisitSteps_vIn52 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses
        (T_VisitSteps_vOut52 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOsize _lhsOusedArgs _lhsOuses _lhsOvisitKinds) <- return (inv_VisitSteps_s53 sem arg52)
        return (Syn_VisitSteps _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOsize _lhsOusedArgs _lhsOuses _lhsOvisitKinds)
   )

-- cata
{-# NOINLINE sem_VisitSteps #-}
sem_VisitSteps :: VisitSteps  -> T_VisitSteps 
sem_VisitSteps list = Prelude.foldr sem_VisitSteps_Cons sem_VisitSteps_Nil (Prelude.map sem_VisitStep list)

-- semantic domain
newtype T_VisitSteps  = T_VisitSteps {
                                     attach_T_VisitSteps :: Identity (T_VisitSteps_s53 )
                                     }
newtype T_VisitSteps_s53  = C_VisitSteps_s53 {
                                             inv_VisitSteps_s53 :: (T_VisitSteps_v52 )
                                             }
data T_VisitSteps_s54  = C_VisitSteps_s54
type T_VisitSteps_v52  = (T_VisitSteps_vIn52 ) -> (T_VisitSteps_vOut52 )
data T_VisitSteps_vIn52  = T_VisitSteps_vIn52 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Int) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (Map Identifier Type) (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) (FormatMode) (Int) (VisitKind) (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) (Options) (Map Identifier (Set String)) (Map Identifier (Map String (Maybe NonLocalAttr)))
data T_VisitSteps_vOut52  = T_VisitSteps_vOut52 (Set String) (Seq Error) (Int) (Bool) (Set String) (Map Identifier (Set VisitKind)) (Map Identifier Int) (PP_Doc) (Int) (Set String) (Map String (Maybe NonLocalAttr)) (Map VisitIdentifier VisitKind)
{-# NOINLINE sem_VisitSteps_Cons #-}
sem_VisitSteps_Cons :: T_VisitStep  -> T_VisitSteps  -> T_VisitSteps 
sem_VisitSteps_Cons arg_hd_ arg_tl_ = T_VisitSteps (return st53) where
   {-# NOINLINE st53 #-}
   st53 = let
      v52 :: T_VisitSteps_v52 
      v52 = \ (T_VisitSteps_vIn52 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _hdX50 = Control.Monad.Identity.runIdentity (attach_T_VisitStep (arg_hd_))
         _tlX53 = Control.Monad.Identity.runIdentity (attach_T_VisitSteps (arg_tl_))
         (T_VisitStep_vOut49 _hdIdefs _hdIerrors _hdIindex _hdIisLast _hdIlazyIntras _hdIruleKinds _hdIruleUsage _hdIsem_steps _hdIusedArgs _hdIuses _hdIvisitKinds) = inv_VisitStep_s50 _hdX50 (T_VisitStep_vIn49 _hdOallFromToStates _hdOallInitStates _hdOallVisitKinds _hdOallchildvisit _hdOavisitdefs _hdOavisituses _hdOchildTypes _hdOchildintros _hdOfmtMode _hdOindex _hdOisLast _hdOkind _hdOmrules _hdOoptions _hdOruledefs _hdOruleuses)
         (T_VisitSteps_vOut52 _tlIdefs _tlIerrors _tlIindex _tlIisLast _tlIlazyIntras _tlIruleKinds _tlIruleUsage _tlIsem_steps _tlIsize _tlIusedArgs _tlIuses _tlIvisitKinds) = inv_VisitSteps_s53 _tlX53 (T_VisitSteps_vIn52 _tlOallFromToStates _tlOallInitStates _tlOallVisitKinds _tlOallchildvisit _tlOavisitdefs _tlOavisituses _tlOchildTypes _tlOchildintros _tlOfmtMode _tlOindex _tlOkind _tlOmrules _tlOoptions _tlOruledefs _tlOruleuses)
         _lhsOsize :: Int
         _lhsOsize = rule821 _tlIsize
         _hdOindex = rule822 _lhsIindex
         _tlOindex = rule823 _lhsIindex
         _lhsOindex :: Int
         _lhsOindex = rule824 _tlIindex
         _lhsOisLast :: Bool
         _lhsOisLast = rule825  ()
         _hdOisLast = rule826 _tlIisLast
         _lhsOdefs :: Set String
         _lhsOdefs = rule827 _hdIdefs _tlIdefs
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule828 _hdIerrors _tlIerrors
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule829 _hdIlazyIntras _tlIlazyIntras
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule830 _hdIruleKinds _tlIruleKinds
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule831 _hdIruleUsage _tlIruleUsage
         _lhsOsem_steps :: PP_Doc
         _lhsOsem_steps = rule832 _hdIsem_steps _tlIsem_steps
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule833 _hdIusedArgs _tlIusedArgs
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         _lhsOuses = rule834 _hdIuses _tlIuses
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule835 _hdIvisitKinds _tlIvisitKinds
         _hdOallFromToStates = rule836 _lhsIallFromToStates
         _hdOallInitStates = rule837 _lhsIallInitStates
         _hdOallVisitKinds = rule838 _lhsIallVisitKinds
         _hdOallchildvisit = rule839 _lhsIallchildvisit
         _hdOavisitdefs = rule840 _lhsIavisitdefs
         _hdOavisituses = rule841 _lhsIavisituses
         _hdOchildTypes = rule842 _lhsIchildTypes
         _hdOchildintros = rule843 _lhsIchildintros
         _hdOfmtMode = rule844 _lhsIfmtMode
         _hdOkind = rule845 _lhsIkind
         _hdOmrules = rule846 _lhsImrules
         _hdOoptions = rule847 _lhsIoptions
         _hdOruledefs = rule848 _lhsIruledefs
         _hdOruleuses = rule849 _lhsIruleuses
         _tlOallFromToStates = rule850 _lhsIallFromToStates
         _tlOallInitStates = rule851 _lhsIallInitStates
         _tlOallVisitKinds = rule852 _lhsIallVisitKinds
         _tlOallchildvisit = rule853 _lhsIallchildvisit
         _tlOavisitdefs = rule854 _lhsIavisitdefs
         _tlOavisituses = rule855 _lhsIavisituses
         _tlOchildTypes = rule856 _lhsIchildTypes
         _tlOchildintros = rule857 _lhsIchildintros
         _tlOfmtMode = rule858 _lhsIfmtMode
         _tlOkind = rule859 _lhsIkind
         _tlOmrules = rule860 _lhsImrules
         _tlOoptions = rule861 _lhsIoptions
         _tlOruledefs = rule862 _lhsIruledefs
         _tlOruleuses = rule863 _lhsIruleuses
         __result_ = T_VisitSteps_vOut52 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOsize _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitSteps_s53 v52
   {-# INLINE rule821 #-}
   {-# LINE 909 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule821 = \ ((_tlIsize) :: Int) ->
                      {-# LINE 909 "src-ag/ExecutionPlan2Clean.ag" #-}
                      1 + _tlIsize
                      {-# LINE 6406 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule822 #-}
   {-# LINE 914 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule822 = \ ((_lhsIindex) :: Int) ->
                {-# LINE 914 "src-ag/ExecutionPlan2Clean.ag" #-}
                _lhsIindex
                {-# LINE 6412 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule823 #-}
   {-# LINE 915 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule823 = \ ((_lhsIindex) :: Int) ->
                {-# LINE 915 "src-ag/ExecutionPlan2Clean.ag" #-}
                1 + _lhsIindex
                {-# LINE 6418 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule824 #-}
   {-# LINE 916 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule824 = \ ((_tlIindex) :: Int) ->
                {-# LINE 916 "src-ag/ExecutionPlan2Clean.ag" #-}
                _tlIindex
                {-# LINE 6424 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule825 #-}
   {-# LINE 926 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule825 = \  (_ :: ()) ->
                         {-# LINE 926 "src-ag/ExecutionPlan2Clean.ag" #-}
                         False
                         {-# LINE 6430 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule826 #-}
   {-# LINE 927 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule826 = \ ((_tlIisLast) :: Bool) ->
                         {-# LINE 927 "src-ag/ExecutionPlan2Clean.ag" #-}
                         _tlIisLast
                         {-# LINE 6436 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule827 #-}
   rule827 = \ ((_hdIdefs) :: Set String) ((_tlIdefs) :: Set String) ->
     _hdIdefs `Set.union` _tlIdefs
   {-# INLINE rule828 #-}
   rule828 = \ ((_hdIerrors) :: Seq Error) ((_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# INLINE rule829 #-}
   rule829 = \ ((_hdIlazyIntras) :: Set String) ((_tlIlazyIntras) :: Set String) ->
     _hdIlazyIntras `Set.union` _tlIlazyIntras
   {-# INLINE rule830 #-}
   rule830 = \ ((_hdIruleKinds) :: Map Identifier (Set VisitKind)) ((_tlIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _hdIruleKinds `unionWithMappend` _tlIruleKinds
   {-# INLINE rule831 #-}
   rule831 = \ ((_hdIruleUsage) :: Map Identifier Int) ((_tlIruleUsage) :: Map Identifier Int) ->
     _hdIruleUsage `unionWithSum` _tlIruleUsage
   {-# INLINE rule832 #-}
   rule832 = \ ((_hdIsem_steps) :: PP_Doc) ((_tlIsem_steps) :: PP_Doc) ->
     _hdIsem_steps >-< _tlIsem_steps
   {-# INLINE rule833 #-}
   rule833 = \ ((_hdIusedArgs) :: Set String) ((_tlIusedArgs) :: Set String) ->
     _hdIusedArgs `Set.union` _tlIusedArgs
   {-# INLINE rule834 #-}
   rule834 = \ ((_hdIuses) :: Map String (Maybe NonLocalAttr)) ((_tlIuses) :: Map String (Maybe NonLocalAttr)) ->
     _hdIuses `Map.union` _tlIuses
   {-# INLINE rule835 #-}
   rule835 = \ ((_hdIvisitKinds) :: Map VisitIdentifier VisitKind) ((_tlIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _hdIvisitKinds `mappend` _tlIvisitKinds
   {-# INLINE rule836 #-}
   rule836 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule837 #-}
   rule837 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule838 #-}
   rule838 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule839 #-}
   rule839 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule840 #-}
   rule840 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule841 #-}
   rule841 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule842 #-}
   rule842 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule843 #-}
   rule843 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule844 #-}
   rule844 = \ ((_lhsIfmtMode) :: FormatMode) ->
     _lhsIfmtMode
   {-# INLINE rule845 #-}
   rule845 = \ ((_lhsIkind) :: VisitKind) ->
     _lhsIkind
   {-# INLINE rule846 #-}
   rule846 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule847 #-}
   rule847 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule848 #-}
   rule848 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule849 #-}
   rule849 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses
   {-# INLINE rule850 #-}
   rule850 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule851 #-}
   rule851 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule852 #-}
   rule852 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule853 #-}
   rule853 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule854 #-}
   rule854 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule855 #-}
   rule855 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule856 #-}
   rule856 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule857 #-}
   rule857 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule858 #-}
   rule858 = \ ((_lhsIfmtMode) :: FormatMode) ->
     _lhsIfmtMode
   {-# INLINE rule859 #-}
   rule859 = \ ((_lhsIkind) :: VisitKind) ->
     _lhsIkind
   {-# INLINE rule860 #-}
   rule860 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule861 #-}
   rule861 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule862 #-}
   rule862 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule863 #-}
   rule863 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses
{-# NOINLINE sem_VisitSteps_Nil #-}
sem_VisitSteps_Nil ::  T_VisitSteps 
sem_VisitSteps_Nil  = T_VisitSteps (return st53) where
   {-# NOINLINE st53 #-}
   st53 = let
      v52 :: T_VisitSteps_v52 
      v52 = \ (T_VisitSteps_vIn52 _lhsIallFromToStates _lhsIallInitStates _lhsIallVisitKinds _lhsIallchildvisit _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIfmtMode _lhsIindex _lhsIkind _lhsImrules _lhsIoptions _lhsIruledefs _lhsIruleuses) -> ( let
         _lhsOsize :: Int
         _lhsOsize = rule864  ()
         _lhsOisLast :: Bool
         _lhsOisLast = rule865  ()
         _lhsOdefs :: Set String
         _lhsOdefs = rule866  ()
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule867  ()
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule868  ()
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule869  ()
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule870  ()
         _lhsOsem_steps :: PP_Doc
         _lhsOsem_steps = rule871  ()
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule872  ()
         _lhsOuses :: Map String (Maybe NonLocalAttr)
         _lhsOuses = rule873  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule874  ()
         _lhsOindex :: Int
         _lhsOindex = rule875 _lhsIindex
         __result_ = T_VisitSteps_vOut52 _lhsOdefs _lhsOerrors _lhsOindex _lhsOisLast _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_steps _lhsOsize _lhsOusedArgs _lhsOuses _lhsOvisitKinds
         in __result_ )
     in C_VisitSteps_s53 v52
   {-# INLINE rule864 #-}
   {-# LINE 908 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule864 = \  (_ :: ()) ->
                      {-# LINE 908 "src-ag/ExecutionPlan2Clean.ag" #-}
                      0
                      {-# LINE 6587 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule865 #-}
   {-# LINE 925 "src-ag/ExecutionPlan2Clean.ag" #-}
   rule865 = \  (_ :: ()) ->
                         {-# LINE 925 "src-ag/ExecutionPlan2Clean.ag" #-}
                         True
                         {-# LINE 6593 "src-generated/ExecutionPlan2Clean.hs" #-}
   {-# INLINE rule866 #-}
   rule866 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule867 #-}
   rule867 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule868 #-}
   rule868 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule869 #-}
   rule869 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule870 #-}
   rule870 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule871 #-}
   rule871 = \  (_ :: ()) ->
     empty
   {-# INLINE rule872 #-}
   rule872 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule873 #-}
   rule873 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule874 #-}
   rule874 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule875 #-}
   rule875 = \ ((_lhsIindex) :: Int) ->
     _lhsIindex

-- Visits ------------------------------------------------------
-- wrapper
data Inh_Visits  = Inh_Visits { allFromToStates_Inh_Visits :: (Map VisitIdentifier (Int,Int)), allInhmap_Inh_Visits :: (Map NontermIdent Attributes), allInitStates_Inh_Visits :: (Map NontermIdent Int), allSynmap_Inh_Visits :: (Map NontermIdent Attributes), allVisitKinds_Inh_Visits :: (Map VisitIdentifier VisitKind), allchildvisit_Inh_Visits :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), allintramap_Inh_Visits :: (Map StateIdentifier (Map String (Maybe NonLocalAttr))), avisitdefs_Inh_Visits :: (Map VisitIdentifier (Set Identifier)), avisituses_Inh_Visits :: (Map VisitIdentifier (Set Identifier)), childTypes_Inh_Visits :: (Map Identifier Type), childintros_Inh_Visits :: (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))), con_Inh_Visits :: (ConstructorIdent), inhmap_Inh_Visits :: (Attributes), mrules_Inh_Visits :: (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)), nextVisits_Inh_Visits :: (Map StateIdentifier StateCtx), nt_Inh_Visits :: (NontermIdent), options_Inh_Visits :: (Options), params_Inh_Visits :: ([Identifier]), prevVisits_Inh_Visits :: (Map StateIdentifier StateCtx), ruledefs_Inh_Visits :: (Map Identifier (Set String)), ruleuses_Inh_Visits :: (Map Identifier (Map String (Maybe NonLocalAttr))), synmap_Inh_Visits :: (Attributes), terminaldefs_Inh_Visits :: (Set String) }
data Syn_Visits  = Syn_Visits { allvisits_Syn_Visits :: ([VisitStateState]), childvisit_Syn_Visits :: (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))), errors_Syn_Visits :: (Seq Error), fromToStates_Syn_Visits :: (Map VisitIdentifier (Int,Int)), intramap_Syn_Visits :: (Map StateIdentifier (Map String (Maybe NonLocalAttr))), lazyIntras_Syn_Visits :: (Set String), ruleKinds_Syn_Visits :: (Map Identifier (Set VisitKind)), ruleUsage_Syn_Visits :: (Map Identifier Int), sem_visit_Syn_Visits :: ( [(StateIdentifier,Bool -> PP_Doc)] ), t_visits_Syn_Visits :: (PP_Doc), usedArgs_Syn_Visits :: (Set String), visitKinds_Syn_Visits :: (Map VisitIdentifier VisitKind), visitdefs_Syn_Visits :: (Map VisitIdentifier (Set Identifier)), visituses_Syn_Visits :: (Map VisitIdentifier (Set Identifier)) }
{-# INLINABLE wrap_Visits #-}
wrap_Visits :: T_Visits  -> Inh_Visits  -> (Syn_Visits )
wrap_Visits (T_Visits act) (Inh_Visits _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs) =
   Control.Monad.Identity.runIdentity (
     do sem <- act
        let arg55 = T_Visits_vIn55 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs
        (T_Visits_vOut55 _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses) <- return (inv_Visits_s56 sem arg55)
        return (Syn_Visits _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses)
   )

-- cata
{-# NOINLINE sem_Visits #-}
sem_Visits :: Visits  -> T_Visits 
sem_Visits list = Prelude.foldr sem_Visits_Cons sem_Visits_Nil (Prelude.map sem_Visit list)

-- semantic domain
newtype T_Visits  = T_Visits {
                             attach_T_Visits :: Identity (T_Visits_s56 )
                             }
newtype T_Visits_s56  = C_Visits_s56 {
                                     inv_Visits_s56 :: (T_Visits_v55 )
                                     }
data T_Visits_s57  = C_Visits_s57
type T_Visits_v55  = (T_Visits_vIn55 ) -> (T_Visits_vOut55 )
data T_Visits_vIn55  = T_Visits_vIn55 (Map VisitIdentifier (Int,Int)) (Map NontermIdent Attributes) (Map NontermIdent Int) (Map NontermIdent Attributes) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Map StateIdentifier (Map String (Maybe NonLocalAttr))) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier)) (Map Identifier Type) (Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) (ConstructorIdent) (Attributes) (Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) (Map StateIdentifier StateCtx) (NontermIdent) (Options) ([Identifier]) (Map StateIdentifier StateCtx) (Map Identifier (Set String)) (Map Identifier (Map String (Maybe NonLocalAttr))) (Attributes) (Set String)
data T_Visits_vOut55  = T_Visits_vOut55 ([VisitStateState]) (Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) (Seq Error) (Map VisitIdentifier (Int,Int)) (Map StateIdentifier (Map String (Maybe NonLocalAttr))) (Set String) (Map Identifier (Set VisitKind)) (Map Identifier Int) ( [(StateIdentifier,Bool -> PP_Doc)] ) (PP_Doc) (Set String) (Map VisitIdentifier VisitKind) (Map VisitIdentifier (Set Identifier)) (Map VisitIdentifier (Set Identifier))
{-# NOINLINE sem_Visits_Cons #-}
sem_Visits_Cons :: T_Visit  -> T_Visits  -> T_Visits 
sem_Visits_Cons arg_hd_ arg_tl_ = T_Visits (return st56) where
   {-# NOINLINE st56 #-}
   st56 = let
      v55 :: T_Visits_v55 
      v55 = \ (T_Visits_vIn55 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs) -> ( let
         _hdX47 = Control.Monad.Identity.runIdentity (attach_T_Visit (arg_hd_))
         _tlX56 = Control.Monad.Identity.runIdentity (attach_T_Visits (arg_tl_))
         (T_Visit_vOut46 _hdIallvisits _hdIchildvisit _hdIerrors _hdIfromToStates _hdIintramap _hdIlazyIntras _hdIruleKinds _hdIruleUsage _hdIsem_visit _hdIt_visits _hdIusedArgs _hdIvisitKinds _hdIvisitdefs _hdIvisituses) = inv_Visit_s47 _hdX47 (T_Visit_vIn46 _hdOallFromToStates _hdOallInhmap _hdOallInitStates _hdOallSynmap _hdOallVisitKinds _hdOallchildvisit _hdOallintramap _hdOavisitdefs _hdOavisituses _hdOchildTypes _hdOchildintros _hdOcon _hdOinhmap _hdOmrules _hdOnextVisits _hdOnt _hdOoptions _hdOparams _hdOprevVisits _hdOruledefs _hdOruleuses _hdOsynmap _hdOterminaldefs)
         (T_Visits_vOut55 _tlIallvisits _tlIchildvisit _tlIerrors _tlIfromToStates _tlIintramap _tlIlazyIntras _tlIruleKinds _tlIruleUsage _tlIsem_visit _tlIt_visits _tlIusedArgs _tlIvisitKinds _tlIvisitdefs _tlIvisituses) = inv_Visits_s56 _tlX56 (T_Visits_vIn55 _tlOallFromToStates _tlOallInhmap _tlOallInitStates _tlOallSynmap _tlOallVisitKinds _tlOallchildvisit _tlOallintramap _tlOavisitdefs _tlOavisituses _tlOchildTypes _tlOchildintros _tlOcon _tlOinhmap _tlOmrules _tlOnextVisits _tlOnt _tlOoptions _tlOparams _tlOprevVisits _tlOruledefs _tlOruleuses _tlOsynmap _tlOterminaldefs)
         _lhsOallvisits :: [VisitStateState]
         _lhsOallvisits = rule876 _hdIallvisits _tlIallvisits
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule877 _hdIchildvisit _tlIchildvisit
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule878 _hdIerrors _tlIerrors
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule879 _hdIfromToStates _tlIfromToStates
         _lhsOintramap :: Map StateIdentifier (Map String (Maybe NonLocalAttr))
         _lhsOintramap = rule880 _hdIintramap _tlIintramap
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule881 _hdIlazyIntras _tlIlazyIntras
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule882 _hdIruleKinds _tlIruleKinds
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule883 _hdIruleUsage _tlIruleUsage
         _lhsOsem_visit ::  [(StateIdentifier,Bool -> PP_Doc)] 
         _lhsOsem_visit = rule884 _hdIsem_visit _tlIsem_visit
         _lhsOt_visits :: PP_Doc
         _lhsOt_visits = rule885 _hdIt_visits _tlIt_visits
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule886 _hdIusedArgs _tlIusedArgs
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule887 _hdIvisitKinds _tlIvisitKinds
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule888 _hdIvisitdefs _tlIvisitdefs
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule889 _hdIvisituses _tlIvisituses
         _hdOallFromToStates = rule890 _lhsIallFromToStates
         _hdOallInhmap = rule891 _lhsIallInhmap
         _hdOallInitStates = rule892 _lhsIallInitStates
         _hdOallSynmap = rule893 _lhsIallSynmap
         _hdOallVisitKinds = rule894 _lhsIallVisitKinds
         _hdOallchildvisit = rule895 _lhsIallchildvisit
         _hdOallintramap = rule896 _lhsIallintramap
         _hdOavisitdefs = rule897 _lhsIavisitdefs
         _hdOavisituses = rule898 _lhsIavisituses
         _hdOchildTypes = rule899 _lhsIchildTypes
         _hdOchildintros = rule900 _lhsIchildintros
         _hdOcon = rule901 _lhsIcon
         _hdOinhmap = rule902 _lhsIinhmap
         _hdOmrules = rule903 _lhsImrules
         _hdOnextVisits = rule904 _lhsInextVisits
         _hdOnt = rule905 _lhsInt
         _hdOoptions = rule906 _lhsIoptions
         _hdOparams = rule907 _lhsIparams
         _hdOprevVisits = rule908 _lhsIprevVisits
         _hdOruledefs = rule909 _lhsIruledefs
         _hdOruleuses = rule910 _lhsIruleuses
         _hdOsynmap = rule911 _lhsIsynmap
         _hdOterminaldefs = rule912 _lhsIterminaldefs
         _tlOallFromToStates = rule913 _lhsIallFromToStates
         _tlOallInhmap = rule914 _lhsIallInhmap
         _tlOallInitStates = rule915 _lhsIallInitStates
         _tlOallSynmap = rule916 _lhsIallSynmap
         _tlOallVisitKinds = rule917 _lhsIallVisitKinds
         _tlOallchildvisit = rule918 _lhsIallchildvisit
         _tlOallintramap = rule919 _lhsIallintramap
         _tlOavisitdefs = rule920 _lhsIavisitdefs
         _tlOavisituses = rule921 _lhsIavisituses
         _tlOchildTypes = rule922 _lhsIchildTypes
         _tlOchildintros = rule923 _lhsIchildintros
         _tlOcon = rule924 _lhsIcon
         _tlOinhmap = rule925 _lhsIinhmap
         _tlOmrules = rule926 _lhsImrules
         _tlOnextVisits = rule927 _lhsInextVisits
         _tlOnt = rule928 _lhsInt
         _tlOoptions = rule929 _lhsIoptions
         _tlOparams = rule930 _lhsIparams
         _tlOprevVisits = rule931 _lhsIprevVisits
         _tlOruledefs = rule932 _lhsIruledefs
         _tlOruleuses = rule933 _lhsIruleuses
         _tlOsynmap = rule934 _lhsIsynmap
         _tlOterminaldefs = rule935 _lhsIterminaldefs
         __result_ = T_Visits_vOut55 _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_Visits_s56 v55
   {-# INLINE rule876 #-}
   rule876 = \ ((_hdIallvisits) ::  VisitStateState ) ((_tlIallvisits) :: [VisitStateState]) ->
     _hdIallvisits : _tlIallvisits
   {-# INLINE rule877 #-}
   rule877 = \ ((_hdIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ((_tlIchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _hdIchildvisit `Map.union` _tlIchildvisit
   {-# INLINE rule878 #-}
   rule878 = \ ((_hdIerrors) :: Seq Error) ((_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# INLINE rule879 #-}
   rule879 = \ ((_hdIfromToStates) :: Map VisitIdentifier (Int,Int)) ((_tlIfromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _hdIfromToStates `mappend` _tlIfromToStates
   {-# INLINE rule880 #-}
   rule880 = \ ((_hdIintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) ((_tlIintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) ->
     _hdIintramap `uwMapUnion` _tlIintramap
   {-# INLINE rule881 #-}
   rule881 = \ ((_hdIlazyIntras) :: Set String) ((_tlIlazyIntras) :: Set String) ->
     _hdIlazyIntras `Set.union` _tlIlazyIntras
   {-# INLINE rule882 #-}
   rule882 = \ ((_hdIruleKinds) :: Map Identifier (Set VisitKind)) ((_tlIruleKinds) :: Map Identifier (Set VisitKind)) ->
     _hdIruleKinds `unionWithMappend` _tlIruleKinds
   {-# INLINE rule883 #-}
   rule883 = \ ((_hdIruleUsage) :: Map Identifier Int) ((_tlIruleUsage) :: Map Identifier Int) ->
     _hdIruleUsage `unionWithSum` _tlIruleUsage
   {-# INLINE rule884 #-}
   rule884 = \ ((_hdIsem_visit) ::   (StateIdentifier,Bool -> PP_Doc)  ) ((_tlIsem_visit) ::  [(StateIdentifier,Bool -> PP_Doc)] ) ->
     _hdIsem_visit : _tlIsem_visit
   {-# INLINE rule885 #-}
   rule885 = \ ((_hdIt_visits) :: PP_Doc) ((_tlIt_visits) :: PP_Doc) ->
     _hdIt_visits >-< _tlIt_visits
   {-# INLINE rule886 #-}
   rule886 = \ ((_hdIusedArgs) :: Set String) ((_tlIusedArgs) :: Set String) ->
     _hdIusedArgs `Set.union` _tlIusedArgs
   {-# INLINE rule887 #-}
   rule887 = \ ((_hdIvisitKinds) :: Map VisitIdentifier VisitKind) ((_tlIvisitKinds) :: Map VisitIdentifier VisitKind) ->
     _hdIvisitKinds `mappend` _tlIvisitKinds
   {-# INLINE rule888 #-}
   rule888 = \ ((_hdIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ((_tlIvisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _hdIvisitdefs `uwSetUnion` _tlIvisitdefs
   {-# INLINE rule889 #-}
   rule889 = \ ((_hdIvisituses) :: Map VisitIdentifier (Set Identifier)) ((_tlIvisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _hdIvisituses `uwSetUnion` _tlIvisituses
   {-# INLINE rule890 #-}
   rule890 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule891 #-}
   rule891 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule892 #-}
   rule892 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule893 #-}
   rule893 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule894 #-}
   rule894 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule895 #-}
   rule895 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule896 #-}
   rule896 = \ ((_lhsIallintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIallintramap
   {-# INLINE rule897 #-}
   rule897 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule898 #-}
   rule898 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule899 #-}
   rule899 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule900 #-}
   rule900 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule901 #-}
   rule901 = \ ((_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule902 #-}
   rule902 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule903 #-}
   rule903 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule904 #-}
   rule904 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) ->
     _lhsInextVisits
   {-# INLINE rule905 #-}
   rule905 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule906 #-}
   rule906 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule907 #-}
   rule907 = \ ((_lhsIparams) :: [Identifier]) ->
     _lhsIparams
   {-# INLINE rule908 #-}
   rule908 = \ ((_lhsIprevVisits) :: Map StateIdentifier StateCtx) ->
     _lhsIprevVisits
   {-# INLINE rule909 #-}
   rule909 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule910 #-}
   rule910 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses
   {-# INLINE rule911 #-}
   rule911 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule912 #-}
   rule912 = \ ((_lhsIterminaldefs) :: Set String) ->
     _lhsIterminaldefs
   {-# INLINE rule913 #-}
   rule913 = \ ((_lhsIallFromToStates) :: Map VisitIdentifier (Int,Int)) ->
     _lhsIallFromToStates
   {-# INLINE rule914 #-}
   rule914 = \ ((_lhsIallInhmap) :: Map NontermIdent Attributes) ->
     _lhsIallInhmap
   {-# INLINE rule915 #-}
   rule915 = \ ((_lhsIallInitStates) :: Map NontermIdent Int) ->
     _lhsIallInitStates
   {-# INLINE rule916 #-}
   rule916 = \ ((_lhsIallSynmap) :: Map NontermIdent Attributes) ->
     _lhsIallSynmap
   {-# INLINE rule917 #-}
   rule917 = \ ((_lhsIallVisitKinds) :: Map VisitIdentifier VisitKind) ->
     _lhsIallVisitKinds
   {-# INLINE rule918 #-}
   rule918 = \ ((_lhsIallchildvisit) :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))) ->
     _lhsIallchildvisit
   {-# INLINE rule919 #-}
   rule919 = \ ((_lhsIallintramap) :: Map StateIdentifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIallintramap
   {-# INLINE rule920 #-}
   rule920 = \ ((_lhsIavisitdefs) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisitdefs
   {-# INLINE rule921 #-}
   rule921 = \ ((_lhsIavisituses) :: Map VisitIdentifier (Set Identifier)) ->
     _lhsIavisituses
   {-# INLINE rule922 #-}
   rule922 = \ ((_lhsIchildTypes) :: Map Identifier Type) ->
     _lhsIchildTypes
   {-# INLINE rule923 #-}
   rule923 = \ ((_lhsIchildintros) :: Map Identifier (VisitKind -> FormatMode -> Either Error (PP_Doc, Set String, Map String (Maybe NonLocalAttr)))) ->
     _lhsIchildintros
   {-# INLINE rule924 #-}
   rule924 = \ ((_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule925 #-}
   rule925 = \ ((_lhsIinhmap) :: Attributes) ->
     _lhsIinhmap
   {-# INLINE rule926 #-}
   rule926 = \ ((_lhsImrules) :: Map Identifier (VisitKind -> FormatMode -> Either Error PP_Doc)) ->
     _lhsImrules
   {-# INLINE rule927 #-}
   rule927 = \ ((_lhsInextVisits) :: Map StateIdentifier StateCtx) ->
     _lhsInextVisits
   {-# INLINE rule928 #-}
   rule928 = \ ((_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule929 #-}
   rule929 = \ ((_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# INLINE rule930 #-}
   rule930 = \ ((_lhsIparams) :: [Identifier]) ->
     _lhsIparams
   {-# INLINE rule931 #-}
   rule931 = \ ((_lhsIprevVisits) :: Map StateIdentifier StateCtx) ->
     _lhsIprevVisits
   {-# INLINE rule932 #-}
   rule932 = \ ((_lhsIruledefs) :: Map Identifier (Set String)) ->
     _lhsIruledefs
   {-# INLINE rule933 #-}
   rule933 = \ ((_lhsIruleuses) :: Map Identifier (Map String (Maybe NonLocalAttr))) ->
     _lhsIruleuses
   {-# INLINE rule934 #-}
   rule934 = \ ((_lhsIsynmap) :: Attributes) ->
     _lhsIsynmap
   {-# INLINE rule935 #-}
   rule935 = \ ((_lhsIterminaldefs) :: Set String) ->
     _lhsIterminaldefs
{-# NOINLINE sem_Visits_Nil #-}
sem_Visits_Nil ::  T_Visits 
sem_Visits_Nil  = T_Visits (return st56) where
   {-# NOINLINE st56 #-}
   st56 = let
      v55 :: T_Visits_v55 
      v55 = \ (T_Visits_vIn55 _lhsIallFromToStates _lhsIallInhmap _lhsIallInitStates _lhsIallSynmap _lhsIallVisitKinds _lhsIallchildvisit _lhsIallintramap _lhsIavisitdefs _lhsIavisituses _lhsIchildTypes _lhsIchildintros _lhsIcon _lhsIinhmap _lhsImrules _lhsInextVisits _lhsInt _lhsIoptions _lhsIparams _lhsIprevVisits _lhsIruledefs _lhsIruleuses _lhsIsynmap _lhsIterminaldefs) -> ( let
         _lhsOallvisits :: [VisitStateState]
         _lhsOallvisits = rule936  ()
         _lhsOchildvisit :: Map VisitIdentifier (Identifier -> VisitKind -> Either Error (PP_Doc, PP_Doc))
         _lhsOchildvisit = rule937  ()
         _lhsOerrors :: Seq Error
         _lhsOerrors = rule938  ()
         _lhsOfromToStates :: Map VisitIdentifier (Int,Int)
         _lhsOfromToStates = rule939  ()
         _lhsOintramap :: Map StateIdentifier (Map String (Maybe NonLocalAttr))
         _lhsOintramap = rule940  ()
         _lhsOlazyIntras :: Set String
         _lhsOlazyIntras = rule941  ()
         _lhsOruleKinds :: Map Identifier (Set VisitKind)
         _lhsOruleKinds = rule942  ()
         _lhsOruleUsage :: Map Identifier Int
         _lhsOruleUsage = rule943  ()
         _lhsOsem_visit ::  [(StateIdentifier,Bool -> PP_Doc)] 
         _lhsOsem_visit = rule944  ()
         _lhsOt_visits :: PP_Doc
         _lhsOt_visits = rule945  ()
         _lhsOusedArgs :: Set String
         _lhsOusedArgs = rule946  ()
         _lhsOvisitKinds :: Map VisitIdentifier VisitKind
         _lhsOvisitKinds = rule947  ()
         _lhsOvisitdefs :: Map VisitIdentifier (Set Identifier)
         _lhsOvisitdefs = rule948  ()
         _lhsOvisituses :: Map VisitIdentifier (Set Identifier)
         _lhsOvisituses = rule949  ()
         __result_ = T_Visits_vOut55 _lhsOallvisits _lhsOchildvisit _lhsOerrors _lhsOfromToStates _lhsOintramap _lhsOlazyIntras _lhsOruleKinds _lhsOruleUsage _lhsOsem_visit _lhsOt_visits _lhsOusedArgs _lhsOvisitKinds _lhsOvisitdefs _lhsOvisituses
         in __result_ )
     in C_Visits_s56 v55
   {-# INLINE rule936 #-}
   rule936 = \  (_ :: ()) ->
     []
   {-# INLINE rule937 #-}
   rule937 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule938 #-}
   rule938 = \  (_ :: ()) ->
     Seq.empty
   {-# INLINE rule939 #-}
   rule939 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule940 #-}
   rule940 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule941 #-}
   rule941 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule942 #-}
   rule942 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule943 #-}
   rule943 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule944 #-}
   rule944 = \  (_ :: ()) ->
     []
   {-# INLINE rule945 #-}
   rule945 = \  (_ :: ()) ->
     empty
   {-# INLINE rule946 #-}
   rule946 = \  (_ :: ()) ->
     Set.empty
   {-# INLINE rule947 #-}
   rule947 = \  (_ :: ()) ->
     mempty
   {-# INLINE rule948 #-}
   rule948 = \  (_ :: ()) ->
     Map.empty
   {-# INLINE rule949 #-}
   rule949 = \  (_ :: ()) ->
     Map.empty