Module Surface.DesugaringSource

Translation from Surface.Ast to Desugaring.Ast.

Sourcemodule Pos = Utils.Pos
Sourcemodule Errors = Utils.Errors
Sourcemodule Cli = Utils.Cli

Translating expressions

Sourceval translate_op_kind : Ast.op_kind -> Dcalc.Ast.op_kind
Sourceval translate_binop : Ast.binop -> Dcalc.Ast.binop
Sourceval translate_unop : Ast.unop -> Dcalc.Ast.unop

The two modules below help performing operations on map with the Bindlib.box. Indeed, Catala uses the Bindlib library to represent bound variables in the AST. In this translation, bound variables are used to represent function parameters or pattern macthing bindings.

module LiftStructFieldMap : sig ... end
module LiftEnumConstructorMap : sig ... end

Usage: translate_expr scope ctxt expr

Translates expr into its desugared equivalent. scope is used to disambiguate the scope and subscopes variables than occur in the expresion

Translating scope definitions

Sourceval merge_conditions : Scopelang.Ast.expr Pos.marked Bindlib.box option -> Scopelang.Ast.expr Pos.marked Bindlib.box option -> Pos.t -> Scopelang.Ast.expr Pos.marked Bindlib.box

A scope use can be annotated with a pervasive precondition, in which case this precondition has to be appended to the justifications of each definition in the subscope use. This is what this function does.

Translates a surface definition into condition into a desugared Desugared.Ast.rule

Wrapper around process_default that performs some name disambiguation

Translates a Surface.Ast.rule from the surface language

Translates assertions

Translates a surface definition, rule or assertion

Translating top-level items

Translates a surface scope use, which is a bunch of definitions

Main function of this module