package catala
Compiler and library for the literate programming language for tax code specification
Install
Dune Dependency
Authors
Maintainers
Sources
0.6.0.tar.gz
md5=b22e238d5d5c8452067109e9c7c0f427
sha512=ccc8c557c67c2f9d1bed4b957b2367f0f6afc0ef9b8b83237cf2a2912b3e8829b7e8af78ea7fe00b20ecf28b436ad04b591e5fff4f82fd08725d40a18c9924d0
doc/catala.surface/Surface/Ast/index.html
Module Surface.Ast
Source
Abstract syntax tree built by the Catala parser
To allow for quick traversal and/or modification of this AST structure, we provide a visitor design pattern. This feature is implemented via François Pottier's OCaml visitors library.
Type definitions
Constructors are CamelCase
include sig ... end
include sig ... end
Idents are snake_case
include sig ... end
include sig ... end
include sig ... end
Source
type primitive_typ =
| Integer
| Decimal
| Boolean
| Money
| Duration
| Text
| Date
| Named of constructor
include sig ... end
include sig ... end
Source
type base_typ_data =
| Primitive of primitive_typ
| Collection of base_typ_data Utils.Pos.marked
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type struct_decl_field = {
struct_decl_field_name : ident Utils.Pos.marked;
struct_decl_field_typ : typ Utils.Pos.marked;
}
include sig ... end
include sig ... end
Source
type struct_decl = {
struct_decl_name : constructor Utils.Pos.marked;
struct_decl_fields : struct_decl_field Utils.Pos.marked list;
}
include sig ... end
include sig ... end
Source
type enum_decl_case = {
enum_decl_case_name : constructor Utils.Pos.marked;
enum_decl_case_typ : typ Utils.Pos.marked option;
}
include sig ... end
include sig ... end
Source
type enum_decl = {
enum_decl_name : constructor Utils.Pos.marked;
enum_decl_cases : enum_decl_case Utils.Pos.marked list;
}
include sig ... end
include sig ... end
Source
type match_case_pattern =
(constructor Utils.Pos.marked option * constructor Utils.Pos.marked) list
* ident Utils.Pos.marked option
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type literal_date = {
literal_date_day : int Utils.Pos.marked;
literal_date_month : int Utils.Pos.marked;
literal_date_year : int Utils.Pos.marked;
}
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type money_amount = {
money_amount_units : Runtime.integer;
money_amount_cents : Runtime.integer;
}
include sig ... end
include sig ... end
Source
type literal =
| LNumber of literal_number Utils.Pos.marked * literal_unit Utils.Pos.marked option
| LBool of bool
| LMoneyAmount of money_amount
| LDate of literal_date
include sig ... end
include sig ... end
Source
type aggregate_func =
| AggregateSum of primitive_typ
| AggregateCount
| AggregateExtremum of bool * primitive_typ * expression Utils.Pos.marked
| AggregateArgExtremum of bool * primitive_typ * expression Utils.Pos.marked
Source
and explicit_match_case = {
match_case_pattern : match_case_pattern Utils.Pos.marked;
match_case_expr : expression Utils.Pos.marked;
}
Source
and expression =
| MatchWith of expression Utils.Pos.marked * match_cases Utils.Pos.marked
| IfThenElse of expression Utils.Pos.marked * expression Utils.Pos.marked * expression Utils.Pos.marked
| Binop of binop Utils.Pos.marked * expression Utils.Pos.marked * expression Utils.Pos.marked
| Unop of unop Utils.Pos.marked * expression Utils.Pos.marked
| CollectionOp of collection_op Utils.Pos.marked * ident Utils.Pos.marked * expression Utils.Pos.marked * expression Utils.Pos.marked
| MemCollection of expression Utils.Pos.marked * expression Utils.Pos.marked
| TestMatchCase of expression Utils.Pos.marked * match_case_pattern Utils.Pos.marked
| FunCall of expression Utils.Pos.marked * expression Utils.Pos.marked
| Builtin of builtin_expression
| Literal of literal
| EnumInject of constructor Utils.Pos.marked option * constructor Utils.Pos.marked * expression Utils.Pos.marked option
| StructLit of constructor Utils.Pos.marked * (ident Utils.Pos.marked * expression Utils.Pos.marked) list
| ArrayLit of expression Utils.Pos.marked list
| Ident of ident
| Dotted of expression Utils.Pos.marked * constructor Utils.Pos.marked option * ident Utils.Pos.marked
(*Dotted is for both struct field projection and sub-scope variables
*)
include sig ... end
include sig ... end
Source
type exception_to =
| NotAnException
| UnlabeledException
| ExceptionToLabel of ident Utils.Pos.marked
include sig ... end
include sig ... end
Source
type rule = {
rule_label : ident Utils.Pos.marked option;
rule_exception_to : exception_to;
rule_parameter : ident Utils.Pos.marked option;
rule_condition : expression Utils.Pos.marked option;
rule_name : qident Utils.Pos.marked;
rule_id : Desugared.Ast.RuleName.t;
rule_consequence : bool Utils.Pos.marked;
rule_state : ident Utils.Pos.marked option;
}
Source
type definition = {
definition_label : ident Utils.Pos.marked option;
definition_exception_to : exception_to;
definition_name : qident Utils.Pos.marked;
definition_parameter : ident Utils.Pos.marked option;
definition_condition : expression Utils.Pos.marked option;
definition_id : Desugared.Ast.RuleName.t;
definition_expr : expression Utils.Pos.marked;
definition_state : ident Utils.Pos.marked option;
}
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type meta_assertion =
| FixedBy of qident Utils.Pos.marked * ident Utils.Pos.marked
| VariesWith of qident Utils.Pos.marked * expression Utils.Pos.marked * variation_typ Utils.Pos.marked option
include sig ... end
include sig ... end
Source
type assertion = {
assertion_condition : expression Utils.Pos.marked option;
assertion_content : expression Utils.Pos.marked;
}
include sig ... end
include sig ... end
Source
type scope_use_item =
| Rule of rule
| Definition of definition
| Assertion of assertion
| MetaAssertion of meta_assertion
include sig ... end
include sig ... end
Source
type scope_use = {
scope_use_condition : expression Utils.Pos.marked option;
scope_use_name : constructor Utils.Pos.marked;
scope_use_items : scope_use_item Utils.Pos.marked list;
}
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type scope_decl_context_io = {
scope_decl_context_io_input : io_input Utils.Pos.marked;
scope_decl_context_io_output : bool Utils.Pos.marked;
}
include sig ... end
include sig ... end
Source
type scope_decl_context_scope = {
scope_decl_context_scope_name : ident Utils.Pos.marked;
scope_decl_context_scope_sub_scope : constructor Utils.Pos.marked;
scope_decl_context_scope_attribute : scope_decl_context_io;
}
include sig ... end
include sig ... end
Source
type scope_decl_context_data = {
scope_decl_context_item_name : ident Utils.Pos.marked;
scope_decl_context_item_typ : typ Utils.Pos.marked;
scope_decl_context_item_attribute : scope_decl_context_io;
scope_decl_context_item_states : ident Utils.Pos.marked list;
}
include sig ... end
include sig ... end
Source
type scope_decl_context_item =
| ContextData of scope_decl_context_data
| ContextScope of scope_decl_context_scope
include sig ... end
include sig ... end
Source
type scope_decl = {
scope_decl_name : constructor Utils.Pos.marked;
scope_decl_context : scope_decl_context_item Utils.Pos.marked list;
}
include sig ... end
include sig ... end
Source
type code_item =
| ScopeUse of scope_use
| ScopeDecl of scope_decl
| StructDecl of struct_decl
| EnumDecl of enum_decl
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type law_heading = {
law_heading_name : string Utils.Pos.marked;
law_heading_id : string option;
law_heading_expiration_date : string option;
law_heading_precedence : int;
}
include sig ... end
include sig ... end
Source
type law_include =
| PdfFile of string Utils.Pos.marked * int option
| CatalaFile of string Utils.Pos.marked
| LegislativeText of string Utils.Pos.marked
include sig ... end
include sig ... end
Source
type law_structure =
| LawInclude of law_include
| LawHeading of law_heading * law_structure list
| LawText of string
| CodeBlock of code_block * source_repr * bool
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Helpers
Translates a rule
into the corresponding definition
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page