package catala
Compiler and library for the literate programming language for tax code specification
Install
Dune Dependency
Authors
Maintainers
Sources
0.8.0.tar.gz
md5=1408a1cce45c7d5990b981e83e7589c2
sha512=eb3b923aa1f743378b4a05e30f50be5d180dc862a716270d747a90e469017f42fa5fc41352f02fbbf59cd2560f91c4f1b32cf38d80085b105d9387b0aed2039d
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
foo.bar
in binding position: used to specify variables of subscopes
include sig ... end
include sig ... end
Source
type primitive_typ =
| Integer
| Decimal
| Boolean
| Money
| Duration
| Text
| Date
| Named of path * uident Catala_utils.Marked.pos
include sig ... end
include sig ... end
Source
type base_typ_data =
| Primitive of primitive_typ
| Collection of base_typ_data Catala_utils.Marked.pos
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type func_typ = {
arg_typ : (lident Catala_utils.Marked.pos * base_typ Catala_utils.Marked.pos) list;
return_typ : base_typ Catala_utils.Marked.pos;
}
include sig ... end
include sig ... end
Source
type struct_decl_field = {
struct_decl_field_name : lident Catala_utils.Marked.pos;
struct_decl_field_typ : typ;
}
include sig ... end
include sig ... end
Source
type struct_decl = {
struct_decl_name : uident Catala_utils.Marked.pos;
struct_decl_fields : struct_decl_field Catala_utils.Marked.pos list;
}
include sig ... end
include sig ... end
Source
type enum_decl_case = {
enum_decl_case_name : uident Catala_utils.Marked.pos;
enum_decl_case_typ : typ option;
}
include sig ... end
include sig ... end
Source
type enum_decl = {
enum_decl_name : uident Catala_utils.Marked.pos;
enum_decl_cases : enum_decl_case Catala_utils.Marked.pos list;
}
include sig ... end
include sig ... end
Source
type match_case_pattern =
(path * uident Catala_utils.Marked.pos) Catala_utils.Marked.pos list
* lident Catala_utils.Marked.pos option
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type literal =
| LNumber of literal_number Catala_utils.Marked.pos * literal_unit Catala_utils.Marked.pos option
| LBool of bool
| LMoneyAmount of money_amount
| LDate of literal_date
include sig ... end
include sig ... end
Source
type collection_op =
| Exists of {
predicate : lident Catala_utils.Marked.pos * expression;
}
| Forall of {
predicate : lident Catala_utils.Marked.pos * expression;
}
| Map of {
}
| Filter of {
}
| AggregateSum of {
typ : primitive_typ;
}
| AggregateExtremum of {
max : bool;
default : expression;
}
| AggregateArgExtremum of {
max : bool;
default : expression;
f : lident Catala_utils.Marked.pos * expression;
}
Source
and explicit_match_case = {
match_case_pattern : match_case_pattern Catala_utils.Marked.pos;
match_case_expr : expression;
}
Source
and naked_expression =
| Paren of expression
| MatchWith of expression * match_cases Catala_utils.Marked.pos
| IfThenElse of expression * expression * expression
| Binop of binop Catala_utils.Marked.pos * expression * expression
| Unop of unop Catala_utils.Marked.pos * expression
| CollectionOp of collection_op * expression
| MemCollection of expression * expression
| TestMatchCase of expression * match_case_pattern Catala_utils.Marked.pos
| FunCall of expression * expression list
| ScopeCall of (path * uident Catala_utils.Marked.pos) Catala_utils.Marked.pos * (lident Catala_utils.Marked.pos * expression) list
| LetIn of lident Catala_utils.Marked.pos * expression * expression
| Builtin of builtin_expression
| Literal of literal
| EnumInject of (path * uident Catala_utils.Marked.pos) Catala_utils.Marked.pos * expression option
| StructLit of (path * uident Catala_utils.Marked.pos) Catala_utils.Marked.pos * (lident Catala_utils.Marked.pos * expression) list
| ArrayLit of expression list
| Ident of path * lident Catala_utils.Marked.pos
| Dotted of expression * (path * lident Catala_utils.Marked.pos) Catala_utils.Marked.pos
(*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 lident Catala_utils.Marked.pos
include sig ... end
include sig ... end
Source
type rule = {
rule_label : lident Catala_utils.Marked.pos option;
rule_exception_to : exception_to;
rule_parameter : lident Catala_utils.Marked.pos list Catala_utils.Marked.pos option;
rule_condition : expression option;
rule_name : scope_var Catala_utils.Marked.pos;
rule_id : Shared_ast.RuleName.t;
rule_consequence : bool Catala_utils.Marked.pos;
rule_state : lident Catala_utils.Marked.pos option;
}
Source
type definition = {
definition_label : lident Catala_utils.Marked.pos option;
definition_exception_to : exception_to;
definition_name : scope_var Catala_utils.Marked.pos;
definition_parameter : lident Catala_utils.Marked.pos list Catala_utils.Marked.pos option;
definition_condition : expression option;
definition_id : Shared_ast.RuleName.t;
definition_expr : expression;
definition_state : lident Catala_utils.Marked.pos option;
}
include sig ... end
include sig ... end
include sig ... end
include sig ... end
Source
type meta_assertion =
| FixedBy of scope_var Catala_utils.Marked.pos * lident Catala_utils.Marked.pos
| VariesWith of scope_var Catala_utils.Marked.pos * expression * variation_typ Catala_utils.Marked.pos option
include sig ... end
include sig ... end
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 option;
scope_use_name : uident Catala_utils.Marked.pos;
scope_use_items : scope_use_item Catala_utils.Marked.pos 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 Catala_utils.Marked.pos;
scope_decl_context_io_output : bool Catala_utils.Marked.pos;
}
include sig ... end
include sig ... end
Source
type scope_decl_context_scope = {
scope_decl_context_scope_name : lident Catala_utils.Marked.pos;
scope_decl_context_scope_sub_scope : uident Catala_utils.Marked.pos;
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 : lident Catala_utils.Marked.pos;
scope_decl_context_item_typ : typ;
scope_decl_context_item_parameters : (lident Catala_utils.Marked.pos * typ) list Catala_utils.Marked.pos option;
scope_decl_context_item_attribute : scope_decl_context_io;
scope_decl_context_item_states : lident Catala_utils.Marked.pos 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 : uident Catala_utils.Marked.pos;
scope_decl_context : scope_decl_context_item Catala_utils.Marked.pos list;
}
include sig ... end
include sig ... end
Source
type top_def = {
topdef_name : lident Catala_utils.Marked.pos;
topdef_args : (lident Catala_utils.Marked.pos * base_typ Catala_utils.Marked.pos) list Catala_utils.Marked.pos option;
(*Empty list if this is not a function
*)topdef_type : typ;
topdef_expr : expression;
}
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
| Topdef of top_def
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 Catala_utils.Marked.pos;
law_heading_id : string option;
law_heading_is_archive : bool;
law_heading_precedence : int;
}
include sig ... end
include sig ... end
Source
type law_include =
| PdfFile of string Catala_utils.Marked.pos * int option
| CatalaFile of string Catala_utils.Marked.pos
| LegislativeText of string Catala_utils.Marked.pos
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
Source
val type_from_args :
(lident Catala_utils.Marked.pos * base_typ Catala_utils.Marked.pos) list
Catala_utils.Marked.pos
option ->
base_typ Catala_utils.Marked.pos ->
typ
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page