-
Notifications
You must be signed in to change notification settings - Fork 2
/
pml2_parser.expected
4266 lines (4266 loc) · 290 KB
/
pml2_parser.expected
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
[@@@ocaml.text
" Main parsing module. This module defines an [Earley] parser for the\n language. "]
open Earley_core
open Earley
open Extra
open Pos
open Output
open Bindlib
open Typing
open Raw
open Priority
exception No_parse of pos
[@ocaml.doc " Exception raised in case of parse error. "]
exception Check_failed of Ast.prop * bool * Ast.prop
let verbose = ref true
let timed = ref false
let recompile = ref false
let parsing_chrono = Chrono.create "parsing"
let single_line _loc = if _loc.start_line <> _loc.end_line then give_up ()
let str_lit =
let normal = List.fold_left Charset.del Charset.full ['\\'; '"'; '\r'] in
let normal = in_charset normal in
let str_char =
Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence normal
(Earley_core.Earley.empty (fun c -> String.make 1 c)))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\\\"" "\\\"")
(Earley_core.Earley.empty "\""))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\\\\" "\\\\")
(Earley_core.Earley.empty "\\"))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\\n" "\\n")
(Earley_core.Earley.empty "\n"))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\\t" "\\t")
(Earley_core.Earley.empty "\t")) []))))) in
let str =
Earley_core.Earley.fsequence_ignore (Earley_core.Earley.string "\"" "\"")
(Earley_core.Earley.fsequence
(Earley_core.Earley.apply (fun f -> f [])
(Earley_core.Earley.fixpoint' (fun l -> l) str_char
(fun x -> fun f -> fun l -> f (List.cons x l))))
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\"" "\"")
(Earley_core.Earley.empty (fun cs -> String.concat "" cs)))) in
change_layout str no_blank
let path_atom = Earley_core.Earley.declare_grammar "path_atom"
let _ =
Earley_core.Earley.set_grammar path_atom
(Earley_str.regexp ~name:"[a-zA-Z0-9_]+" "[a-zA-Z0-9_]+"
(fun group -> group 0))
let no_dot =
Earley.test ~name:"no_dot" Charset.full
(fun buf ->
fun pos ->
let (c, buf, pos) = Input.read buf pos in
if c <> '.' then ((), true) else ((), false))
let path = Earley_core.Earley.declare_grammar "path"
let _ =
Earley_core.Earley.set_grammar path
(Earley_core.Earley.fsequence
(Earley_core.Earley.apply (fun f -> f [])
(Earley_core.Earley.fixpoint' (fun l -> l)
(Earley_core.Earley.fsequence path_atom
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char '.' '.')
(Earley_core.Earley.empty (fun _default_0 -> _default_0))))
(fun x -> fun f -> fun l -> f (List.cons x l))))
(Earley_core.Earley.fsequence path_atom
(Earley_core.Earley.fsequence no_dot
(Earley_core.Earley.empty
(fun _default_0 -> fun f -> fun ps -> ps @ [f])))))
let goal_name = Earley_core.Earley.declare_grammar "goal_name"
let _ =
Earley_core.Earley.set_grammar goal_name
(Earley_str.regexp ~name:"\\\\([^-]\\\\|\\\\(-[^}]\\\\)\\\\)*"
"\\([^-]\\|\\(-[^}]\\)\\)*" (fun group -> group 0))
let goal = Earley_core.Earley.declare_grammar "goal"
let _ =
Earley_core.Earley.set_grammar goal
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "{-" "{-")
(Earley_core.Earley.fsequence goal_name
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "-}" "-}")
(Earley_core.Earley.empty (fun str -> String.trim str)))))
let _assert_ = Keyword.create "assert"
let _assume_ = Keyword.create "assume"
let _because_ = Keyword.create "because"
let _bool_ = Keyword.create "bool"
let _by_ = Keyword.create "by"
let _case_ = Keyword.create "case"
let _check_ = Keyword.create "check"
let _corec_ = Keyword.create "corec"
let _deduce_ = Keyword.create "deduce"
let _delim_ = Keyword.create "delim"
let _def_ = Keyword.create "def"
let _else_ = Keyword.create "else"
let _eqns_ = Keyword.create "eqns"
let _false_ = Keyword.create "false"
let _fix_ = Keyword.create "fix"
let _for_ = Keyword.create "for"
let _fun_ = Keyword.create "fun"
let _if_ = Keyword.create "if"
let _include_ = Keyword.create "include"
let _infix_ = Keyword.create "infix"
let _know_ = Keyword.create "know"
let _let_ = Keyword.create "let"
let _of_ = Keyword.create "of"
let _print_ = Keyword.create "print"
let _qed_ = Keyword.create "qed"
let _rec_ = Keyword.create "rec"
let _restore_ = Keyword.create "restore"
let _save_ = Keyword.create "save"
let _set_ = Keyword.create "set"
let _show_ = Keyword.create "show"
let _showing_ = Keyword.create "showing"
let _sort_ = Keyword.create "sort"
let _such_ = Keyword.create "such"
let _suppose_ = Keyword.create "suppose"
let _take_ = Keyword.create "take"
let _that_ = Keyword.create "that"
let _true_ = Keyword.create "true"
let _type_ = Keyword.create "type"
let _unsafe_ = Keyword.create "unsafe"
let _use_ = Keyword.create "use"
let _using_ = Keyword.create "using"
let _val_ = Keyword.create "val"
let lid = Earley_core.Earley.declare_grammar "lid"
let _ =
Earley_core.Earley.set_grammar lid
(Earley_core.Earley.fsequence
(Earley_str.regexp ~name:"[a-z][a-zA-Z0-9_']*" "[a-z][a-zA-Z0-9_']*"
(fun group -> group 0))
(Earley_core.Earley.empty (fun id -> Keyword.check id; id)))
let uid = Earley_core.Earley.declare_grammar "uid"
let _ =
Earley_core.Earley.set_grammar uid
(Earley_core.Earley.fsequence
(Earley_str.regexp ~name:"[A-Z][a-zA-Z0-9_']*" "[A-Z][a-zA-Z0-9_']*"
(fun group -> group 0))
(Earley_core.Earley.empty (fun id -> Keyword.check id; id)))
let num = Earley_core.Earley.declare_grammar "num"
let _ =
Earley_core.Earley.set_grammar num
(Earley_str.regexp ~name:"[0-9]+" "[0-9]+" (fun group -> group 0))
let reserved_infix = ["\226\137\161"; "\226\136\136"; "="]
let infix_re = Earley_core.Earley.declare_grammar "infix_re"
let _ =
Earley_core.Earley.set_grammar infix_re
(Earley_core.Earley.fsequence
(Earley_str.regexp ~name:"[^][(){}a-zA-Z0-9_'\\\"\\\";,. \\n\\t\\r]+"
"[^][(){}a-zA-Z0-9_'\"\";,. \n\t\r]+" (fun group -> group 0))
(Earley_core.Earley.empty
(fun s -> if List.mem s reserved_infix then give_up (); s)))
let infix = Earley_core.Earley.declare_grammar "infix"
let _ =
Earley_core.Earley.set_grammar infix
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence infix
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.no_blank_test ())
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char '_' '_')
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.no_blank_test ())
(Earley_core.Earley.fsequence_position lid
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun str1 ->
fun pos1 ->
fun str2 ->
fun pos2 ->
fun m ->
let _loc_m =
locate str1 pos1 str2 pos2 in
fun
((_, s, p, pl, pr, ho) as
_default_0)
->
let m =
evari (Some _loc_m)
(in_pos _loc_m m) in
let t =
in_pos _loc
(EProj (m, (ref `T), s)) in
(t, s, p, pl, pr, ho))))))))
(List.cons
(Earley_core.Earley.fsequence_position infix_re
(Earley_core.Earley.empty
(fun str1 ->
fun pos1 ->
fun str2 ->
fun pos2 ->
fun s ->
let _loc_s = locate str1 pos1 str2 pos2 in
try
let open Env in
let { name; prio = p; asso; hiho } =
Hashtbl.find infix_tbl s in
let epsilon = 1e-6 in
let q = p -. epsilon in
let (pl, pr) =
match asso with
| LeftAssoc -> (p, q)
| RightAssoc -> (q, p)
| NonAssoc -> (q, q) in
let name = in_pos _loc_s name in
let sym = evari (Some _loc_s) name in
(sym, name, p, pl, pr, hiho)
with | Not_found -> give_up ()))) [])))
let llid = Earley_core.Earley.declare_grammar "llid"
let _ =
Earley_core.Earley.set_grammar llid
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char '(' '(')
(Earley_core.Earley.fsequence infix
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char ')' ')')
(Earley_core.Earley.empty
(fun ((_, id, _, _, _, _) as _default_0) -> id)))))
(List.cons
(Earley_core.Earley.fsequence lid
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun id -> in_pos _loc id))) [])))
let luid = Earley_core.Earley.declare_grammar "luid"
let _ =
Earley_core.Earley.set_grammar luid
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence _false_
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun _default_0 -> in_pos _loc "false")))
(List.cons
(Earley_core.Earley.fsequence uid
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun id -> in_pos _loc id)))
(List.cons
(Earley_core.Earley.fsequence _true_
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun _default_0 -> in_pos _loc "true"))) []))))
let lnum = Earley_core.Earley.declare_grammar "lnum"
let _ =
Earley_core.Earley.set_grammar lnum
(Earley_core.Earley.fsequence num
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun id -> in_pos _loc id)))
let int = Earley_core.Earley.declare_grammar "int"
let _ =
Earley_core.Earley.set_grammar int
(Earley_core.Earley.fsequence
(Earley_str.regexp ~name:"[0-9]+" "[0-9]+" (fun group -> group 0))
(Earley_core.Earley.empty (fun s -> int_of_string s)))
let float = Earley_core.Earley.declare_grammar "float"
let _ =
Earley_core.Earley.set_grammar float
(Earley_core.Earley.fsequence
(Earley_str.regexp
~name:"[0-9]*\\\\('.'[0-9]*\\\\)?\\\\([eE][-+]?[0-9]*\\\\)?"
"[0-9]*\\('.'[0-9]*\\)?\\([eE][-+]?[0-9]*\\)?"
(fun group -> group 0))
(Earley_core.Earley.empty
(fun s -> if s = "" then give_up (); float_of_string s)))
let llid_wc = Earley_core.Earley.declare_grammar "llid_wc"
let _ =
Earley_core.Earley.set_grammar llid_wc
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char '_' '_')
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
in_pos _loc "_")))
(List.cons
(Earley_core.Earley.fsequence lid
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun id -> in_pos _loc id))) [])))
let elipsis = Earley_core.Earley.declare_grammar "elipsis"
let _ =
Earley_core.Earley.set_grammar elipsis
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "..." "...")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\139\175" "\226\139\175")
(Earley_core.Earley.empty ())) [])))
let infty = Earley_core.Earley.declare_grammar "infty"
let _ =
Earley_core.Earley.set_grammar infty
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<inf>" "<inf>")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\136\158" "\226\136\158")
(Earley_core.Earley.empty ())) [])))
let arrow = Earley_core.Earley.declare_grammar "arrow"
let _ =
Earley_core.Earley.set_grammar arrow
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\134\146" "\226\134\146")
(Earley_core.Earley.empty ()))
let impl = Earley_core.Earley.declare_grammar "impl"
let _ =
Earley_core.Earley.set_grammar impl
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\134\157" "\226\134\157")
(Earley_core.Earley.empty Totality.Any))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\135\146" "\226\135\146")
(Earley_core.Earley.empty Totality.Tot))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\134\146" "\226\134\146")
(Earley_core.Earley.empty Totality.Ter)) []))))
let scis = Earley_core.Earley.declare_grammar "scis"
let _ =
Earley_core.Earley.set_grammar scis
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\156\130" "\226\156\130")
(Earley_core.Earley.empty ()))
let equiv = Earley_core.Earley.declare_grammar "equiv"
let _ =
Earley_core.Earley.set_grammar equiv
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "==" "==")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\137\161" "\226\137\161")
(Earley_core.Earley.empty ())) [])))
let nequiv = Earley_core.Earley.declare_grammar "nequiv"
let _ =
Earley_core.Earley.set_grammar nequiv
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "!=" "!=")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\137\160" "\226\137\160")
(Earley_core.Earley.empty ())) [])))
let neg_sym = Earley_core.Earley.declare_grammar "neg_sym"
let _ =
Earley_core.Earley.set_grammar neg_sym
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\194\172" "\194\172")
(Earley_core.Earley.empty ()))
let prod = Earley_core.Earley.declare_grammar "prod"
let _ =
Earley_core.Earley.set_grammar prod
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\195\151" "\195\151")
(Earley_core.Earley.empty ()))
let lambda = Earley_core.Earley.declare_grammar "lambda"
let _ =
Earley_core.Earley.set_grammar lambda
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\206\187" "\206\187")
(Earley_core.Earley.empty ()))
let langle = Earley_core.Earley.declare_grammar "langle"
let _ =
Earley_core.Earley.set_grammar langle
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\159\168" "\226\159\168")
(Earley_core.Earley.empty ()))
let rangle = Earley_core.Earley.declare_grammar "rangle"
let _ =
Earley_core.Earley.set_grammar rangle
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\159\169" "\226\159\169")
(Earley_core.Earley.empty ()))
let empty_s = Earley_core.Earley.declare_grammar "empty_s"
let _ =
Earley_core.Earley.set_grammar empty_s
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\136\133" "\226\136\133")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "[.]" "[.]")
(Earley_core.Earley.empty ())) [])))
let comma = Earley_core.Earley.declare_grammar "comma"
let _ =
Earley_core.Earley.set_grammar comma
(Earley_core.Earley.fsequence_ignore (Earley_core.Earley.string "," ",")
(Earley_core.Earley.empty ()))
let semi = Earley_core.Earley.declare_grammar "semi"
let _ =
Earley_core.Earley.set_grammar semi
(Earley_core.Earley.fsequence_ignore (Earley_core.Earley.string ";" ";")
(Earley_core.Earley.empty ()))
let column = Earley_core.Earley.declare_grammar "column"
let _ =
Earley_core.Earley.set_grammar column
(Earley_core.Earley.fsequence_ignore (Earley_core.Earley.string ":" ":")
(Earley_core.Earley.empty ()))
let _st_ = Earley_core.Earley.declare_grammar "_st_"
let _ =
Earley_core.Earley.set_grammar _st_
(Earley_core.Earley.fsequence_ignore _such_
(Earley_core.Earley.fsequence_ignore _that_
(Earley_core.Earley.empty ())))
let neg = Earley_core.Earley.declare_grammar "neg"
let _ =
Earley_core.Earley.set_grammar neg
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence neg_sym
(Earley_core.Earley.empty (fun _default_0 -> false)))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.empty ()) (Earley_core.Earley.empty true))
[])))
let v_rec = Earley_core.Earley.declare_grammar "v_rec"
let _ =
Earley_core.Earley.set_grammar v_rec
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence _unsafe_
(Earley_core.Earley.empty (fun _default_0 -> `Unsafe)))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.empty ()) (Earley_core.Earley.empty `Non))
(List.cons
(Earley_core.Earley.fsequence _rec_
(Earley_core.Earley.empty (fun _default_0 -> `Rec))) []))))
let t_rec = Earley_core.Earley.declare_grammar "t_rec"
let _ =
Earley_core.Earley.set_grammar t_rec
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence _corec_
(Earley_core.Earley.empty (fun _default_0 -> `CoRec)))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.empty ()) (Earley_core.Earley.empty `Non))
(List.cons
(Earley_core.Earley.fsequence _rec_
(Earley_core.Earley.empty (fun _default_0 -> `Rec))) []))))
let strict = Earley_core.Earley.declare_grammar "strict"
let _ =
Earley_core.Earley.set_grammar strict
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char ';' ';')
(Earley_core.Earley.fsequence elipsis
(Earley_core.Earley.empty (fun _default_0 -> false))))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.empty ()) (Earley_core.Earley.empty true))
[])))
let eq = Earley_core.Earley.declare_grammar "eq"
let _ =
Earley_core.Earley.set_grammar eq
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence nequiv
(Earley_core.Earley.empty (fun _default_0 -> false)))
(List.cons
(Earley_core.Earley.fsequence equiv
(Earley_core.Earley.empty (fun _default_0 -> true))) [])))
type ps =
| Fs
| As
let (sort, sort__set__grammar) = Earley_core.Earley.grammar_prio "sort"
let _ =
sort__set__grammar
((List.cons
((fun (p : ps) -> p <= Fs),
(Earley_core.Earley.fsequence (sort As)
(Earley_core.Earley.fsequence arrow
(Earley_core.Earley.fsequence (sort Fs)
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun s2 ->
fun _default_0 ->
fun s1 -> in_pos _loc (SFun (s1, s2))))))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<value>" "<value>")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\206\185" "\206\185")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<iota>" "<iota>")
(Earley_core.Earley.empty ())) []))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun _default_0 -> in_pos _loc sv))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<term>" "<term>")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\207\132"
"\207\132") (Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<tau>" "<tau>")
(Earley_core.Earley.empty ())) []))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun _default_0 -> in_pos _loc ST))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<stack>" "<stack>")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\207\131"
"\207\131")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<sigma>"
"<sigma>")
(Earley_core.Earley.empty ())) []))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun _default_0 -> in_pos _loc SS))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<prop>"
"<prop>") (Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\206\191"
"\206\191")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string
"<omicron>" "<omicron>")
(Earley_core.Earley.empty ())) []))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun _default_0 -> in_pos _loc SP))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence
(Earley_core.Earley.alternatives
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "<ordinal>"
"<ordinal>")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\206\186"
"\206\186")
(Earley_core.Earley.empty ()))
(List.cons
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string
"<kappa>" "<kappa>")
(Earley_core.Earley.empty ())) []))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun _default_0 -> in_pos _loc SO))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence lid
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos
__loc__end__buf
__loc__end__pos in
fun id -> in_pos _loc (SVar id)))))
(List.cons
((fun (p : ps) -> p <= As),
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "(" "(")
(Earley_core.Earley.fsequence (sort Fs)
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string ")" ")")
(Earley_core.Earley.empty
(fun s -> s)))))) [])))))))),
(fun (p : ps) -> []))
let sort = sort Fs
let s_arg = Earley_core.Earley.declare_grammar "s_arg"
let _ =
Earley_core.Earley.set_grammar s_arg
(Earley_core.Earley.fsequence llid
(Earley_core.Earley.fsequence
(Earley_core.Earley.option None
(Earley_core.Earley.apply (fun x -> Some x)
(Earley_core.Earley.fsequence_ignore column
(Earley_core.Earley.fsequence sort
(Earley_core.Earley.empty (fun s -> s))))))
(Earley_core.Earley.empty (fun so -> fun id -> (id, so)))))
let s_lst = Earley_core.Earley.declare_grammar "s_lst"
let _ = Earley_core.Earley.set_grammar s_lst (list1 s_arg comma)
let s_args = Earley_core.Earley.declare_grammar "s_args"
let _ =
Earley_core.Earley.set_grammar s_args
(Earley_core.Earley.option []
(Earley_core.Earley.fsequence_ignore langle
(Earley_core.Earley.fsequence s_lst
(Earley_core.Earley.fsequence_ignore rangle
(Earley_core.Earley.empty (fun l -> l))))))
let (<<=) p1 p2 =
match (p1, p2) with
| (_, HO) -> true
| (Any, _) -> true
| (Prp p1, Prp p2) -> p1 <= p2
| (Trm p1, Trm p2) -> p1 <= p2
| (Stk, Stk) -> true
| (Ord p1, Ord p2) -> p1 <= p2
| (_, _) -> false
let (expr, expr__set__grammar) = Earley_core.Earley.grammar_prio "expr"
let ho_args = Earley_core.Earley.declare_grammar "ho_args"
let arg_t = Earley_core.Earley.declare_grammar "arg_t"
let arg = Earley_core.Earley.declare_grammar "arg"
let field_nt = Earley_core.Earley.declare_grammar "field_nt"
let let_arg = Earley_core.Earley.declare_grammar "let_arg"
let field = Earley_core.Earley.declare_grammar "field"
let patt = Earley_core.Earley.declare_grammar "patt"
let set_param = Earley_core.Earley.declare_grammar "set_param"
let rec term = expr (Trm F)
and prop = expr (Prp F)
and stack = expr Stk
and ordinal = expr (Ord F)
and any = expr Any
let _ =
expr__set__grammar
((List.cons
((fun (m : mode) -> (m <<= Stk) || (m <<= (Trm A))),
(Earley_core.Earley.fsequence goal
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf __loc__start__pos
__loc__end__buf __loc__end__pos in
fun s -> in_pos _loc (EGoal s)))))
(List.cons
((fun (m : mode) -> m <<= Any),
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "(" "(")
(Earley_core.Earley.fsequence llid
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string ":" ":")
(Earley_core.Earley.fsequence sort
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "\226\134\166"
"\226\134\166")
(Earley_core.Earley.fsequence any
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string ")" ")")
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos
__loc__end__buf
__loc__end__pos in
fun e ->
fun s ->
fun x ->
in_pos _loc
(EHOFn (x, s, e))))))))))))
(List.cons
((fun (m : mode) -> (m <<= HO) && (m <> (Ord E))),
(Earley_core.Earley.fsequence (expr HO)
(Earley_core.Earley.fsequence ho_args
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun args ->
fun e ->
in_pos _loc
(EHOAp
(e, (new_sort_uvar None), args)))))))
(List.cons
((fun (m : mode) -> m <<= HO),
(Earley_core.Earley.fsequence_position llid
(Earley_core.Earley.fsequence
(Earley_core.Earley.option None
(Earley_core.Earley.apply (fun x -> Some x)
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char '^' '^')
(Earley_core.Earley.fsequence
(expr (Ord E))
(Earley_core.Earley.empty
(fun _default_0 -> _default_0))))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun s ->
fun str1 ->
fun pos1 ->
fun str2 ->
fun pos2 ->
fun id ->
let _loc_id =
locate str1 pos1 str2 pos2 in
match s with
| None ->
evari (Some _loc) id
| Some s ->
let id =
Pos.make id.pos
(id.elt ^ "#") in
let x =
evari (Some _loc_id)
id in
in_pos _loc
(EHOAp
(x,
(new_sort_uvar
None),
[s])))))))
(List.cons
((fun (m : mode) -> m = HO),
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char '(' '(')
(Earley_core.Earley.fsequence (expr Any)
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.char ')' ')')
(Earley_core.Earley.empty
(fun e ->
match e.elt with
| EInfx (e, _) -> e
| _ -> e))))))
(List.cons
((fun (m : mode) -> m <<= (Prp A)),
(Earley_core.Earley.fsequence _bool_
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos __loc__end__buf
__loc__end__pos in
fun _default_0 -> p_bool (Some _loc)))))
(List.cons
((fun (m : mode) -> m <<= (Prp F)),
(Earley_core.Earley.fsequence (expr (Prp P))
(Earley_core.Earley.fsequence impl
(Earley_core.Earley.fsequence prop
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos
__loc__end__buf
__loc__end__pos in
fun b ->
fun t ->
fun a ->
in_pos _loc
(EFunc (t, a, b))))))))
(List.cons
((fun (m : mode) -> m <<= (Prp P)),
(Earley_core.Earley.fsequence (expr (Prp R))
(Earley_core.Earley.fsequence
(Earley_core.Earley.apply
(fun f -> f [])
(Earley_core.Earley.fixpoint1'
(fun l -> l)
(Earley_core.Earley.fsequence_ignore
prod
(Earley_core.Earley.fsequence
(expr (Prp R))
(Earley_core.Earley.empty
(fun b -> b))))
(fun x ->
fun f ->
fun l -> f (List.cons x l))))
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos ->
let _loc =
locate __loc__start__buf
__loc__start__pos
__loc__end__buf
__loc__end__pos in
fun bs ->
fun a ->
tuple_type _loc (a ::
bs))))))
(List.cons
((fun (m : mode) -> m <<= (Prp A)),
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "{" "{")
(Earley_core.Earley.fsequence
(list1
(Earley_core.Earley.fsequence llid
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string
":" ":")
(Earley_core.Earley.fsequence
prop
(Earley_core.Earley.empty
(fun a ->
fun l -> (l, a))))))
semi)
(Earley_core.Earley.fsequence strict
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "}"
"}")
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos
->
let _loc =
locate
__loc__start__buf
__loc__start__pos
__loc__end__buf
__loc__end__pos in
fun s ->
fun fs ->
in_pos _loc
(EProd
(fs, s)))))))))
(List.cons
((fun (m : mode) -> m <<= (Prp A)),
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "{" "{")
(Earley_core.Earley.fsequence elipsis
(Earley_core.Earley.fsequence_ignore
(Earley_core.Earley.string "}"
"}")
(Earley_core.Earley.empty_pos
(fun __loc__start__buf ->
fun __loc__start__pos ->
fun __loc__end__buf ->
fun __loc__end__pos
->