-
Notifications
You must be signed in to change notification settings - Fork 77
/
ast.mli
936 lines (574 loc) · 32.1 KB
/
ast.mli
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
(* This file is part of the Catala compiler, a specification language for tax and social benefits
computation rules. Copyright (C) 2020 Inria, contributor: Denis Merigoux
<denis.merigoux@inria.fr>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License. *)
(** Abstract syntax tree built by the Catala parser *)
open Utils
(** {1 Type definitions} *)
type constructor = string
(** Constructors are CamelCase *)
type ident = string
(** Idents are snake_case *)
type qident = ident Pos.marked list
type primitive_typ =
| Integer
| Decimal
| Boolean
| Money
| Duration
| Text
| Date
| Named of constructor
type base_typ_data = Primitive of primitive_typ | Collection of base_typ_data Pos.marked
type base_typ = Condition | Data of base_typ_data
type func_typ = { arg_typ : base_typ Pos.marked; return_typ : base_typ Pos.marked }
type typ = Base of base_typ | Func of func_typ
type struct_decl_field = {
struct_decl_field_name : ident Pos.marked;
struct_decl_field_typ : typ Pos.marked;
}
type struct_decl = {
struct_decl_name : constructor Pos.marked;
struct_decl_fields : struct_decl_field Pos.marked list;
}
type enum_decl_case = {
enum_decl_case_name : constructor Pos.marked;
enum_decl_case_typ : typ Pos.marked option;
}
type enum_decl = {
enum_decl_name : constructor Pos.marked;
enum_decl_cases : enum_decl_case Pos.marked list;
}
type match_case_pattern =
(constructor Pos.marked option * constructor Pos.marked) list * ident Pos.marked option
type op_kind =
| KInt (** No suffix *)
| KDec (** Suffix: [.] *)
| KMoney (** Suffix: [$] *)
| KDate (** Suffix: [@] *)
| KDuration (** Suffix: [^] *)
type binop =
| And
| Or
| Add of op_kind
| Sub of op_kind
| Mult of op_kind
| Div of op_kind
| Lt of op_kind
| Lte of op_kind
| Gt of op_kind
| Gte of op_kind
| Eq
| Neq
type unop = Not | Minus of op_kind
type builtin_expression = Cardinal | IntToDec | GetDay | GetMonth | GetYear
type literal_date = {
literal_date_day : (int[@opaque]) Pos.marked;
literal_date_month : (int[@opaque]) Pos.marked;
literal_date_year : (int[@opaque]) Pos.marked;
}
type literal_number =
| Int of (Runtime.integer[@opaque])
| Dec of (Runtime.integer[@opaque]) * (Runtime.integer[@opaque])
type literal_unit = Percent | Year | Month | Day
type money_amount = {
money_amount_units : (Runtime.integer[@opaque]);
money_amount_cents : (Runtime.integer[@opaque]);
}
type literal =
| LNumber of literal_number Pos.marked * literal_unit Pos.marked option
| LBool of bool
| LMoneyAmount of money_amount
| LDate of literal_date
type aggregate_func =
| AggregateSum of primitive_typ
| AggregateCount
| AggregateExtremum of bool (* true if max *) * primitive_typ * expression Pos.marked
| AggregateArgExtremum of bool (* true if max *) * primitive_typ * expression Pos.marked
and collection_op = Exists | Forall | Aggregate of aggregate_func | Map | Filter
and match_case = {
match_case_pattern : match_case_pattern Pos.marked;
match_case_expr : expression Pos.marked;
}
and match_cases = match_case Pos.marked list
and expression =
| MatchWith of expression Pos.marked * match_cases Pos.marked
| IfThenElse of expression Pos.marked * expression Pos.marked * expression Pos.marked
| Binop of binop Pos.marked * expression Pos.marked * expression Pos.marked
| Unop of unop Pos.marked * expression Pos.marked
| CollectionOp of
collection_op Pos.marked * ident Pos.marked * expression Pos.marked * expression Pos.marked
| MemCollection of expression Pos.marked * expression Pos.marked
| TestMatchCase of expression Pos.marked * match_case_pattern Pos.marked
| FunCall of expression Pos.marked * expression Pos.marked
| Builtin of builtin_expression
| Literal of literal
| EnumInject of
constructor Pos.marked option * constructor Pos.marked * expression Pos.marked option
| EnumProject of expression Pos.marked * constructor Pos.marked
| StructLit of constructor Pos.marked * (ident Pos.marked * expression Pos.marked) list
| ArrayLit of expression Pos.marked list
| Ident of ident
| Dotted of expression Pos.marked * constructor Pos.marked option * ident Pos.marked
(** Dotted is for both struct field projection and sub-scope variables *)
type exception_to = NotAnException | UnlabeledException | ExceptionToLabel of ident Pos.marked
type rule = {
rule_label : ident Pos.marked option;
rule_exception_to : exception_to;
rule_parameter : ident Pos.marked option;
rule_condition : expression Pos.marked option;
rule_name : qident Pos.marked;
rule_consequence : (bool[@opaque]) Pos.marked;
}
type definition = {
definition_label : ident Pos.marked option;
definition_exception_to : exception_to;
definition_name : qident Pos.marked;
definition_parameter : ident Pos.marked option;
definition_condition : expression Pos.marked option;
definition_expr : expression Pos.marked;
}
type variation_typ = Increasing | Decreasing
type meta_assertion =
| FixedBy of qident Pos.marked * ident Pos.marked
| VariesWith of qident Pos.marked * expression Pos.marked * variation_typ Pos.marked option
type assertion = {
assertion_condition : expression Pos.marked option;
assertion_content : expression Pos.marked;
}
type scope_use_item =
| Rule of rule
| Definition of definition
| Assertion of assertion
| MetaAssertion of meta_assertion
type scope_use = {
scope_use_condition : expression Pos.marked option;
scope_use_name : constructor Pos.marked;
scope_use_items : scope_use_item Pos.marked list;
}
type scope_decl_context_scope = {
scope_decl_context_scope_name : ident Pos.marked;
scope_decl_context_scope_sub_scope : constructor Pos.marked;
}
type scope_decl_context_data = {
scope_decl_context_item_name : ident Pos.marked;
scope_decl_context_item_typ : typ Pos.marked;
}
type scope_decl_context_item =
| ContextData of scope_decl_context_data
| ContextScope of scope_decl_context_scope
type scope_decl = {
scope_decl_name : constructor Pos.marked;
scope_decl_context : scope_decl_context_item Pos.marked list;
}
type code_item =
| ScopeUse of scope_use
| ScopeDecl of scope_decl
| StructDecl of struct_decl
| EnumDecl of enum_decl
type code_block = code_item Pos.marked list
type source_repr = (string[@opaque]) Pos.marked
type law_article = {
law_article_name : (string[@opaque]) Pos.marked;
law_article_id : (string[@opaque]) option;
law_article_expiration_date : (string[@opaque]) option;
}
type law_include =
| PdfFile of (string[@opaque]) Pos.marked * (int[@opaque]) option
| CatalaFile of (string[@opaque]) Pos.marked
| LegislativeText of (string[@opaque]) Pos.marked
type law_article_item = LawText of (string[@opaque]) | CodeBlock of code_block * source_repr
type law_heading = { law_heading_name : (string[@opaque]); law_heading_precedence : (int[@opaque]) }
type law_structure =
| LawInclude of law_include
| LawHeading of law_heading * law_structure list
| LawArticle of law_article * law_article_item list
| MetadataBlock of code_block * source_repr
| IntermediateText of (string[@opaque])
type program_item = LawStructure of law_structure
type program = { program_items : program_item list; program_source_files : (string[@opaque]) list }
type source_file_or_master =
| SourceFile of program_item list
| MasterFile of string Pos.marked list
(** {1 Visitor classes for programs} *)
(** To allow for quick traversal and/or modification of this AST structure, we provide a
{{:https://en.wikipedia.org/wiki/Visitor_pattern} visitor design pattern}. This feature is
implemented via {{:https://gitlab.inria.fr/fpottier/visitors} François Pottier's OCaml visitors
library}. *)
(** {2 Program map visitor} *)
class virtual ['self] program_map :
object ('self)
method visit_Add : 'monomorphic. 'env -> op_kind -> binop
method visit_Aggregate : 'monomorphic. 'env -> aggregate_func -> collection_op
method visit_AggregateArgExtremum :
'monomorphic. 'env -> bool -> primitive_typ -> expression Pos.marked -> aggregate_func
method visit_AggregateCount : 'monomorphic. 'env -> aggregate_func
method visit_AggregateExtremum :
'monomorphic. 'env -> bool -> primitive_typ -> expression Pos.marked -> aggregate_func
method visit_AggregateSum : 'monomorphic. 'env -> primitive_typ -> aggregate_func
method visit_And : 'monomorphic. 'env -> binop
method visit_ArrayLit : 'monomorphic. 'env -> expression Pos.marked list -> expression
method visit_Assertion : 'monomorphic. 'env -> assertion -> scope_use_item
method visit_Base : 'monomorphic. 'env -> base_typ -> typ
method visit_Binop :
'monomorphic. 'env -> binop Pos.marked -> expression Pos.marked -> expression Pos.marked ->
expression
method visit_Boolean : 'monomorphic. 'env -> primitive_typ
method visit_Builtin : 'monomorphic. 'env -> builtin_expression -> expression
method visit_Cardinal : 'monomorphic. 'env -> builtin_expression
method visit_CatalaFile : 'monomorphic. 'env -> string Pos.marked -> law_include
method visit_CodeBlock :
'monomorphic. 'env -> code_block -> string Pos.marked -> law_article_item
method visit_Collection : 'monomorphic. 'env -> base_typ_data Pos.marked -> base_typ_data
method visit_CollectionOp :
'monomorphic. 'env -> collection_op Pos.marked -> ident Pos.marked -> expression Pos.marked ->
expression Pos.marked -> expression
method visit_Condition : 'monomorphic. 'env -> base_typ
method visit_ContextData :
'monomorphic. 'env -> scope_decl_context_data -> scope_decl_context_item
method visit_ContextScope :
'monomorphic. 'env -> scope_decl_context_scope -> scope_decl_context_item
method visit_Data : 'monomorphic. 'env -> base_typ_data -> base_typ
method visit_Date : 'monomorphic. 'env -> primitive_typ
method visit_Day : 'monomorphic. 'env -> literal_unit
method visit_Dec : 'monomorphic. 'env -> Runtime.integer -> Runtime.integer -> literal_number
method visit_Decimal : 'monomorphic. 'env -> primitive_typ
method visit_Decreasing : 'monomorphic. 'env -> variation_typ
method visit_Definition : 'monomorphic. 'env -> definition -> scope_use_item
method visit_Div : 'monomorphic. 'env -> op_kind -> binop
method visit_Dotted :
'monomorphic. 'env -> expression Pos.marked -> constructor Pos.marked option ->
ident Pos.marked -> expression
method visit_Duration : 'monomorphic. 'env -> primitive_typ
method visit_EnumDecl : 'monomorphic. 'env -> enum_decl -> code_item
method visit_EnumInject :
'monomorphic. 'env -> constructor Pos.marked option -> constructor Pos.marked ->
expression Pos.marked option -> expression
method visit_EnumProject :
'monomorphic. 'env -> expression Pos.marked -> constructor Pos.marked -> expression
method visit_Eq : 'monomorphic. 'env -> binop
method visit_ExceptionToLabel : 'monomorphic. 'env -> ident Pos.marked -> exception_to
method visit_Exists : 'monomorphic. 'env -> collection_op
method visit_Filter : 'monomorphic. 'env -> collection_op
method visit_FixedBy :
'monomorphic. 'env -> qident Pos.marked -> ident Pos.marked -> meta_assertion
method visit_Forall : 'monomorphic. 'env -> collection_op
method visit_FunCall :
'monomorphic. 'env -> expression Pos.marked -> expression Pos.marked -> expression
method visit_Func : 'monomorphic. 'env -> func_typ -> typ
method visit_GetDay : 'monomorphic. 'env -> builtin_expression
method visit_GetMonth : 'monomorphic. 'env -> builtin_expression
method visit_GetYear : 'monomorphic. 'env -> builtin_expression
method visit_Gt : 'monomorphic. 'env -> op_kind -> binop
method visit_Gte : 'monomorphic. 'env -> op_kind -> binop
method visit_Ident : 'monomorphic. 'env -> ident -> expression
method visit_IfThenElse :
'monomorphic. 'env -> expression Pos.marked -> expression Pos.marked ->
expression Pos.marked -> expression
method visit_Increasing : 'monomorphic. 'env -> variation_typ
method visit_Int : 'monomorphic. 'env -> Runtime.integer -> literal_number
method visit_IntToDec : 'monomorphic. 'env -> builtin_expression
method visit_Integer : 'monomorphic. 'env -> primitive_typ
method visit_IntermediateText : 'monomorphic. 'env -> string -> law_structure
method visit_KDate : 'monomorphic. 'env -> op_kind
method visit_KDec : 'monomorphic. 'env -> op_kind
method visit_KDuration : 'monomorphic. 'env -> op_kind
method visit_KInt : 'monomorphic. 'env -> op_kind
method visit_KMoney : 'monomorphic. 'env -> op_kind
method visit_LBool : 'monomorphic. 'env -> bool -> literal
method visit_LDate : 'monomorphic. 'env -> literal_date -> literal
method visit_LMoneyAmount : 'monomorphic. 'env -> money_amount -> literal
method visit_LNumber :
'monomorphic. 'env -> literal_number Pos.marked -> literal_unit Pos.marked option -> literal
method visit_LawArticle :
'monomorphic. 'env -> law_article -> law_article_item list -> law_structure
method visit_LawHeading :
'monomorphic. 'env -> law_heading -> law_structure list -> law_structure
method visit_LawInclude : 'monomorphic. 'env -> law_include -> law_structure
method visit_LawStructure : 'monomorphic. 'env -> law_structure -> program_item
method visit_LawText : 'monomorphic. 'env -> string -> law_article_item
method visit_LegislativeText : 'monomorphic. 'env -> string Pos.marked -> law_include
method visit_Literal : 'monomorphic. 'env -> literal -> expression
method visit_Lt : 'monomorphic. 'env -> op_kind -> binop
method visit_Lte : 'monomorphic. 'env -> op_kind -> binop
method visit_Map : 'monomorphic. 'env -> collection_op
method visit_MatchWith :
'monomorphic. 'env -> expression Pos.marked -> match_cases Pos.marked -> expression
method visit_MemCollection :
'monomorphic. 'env -> expression Pos.marked -> expression Pos.marked -> expression
method visit_MetaAssertion : 'monomorphic. 'env -> meta_assertion -> scope_use_item
method visit_MetadataBlock :
'monomorphic. 'env -> code_block -> string Pos.marked -> law_structure
method visit_Minus : 'monomorphic. 'env -> op_kind -> unop
method visit_Money : 'monomorphic. 'env -> primitive_typ
method visit_Month : 'monomorphic. 'env -> literal_unit
method visit_Mult : 'monomorphic. 'env -> op_kind -> binop
method visit_Named : 'monomorphic. 'env -> constructor -> primitive_typ
method visit_Neq : 'monomorphic. 'env -> binop
method visit_Not : 'monomorphic. 'env -> unop
method visit_NotAnException : 'monomorphic. 'env -> exception_to
method visit_Or : 'monomorphic. 'env -> binop
method visit_PdfFile : 'monomorphic. 'env -> string Pos.marked -> int option -> law_include
method visit_Percent : 'monomorphic. 'env -> literal_unit
method visit_Primitive : 'monomorphic. 'env -> primitive_typ -> base_typ_data
method visit_Rule : 'monomorphic. 'env -> rule -> scope_use_item
method visit_ScopeDecl : 'monomorphic. 'env -> scope_decl -> code_item
method visit_ScopeUse : 'monomorphic. 'env -> scope_use -> code_item
method visit_StructDecl : 'monomorphic. 'env -> struct_decl -> code_item
method visit_StructLit :
'monomorphic. 'env -> constructor Pos.marked ->
(ident Pos.marked * expression Pos.marked) list -> expression
method visit_Sub : 'monomorphic. 'env -> op_kind -> binop
method visit_TestMatchCase :
'monomorphic. 'env -> expression Pos.marked -> match_case_pattern Pos.marked -> expression
method visit_Text : 'monomorphic. 'env -> primitive_typ
method visit_UnlabeledException : 'monomorphic. 'env -> exception_to
method visit_Unop : 'monomorphic. 'env -> unop Pos.marked -> expression Pos.marked -> expression
method visit_VariesWith :
'monomorphic. 'env -> qident Pos.marked -> expression Pos.marked ->
variation_typ Pos.marked option -> meta_assertion
method visit_Year : 'monomorphic. 'env -> literal_unit
method visit_aggregate_func : 'monomorphic. 'env -> aggregate_func -> aggregate_func
method visit_assertion : 'monomorphic. 'env -> assertion -> assertion
method visit_base_typ : 'monomorphic. 'env -> base_typ -> base_typ
method visit_base_typ_data : 'monomorphic. 'env -> base_typ_data -> base_typ_data
method visit_binop : 'monomorphic. 'env -> binop -> binop
method visit_builtin_expression : 'monomorphic. 'env -> builtin_expression -> builtin_expression
method visit_code_block :
'monomorphic. 'env -> code_item Pos.marked list -> code_item Pos.marked list
method visit_code_item : 'monomorphic. 'env -> code_item -> code_item
method visit_collection_op : 'monomorphic. 'env -> collection_op -> collection_op
method visit_constructor : 'monomorphic. 'env -> constructor -> constructor
method visit_definition : 'monomorphic. 'env -> definition -> definition
method visit_enum_decl : 'monomorphic. 'env -> enum_decl -> enum_decl
method visit_enum_decl_case : 'monomorphic. 'env -> enum_decl_case -> enum_decl_case
method visit_exception_to : 'monomorphic. 'env -> exception_to -> exception_to
method visit_expression : 'monomorphic. 'env -> expression -> expression
method visit_func_typ : 'monomorphic. 'env -> func_typ -> func_typ
method visit_ident : 'monomorphic. 'env -> ident -> ident
method visit_law_article : 'monomorphic. 'env -> law_article -> law_article
method visit_law_article_item : 'monomorphic. 'env -> law_article_item -> law_article_item
method visit_law_heading : 'monomorphic. 'env -> law_heading -> law_heading
method visit_law_include : 'monomorphic. 'env -> law_include -> law_include
method visit_law_structure : 'monomorphic. 'env -> law_structure -> law_structure
method visit_literal : 'monomorphic. 'env -> literal -> literal
method visit_literal_date : 'monomorphic. 'env -> literal_date -> literal_date
method visit_literal_number : 'monomorphic. 'env -> literal_number -> literal_number
method visit_literal_unit : 'monomorphic. 'env -> literal_unit -> literal_unit
method visit_marked : 'a. ('env -> 'a -> 'a) -> 'env -> 'a Pos.marked -> 'a Pos.marked
method visit_match_case : 'monomorphic. 'env -> match_case -> match_case
method visit_match_case_pattern :
'monomorphic. 'env ->
(constructor Pos.marked option * constructor Pos.marked) list * ident Pos.marked option ->
(constructor Pos.marked option * constructor Pos.marked) list * ident Pos.marked option
method visit_match_cases : 'monomorphic. 'env -> match_cases -> match_cases
method visit_meta_assertion : 'monomorphic. 'env -> meta_assertion -> meta_assertion
method visit_money_amount : 'monomorphic. 'env -> money_amount -> money_amount
method visit_op_kind : 'monomorphic. 'env -> op_kind -> op_kind
method visit_primitive_typ : 'monomorphic. 'env -> primitive_typ -> primitive_typ
method visit_program : 'monomorphic. 'env -> program -> program
method visit_program_item : 'monomorphic. 'env -> program_item -> program_item
method visit_qident : 'monomorphic. 'env -> ident Pos.marked list -> ident Pos.marked list
method visit_rule : 'monomorphic. 'env -> rule -> rule
method visit_scope_decl : 'monomorphic. 'env -> scope_decl -> scope_decl
method visit_scope_decl_context_data :
'monomorphic. 'env -> scope_decl_context_data -> scope_decl_context_data
method visit_scope_decl_context_item :
'monomorphic. 'env -> scope_decl_context_item -> scope_decl_context_item
method visit_scope_decl_context_scope :
'monomorphic. 'env -> scope_decl_context_scope -> scope_decl_context_scope
method visit_scope_use : 'monomorphic. 'env -> scope_use -> scope_use
method visit_scope_use_item : 'monomorphic. 'env -> scope_use_item -> scope_use_item
method visit_source_repr : 'monomorphic. 'env -> string Pos.marked -> string Pos.marked
method visit_struct_decl : 'monomorphic. 'env -> struct_decl -> struct_decl
method visit_struct_decl_field : 'monomorphic. 'env -> struct_decl_field -> struct_decl_field
method visit_typ : 'monomorphic. 'env -> typ -> typ
method visit_unop : 'monomorphic. 'env -> unop -> unop
method visit_variation_typ : 'monomorphic. 'env -> variation_typ -> variation_typ
end
(** {2 Program iter visitor} *)
class virtual ['self] program_iter :
object ('self)
method visit_Add : 'monomorphic. 'env -> op_kind -> unit
method visit_Aggregate : 'monomorphic. 'env -> aggregate_func -> unit
method visit_AggregateArgExtremum :
'monomorphic. 'env -> bool -> primitive_typ -> expression Pos.marked -> unit
method visit_AggregateCount : 'monomorphic. 'env -> unit
method visit_AggregateExtremum :
'monomorphic. 'env -> bool -> primitive_typ -> expression Pos.marked -> unit
method visit_AggregateSum : 'monomorphic. 'env -> primitive_typ -> unit
method visit_And : 'monomorphic. 'env -> unit
method visit_ArrayLit : 'monomorphic. 'env -> expression Pos.marked list -> unit
method visit_Assertion : 'monomorphic. 'env -> assertion -> unit
method visit_Base : 'monomorphic. 'env -> base_typ -> unit
method visit_Binop :
'monomorphic. 'env -> binop Pos.marked -> expression Pos.marked -> expression Pos.marked ->
unit
method visit_Boolean : 'monomorphic. 'env -> unit
method visit_Builtin : 'monomorphic. 'env -> builtin_expression -> unit
method visit_Cardinal : 'monomorphic. 'env -> unit
method visit_CatalaFile : 'monomorphic. 'env -> string Pos.marked -> unit
method visit_CodeBlock : 'monomorphic. 'env -> code_block -> string Pos.marked -> unit
method visit_Collection : 'monomorphic. 'env -> base_typ_data Pos.marked -> unit
method visit_CollectionOp :
'monomorphic. 'env -> collection_op Pos.marked -> ident Pos.marked -> expression Pos.marked ->
expression Pos.marked -> unit
method visit_Condition : 'monomorphic. 'env -> unit
method visit_ContextData : 'monomorphic. 'env -> scope_decl_context_data -> unit
method visit_ContextScope : 'monomorphic. 'env -> scope_decl_context_scope -> unit
method visit_Data : 'monomorphic. 'env -> base_typ_data -> unit
method visit_Date : 'monomorphic. 'env -> unit
method visit_Day : 'monomorphic. 'env -> unit
method visit_Dec : 'monomorphic. 'env -> Runtime.integer -> Runtime.integer -> unit
method visit_Decimal : 'monomorphic. 'env -> unit
method visit_Decreasing : 'monomorphic. 'env -> unit
method visit_Definition : 'monomorphic. 'env -> definition -> unit
method visit_Div : 'monomorphic. 'env -> op_kind -> unit
method visit_Dotted :
'monomorphic. 'env -> expression Pos.marked -> constructor Pos.marked option ->
ident Pos.marked -> unit
method visit_Duration : 'monomorphic. 'env -> unit
method visit_EnumDecl : 'monomorphic. 'env -> enum_decl -> unit
method visit_EnumInject :
'monomorphic. 'env -> constructor Pos.marked option -> constructor Pos.marked ->
expression Pos.marked option -> unit
method visit_EnumProject :
'monomorphic. 'env -> expression Pos.marked -> constructor Pos.marked -> unit
method visit_Eq : 'monomorphic. 'env -> unit
method visit_ExceptionToLabel : 'monomorphic. 'env -> ident Pos.marked -> unit
method visit_Exists : 'monomorphic. 'env -> unit
method visit_Filter : 'monomorphic. 'env -> unit
method visit_FixedBy : 'monomorphic. 'env -> qident Pos.marked -> ident Pos.marked -> unit
method visit_Forall : 'monomorphic. 'env -> unit
method visit_FunCall :
'monomorphic. 'env -> expression Pos.marked -> expression Pos.marked -> unit
method visit_Func : 'monomorphic. 'env -> func_typ -> unit
method visit_GetDay : 'monomorphic. 'env -> unit
method visit_GetMonth : 'monomorphic. 'env -> unit
method visit_GetYear : 'monomorphic. 'env -> unit
method visit_Gt : 'monomorphic. 'env -> op_kind -> unit
method visit_Gte : 'monomorphic. 'env -> op_kind -> unit
method visit_Ident : 'monomorphic. 'env -> ident -> unit
method visit_IfThenElse :
'monomorphic. 'env -> expression Pos.marked -> expression Pos.marked ->
expression Pos.marked -> unit
method visit_Increasing : 'monomorphic. 'env -> unit
method visit_Int : 'monomorphic. 'env -> Runtime.integer -> unit
method visit_IntToDec : 'monomorphic. 'env -> unit
method visit_Integer : 'monomorphic. 'env -> unit
method visit_IntermediateText : 'monomorphic. 'env -> string -> unit
method visit_KDate : 'monomorphic. 'env -> unit
method visit_KDec : 'monomorphic. 'env -> unit
method visit_KDuration : 'monomorphic. 'env -> unit
method visit_KInt : 'monomorphic. 'env -> unit
method visit_KMoney : 'monomorphic. 'env -> unit
method visit_LBool : 'monomorphic. 'env -> bool -> unit
method visit_LDate : 'monomorphic. 'env -> literal_date -> unit
method visit_LMoneyAmount : 'monomorphic. 'env -> money_amount -> unit
method visit_LNumber :
'monomorphic. 'env -> literal_number Pos.marked -> literal_unit Pos.marked option -> unit
method visit_LawArticle : 'monomorphic. 'env -> law_article -> law_article_item list -> unit
method visit_LawHeading : 'monomorphic. 'env -> law_heading -> law_structure list -> unit
method visit_LawInclude : 'monomorphic. 'env -> law_include -> unit
method visit_LawStructure : 'monomorphic. 'env -> law_structure -> unit
method visit_LawText : 'monomorphic. 'env -> string -> unit
method visit_LegislativeText : 'monomorphic. 'env -> string Pos.marked -> unit
method visit_Literal : 'monomorphic. 'env -> literal -> unit
method visit_Lt : 'monomorphic. 'env -> op_kind -> unit
method visit_Lte : 'monomorphic. 'env -> op_kind -> unit
method visit_Map : 'monomorphic. 'env -> unit
method visit_MatchWith :
'monomorphic. 'env -> expression Pos.marked -> match_cases Pos.marked -> unit
method visit_MemCollection :
'monomorphic. 'env -> expression Pos.marked -> expression Pos.marked -> unit
method visit_MetaAssertion : 'monomorphic. 'env -> meta_assertion -> unit
method visit_MetadataBlock : 'monomorphic. 'env -> code_block -> string Pos.marked -> unit
method visit_Minus : 'monomorphic. 'env -> op_kind -> unit
method visit_Money : 'monomorphic. 'env -> unit
method visit_Month : 'monomorphic. 'env -> unit
method visit_Mult : 'monomorphic. 'env -> op_kind -> unit
method visit_Named : 'monomorphic. 'env -> constructor -> unit
method visit_Neq : 'monomorphic. 'env -> unit
method visit_Not : 'monomorphic. 'env -> unit
method visit_NotAnException : 'monomorphic. 'env -> unit
method visit_Or : 'monomorphic. 'env -> unit
method visit_PdfFile : 'monomorphic. 'env -> string Pos.marked -> int option -> unit
method visit_Percent : 'monomorphic. 'env -> unit
method visit_Primitive : 'monomorphic. 'env -> primitive_typ -> unit
method visit_Rule : 'monomorphic. 'env -> rule -> unit
method visit_ScopeDecl : 'monomorphic. 'env -> scope_decl -> unit
method visit_ScopeUse : 'monomorphic. 'env -> scope_use -> unit
method visit_StructDecl : 'monomorphic. 'env -> struct_decl -> unit
method visit_StructLit :
'monomorphic. 'env -> constructor Pos.marked ->
(ident Pos.marked * expression Pos.marked) list -> unit
method visit_Sub : 'monomorphic. 'env -> op_kind -> unit
method visit_TestMatchCase :
'monomorphic. 'env -> expression Pos.marked -> match_case_pattern Pos.marked -> unit
method visit_Text : 'monomorphic. 'env -> unit
method visit_UnlabeledException : 'monomorphic. 'env -> unit
method visit_Unop : 'monomorphic. 'env -> unop Pos.marked -> expression Pos.marked -> unit
method visit_VariesWith :
'monomorphic. 'env -> qident Pos.marked -> expression Pos.marked ->
variation_typ Pos.marked option -> unit
method visit_Year : 'monomorphic. 'env -> unit
method visit_aggregate_func : 'monomorphic. 'env -> aggregate_func -> unit
method visit_assertion : 'monomorphic. 'env -> assertion -> unit
method visit_base_typ : 'monomorphic. 'env -> base_typ -> unit
method visit_base_typ_data : 'monomorphic. 'env -> base_typ_data -> unit
method visit_binop : 'monomorphic. 'env -> binop -> unit
method visit_builtin_expression : 'monomorphic. 'env -> builtin_expression -> unit
method visit_code_block : 'monomorphic. 'env -> code_item Pos.marked list -> unit
method visit_code_item : 'monomorphic. 'env -> code_item -> unit
method visit_collection_op : 'monomorphic. 'env -> collection_op -> unit
method visit_constructor : 'monomorphic. 'env -> constructor -> unit
method visit_definition : 'monomorphic. 'env -> definition -> unit
method visit_enum_decl : 'monomorphic. 'env -> enum_decl -> unit
method visit_enum_decl_case : 'monomorphic. 'env -> enum_decl_case -> unit
method visit_exception_to : 'monomorphic. 'env -> exception_to -> unit
method visit_expression : 'monomorphic. 'env -> expression -> unit
method visit_func_typ : 'monomorphic. 'env -> func_typ -> unit
method visit_ident : 'monomorphic. 'env -> ident -> unit
method visit_law_article : 'monomorphic. 'env -> law_article -> unit
method visit_law_article_item : 'monomorphic. 'env -> law_article_item -> unit
method visit_law_heading : 'monomorphic. 'env -> law_heading -> unit
method visit_law_include : 'monomorphic. 'env -> law_include -> unit
method visit_law_structure : 'monomorphic. 'env -> law_structure -> unit
method visit_literal : 'monomorphic. 'env -> literal -> unit
method visit_literal_date : 'monomorphic. 'env -> literal_date -> unit
method visit_literal_number : 'monomorphic. 'env -> literal_number -> unit
method visit_literal_unit : 'monomorphic. 'env -> literal_unit -> unit
method visit_marked : 'a. ('env -> 'a -> unit) -> 'env -> 'a Pos.marked -> unit
method visit_match_case : 'monomorphic. 'env -> match_case -> unit
method visit_match_case_pattern :
'monomorphic. 'env ->
(constructor Pos.marked option * constructor Pos.marked) list * ident Pos.marked option ->
unit
method visit_match_cases : 'monomorphic. 'env -> match_cases -> unit
method visit_meta_assertion : 'monomorphic. 'env -> meta_assertion -> unit
method visit_money_amount : 'monomorphic. 'env -> money_amount -> unit
method visit_op_kind : 'monomorphic. 'env -> op_kind -> unit
method visit_primitive_typ : 'monomorphic. 'env -> primitive_typ -> unit
method visit_program : 'monomorphic. 'env -> program -> unit
method visit_program_item : 'monomorphic. 'env -> program_item -> unit
method visit_qident : 'monomorphic. 'env -> ident Pos.marked list -> unit
method visit_rule : 'monomorphic. 'env -> rule -> unit
method visit_scope_decl : 'monomorphic. 'env -> scope_decl -> unit
method visit_scope_decl_context_data : 'monomorphic. 'env -> scope_decl_context_data -> unit
method visit_scope_decl_context_item : 'monomorphic. 'env -> scope_decl_context_item -> unit
method visit_scope_decl_context_scope : 'monomorphic. 'env -> scope_decl_context_scope -> unit
method visit_scope_use : 'monomorphic. 'env -> scope_use -> unit
method visit_scope_use_item : 'monomorphic. 'env -> scope_use_item -> unit
method visit_source_repr : 'monomorphic. 'env -> string Pos.marked -> unit
method visit_struct_decl : 'monomorphic. 'env -> struct_decl -> unit
method visit_struct_decl_field : 'monomorphic. 'env -> struct_decl_field -> unit
method visit_typ : 'monomorphic. 'env -> typ -> unit
method visit_unop : 'monomorphic. 'env -> unop -> unit
method visit_variation_typ : 'monomorphic. 'env -> variation_typ -> unit
end