package catala
Compiler and library for the literate programming language for tax code specification
Install
dune-project
Dependency
Authors
Maintainers
Sources
1.0.0-alpha.tar.gz
md5=2615968670ac21b1d00386a9b04b3843
sha512=eff292fdd75012f26ce7b17020f5a8374eef37cd4dd6ba60338dfbe89fbcad3443d1b409e44c182b740da9f58dff7e76dcb8ddefe47f9b2b160666d1c6930143
doc/catala.surface/Surface/Ast/index.html
Module Surface.Ast
Source
Abstract syntax tree built by the Catala parser
Type definitions
Constructors are CamelCase
Idents are snake_case
foo.bar
in binding position: used to specify variables of subscopes
Source
type primitive_typ =
| Integer
| Decimal
| Boolean
| Money
| Duration
| Date
| Position
| External of lident
| Named of path * uident Catala_utils.Mark.pos
| Var of lident Catala_utils.Mark.pos option
Source
type base_typ_data =
| Primitive of primitive_typ
| Collection of base_typ_data Catala_utils.Mark.pos
| Option of base_typ_data Catala_utils.Mark.pos
| TTuple of base_typ_data Catala_utils.Mark.pos list
Source
type enum_constr =
| CBuiltin of builtin_constr
| CConstr of path * uident Catala_utils.Mark.pos
Source
type func_typ = {
arg_typ : (lident Catala_utils.Mark.pos * base_typ Catala_utils.Mark.pos) list;
return_typ : base_typ Catala_utils.Mark.pos;
}
Source
type struct_decl_field = {
struct_decl_field_name : lident Catala_utils.Mark.pos;
struct_decl_field_typ : typ;
}
Source
type struct_decl = {
struct_decl_name : uident Catala_utils.Mark.pos;
struct_decl_fields : struct_decl_field Catala_utils.Mark.pos list;
}
Source
type enum_decl_case = {
enum_decl_case_name : uident Catala_utils.Mark.pos;
enum_decl_case_typ : typ option;
}
Source
type enum_decl = {
enum_decl_name : uident Catala_utils.Mark.pos;
enum_decl_cases : enum_decl_case Catala_utils.Mark.pos list;
}
Source
type match_case_pattern =
enum_constr Catala_utils.Mark.pos list * lident Catala_utils.Mark.pos option
Source
type money_amount = {
money_amount_sign : bool;
(*true is positive
*)money_amount_units : string;
money_amount_cents : string;
}
Source
type literal =
| LNumber of literal_number Catala_utils.Mark.pos * literal_unit Catala_utils.Mark.pos option
| LBool of bool
| LMoneyAmount of money_amount
| LDate of literal_date
Source
type collection_op =
| Member of {
element : expression;
}
| Exists of {
predicate : lident Catala_utils.Mark.pos list * expression;
}
| Forall of {
predicate : lident Catala_utils.Mark.pos list * expression;
}
| Map of {
f : lident Catala_utils.Mark.pos list * expression;
}
| Filter of {
f : lident Catala_utils.Mark.pos list * expression;
}
| AggregateSum of {
typ : primitive_typ;
}
| AggregateExtremum of {
max : bool;
default : expression option;
}
| AggregateArgExtremum of {
max : bool;
default : expression option;
f : lident Catala_utils.Mark.pos list * expression;
}
| Fold of {
f : lident Catala_utils.Mark.pos list * lident Catala_utils.Mark.pos list * expression;
init : expression;
}
Source
and explicit_match_case = {
match_case_pattern : match_case_pattern Catala_utils.Mark.pos;
match_case_expr : expression;
}
Source
and naked_expression =
| Paren of expression
| MatchWith of expression * match_cases Catala_utils.Mark.pos
| IfThenElse of expression * expression * expression
| Binop of binop Catala_utils.Mark.pos * expression * expression
| Unop of unop Catala_utils.Mark.pos * expression
| CollectionOp of collection_op Catala_utils.Mark.pos * expression
| TestMatchCase of expression * match_case_pattern Catala_utils.Mark.pos
| FunCall of expression * expression list
| ScopeCall of (path * uident Catala_utils.Mark.pos) Catala_utils.Mark.pos * (lident Catala_utils.Mark.pos * expression) list
| LetIn of lident Catala_utils.Mark.pos list * expression * expression
| Builtin of builtin_expression
| Literal of literal
| EnumInject of enum_constr Catala_utils.Mark.pos * expression option
| StructLit of (path * uident Catala_utils.Mark.pos) Catala_utils.Mark.pos * (lident Catala_utils.Mark.pos * expression) list
| StructReplace of expression * (lident Catala_utils.Mark.pos * expression) list
| ArrayLit of expression list
| Tuple of expression list
| Ident of path * lident Catala_utils.Mark.pos * lident Catala_utils.Mark.pos option
| Dotted of expression * (path * lident Catala_utils.Mark.pos) Catala_utils.Mark.pos
(*Dotted is for both struct field projection and sub-scope variables
*)| TupleAccess of expression * int Catala_utils.Mark.pos
Source
type exception_to =
| NotAnException
| UnlabeledException
| ExceptionToLabel of lident Catala_utils.Mark.pos
Source
type rule = {
rule_label : lident Catala_utils.Mark.pos option;
rule_exception_to : exception_to;
rule_parameter : lident Catala_utils.Mark.pos list Catala_utils.Mark.pos option;
rule_condition : expression option;
rule_name : scope_var Catala_utils.Mark.pos;
rule_id : Shared_ast.RuleName.t;
rule_consequence : bool Catala_utils.Mark.pos;
rule_state : lident Catala_utils.Mark.pos option;
}
Source
type definition = {
definition_label : lident Catala_utils.Mark.pos option;
definition_exception_to : exception_to;
definition_name : scope_var Catala_utils.Mark.pos;
definition_parameter : lident Catala_utils.Mark.pos list Catala_utils.Mark.pos option;
definition_condition : expression option;
definition_id : Shared_ast.RuleName.t;
definition_expr : expression;
definition_state : lident Catala_utils.Mark.pos option;
}
Source
type scope_use_item =
| Rule of rule
| Definition of definition
| Assertion of assertion
| DateRounding of variation_typ Catala_utils.Mark.pos
Source
type scope_use = {
scope_use_condition : expression option;
scope_use_name : uident Catala_utils.Mark.pos;
scope_use_items : scope_use_item Catala_utils.Mark.pos list;
}
Source
type scope_decl_context_io = {
scope_decl_context_io_input : io_input Catala_utils.Mark.pos;
scope_decl_context_io_output : bool Catala_utils.Mark.pos;
}
Source
type scope_decl_context_scope = {
scope_decl_context_scope_name : lident Catala_utils.Mark.pos;
scope_decl_context_scope_sub_scope : (path * uident Catala_utils.Mark.pos) Catala_utils.Mark.pos;
scope_decl_context_scope_attribute : scope_decl_context_io;
}
Source
type scope_decl_context_data = {
scope_decl_context_item_name : lident Catala_utils.Mark.pos;
scope_decl_context_item_typ : typ;
scope_decl_context_item_parameters : (lident Catala_utils.Mark.pos * typ) list Catala_utils.Mark.pos option;
scope_decl_context_item_attribute : scope_decl_context_io;
scope_decl_context_item_states : lident Catala_utils.Mark.pos list;
}
Source
type scope_decl_context_item =
| ContextData of scope_decl_context_data
| ContextScope of scope_decl_context_scope
Source
type scope_decl = {
scope_decl_name : uident Catala_utils.Mark.pos;
scope_decl_context : scope_decl_context_item Catala_utils.Mark.pos list;
}
Source
type top_def = {
topdef_name : lident Catala_utils.Mark.pos;
topdef_args : (lident Catala_utils.Mark.pos * base_typ Catala_utils.Mark.pos) list Catala_utils.Mark.pos option;
(*Empty list if this is not a function
*)topdef_type : typ;
topdef_expr : expression option;
}
Source
type code_item =
| ScopeUse of scope_use
| ScopeDecl of scope_decl
| StructDecl of struct_decl
| EnumDecl of enum_decl
| Topdef of top_def
Source
type law_heading = {
law_heading_name : string Catala_utils.Mark.pos;
law_heading_id : string option;
law_heading_is_archive : bool;
law_heading_precedence : int;
}
Source
type law_include =
| PdfFile of string Catala_utils.Mark.pos * int option
| CatalaFile of string Catala_utils.Mark.pos
| LegislativeText of string Catala_utils.Mark.pos
Source
type law_structure =
| LawInclude of law_include
| ModuleDef of uident Catala_utils.Mark.pos * bool
| ModuleUse of uident Catala_utils.Mark.pos * uident Catala_utils.Mark.pos option
| LawHeading of law_heading * law_structure list
| LawText of string
| CodeBlock of code_block * source_repr * bool
Source
type module_use = {
mod_use_name : uident Catala_utils.Mark.pos;
mod_use_alias : uident Catala_utils.Mark.pos;
}
Source
type program = {
program_module : program_module option;
program_items : law_structure list;
program_source_files : string list;
program_used_modules : module_use list;
program_lang : Catala_utils.Global.backend_lang;
}
Source
type module_items =
| Code of law_structure list
(*Used in whole-program to gather all module code
*)| Interface of (code_item Catala_utils.Mark.pos * Shared_ast.visibility) list
(*Invariant: an interface shall only contain
*)*Decl
elements, orTopdef
elements withtopdef_expr = None
(metadata only). The visibility is determined from the presence of the item in ametadata
block, but might later be promoted due to test annotations or dependencies
Source
type module_content = {
module_modname : program_module;
module_items : module_items;
module_submodules : module_use list;
}
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page