package catala
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Compiler and library for the literate programming language for tax code specification
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.8.0.tar.gz
md5=1408a1cce45c7d5990b981e83e7589c2
sha512=eb3b923aa1f743378b4a05e30f50be5d180dc862a716270d747a90e469017f42fa5fc41352f02fbbf59cd2560f91c4f1b32cf38d80085b105d9387b0aed2039d
doc/catala.runtime_ocaml/Runtime_ocaml/Runtime/index.html
Module Runtime_ocaml.RuntimeSource
The OCaml runtime.
Types
Source
type source_position = {filename : string;start_line : int;start_column : int;end_line : int;end_column : int;law_headings : string list;
}Exceptions
Value Embedding
Source
type runtime_value = | Unit| Bool of bool| Money of money| Integer of integer| Decimal of decimal| Date of date| Duration of duration| Enum of string list * string * runtime_value| Struct of string list * (string * runtime_value) list| Array of runtime_value Array.t| Unembeddable
Logging
Global process
The logging is constituted of two phases:
- The first one consists of collecting raw events (see
raw_event) during the program execution (seeretrieve_log) throught Logging instruments. - The second one consists in parsing the collected raw events into structured ones (see
event).
Data structures
Represents information about a name in the code -- i.e. variable name, subscope name, etc...
It's a list of strings with a length varying from 2 to 3, where:
- the first string is the name of the current scope -- starting with a capitalized letter
Scope_name, - the second string is either: the name of a scope variable or, the name of a subscope input variable --
a_subscope_var.input_var - the third string is either: a subscope name (starting with a capitalized letter
Subscope_nameor, theinput(resp.output) string -- which corresponds to the input (resp. the output) of a function.
The raw events
Source
type raw_event = | BeginCall of information(*Subscope or function call.
*)| EndCall of information(*End of a subscope or a function call.
*)| VariableDefinition of information * runtime_value(*Definition of a variable or a function argument.
*)| DecisionTaken of source_position(*Source code position of an event.
*)
The structured events
The corresponding grammar of the event type, is the following:
<event> := <fun_call>
| <subscope_call>
| <var_def>
| <var_def_with_fun>
| VariableDefinition
<fun_call> :=
VariableDefinition (function input)
<fun_call_beg>
<event>*
(<var_def> | <var_def_with_fun>) (function output)
EndCall
<var_def_with_fun> :=
/-- DecisionTaken
pos of | <fun_call>+ (function calls needed to compute the variable value)
\-> VariableDefinition
<subscope_call> :=
<sub_var_def>* (sub-scope attributes def)
<sub_call_beg>
<event>+
EndCall
<var_def> := DecisionTaken VariableDefinition(info, _)
(when info.length = 2 && info[1] == "id")
<sub_var_def> := DecisionTaken VariableDefinition(info, _)
(when info.length = 3)
<fun_call_beg> := BeginCall(info)
(when info.length = 2)
<sub_call_beg> := BeginCall(info)
(when info.length = 2 and '.' in info[1])Source
and var_def = {pos : source_position option;name : information;value : runtime_value;fun_calls : fun_call list option;
}Source
and fun_call = {fun_name : information;inputs : var_def list;body : event list;output : var_def;
}Parsing
retrieve_log () returns the current list of collected raw_event.
Helping functions
Logging instruments
Pretty printers
pp_events ~is_first_call ppf events pretty prints in ppf the string representation of events.
If is_first_call is set to true, the formatter will be flush at the end. By default, is_first_call is set to false.
Constructors and conversions
Money
Decimals
Integers
Dates
Durations
Usage : duration_of_numbers year mounth day.
Defaults
Source
val handle_default :
source_position ->
(unit -> 'a) array ->
(unit -> bool) ->
(unit -> 'a) ->
'aSource
val handle_default_opt :
source_position ->
'a eoption array ->
bool eoption ->
'a eoption ->
'a eoptionOperators
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page