package catala

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Desugared.Desugared_to_scopeSource

Translation from Desugared.Ast to Scopelang.Ast

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

Rule tree construction

Sourcetype rule_tree =
  1. | Leaf of Ast.rule
  2. | Node of rule_tree list * Ast.rule

Transforms a flat list of rules into a tree, taking into account the priorities declared between rules

Invariant: there are no exceptions cycles

Invariant: there are no dandling exception pointers in the rules

Sourceval rule_tree_to_expr : toplevel:bool -> Scopelang.Ast.Var.t option -> rule_tree -> Scopelang.Ast.expr Pos.marked Bindlib.box

From the rule_tree, builds an Dcalc.Ast.EDefault expression in the scope language. The ~toplevel parameter is used to know when to place the toplevel binding in the case of functions.

AST translation

Translates a definition inside a scope, the resulting expression should be an Dcalc.Ast.EDefault

Sourceval translate_scope : Ast.scope -> Scopelang.Ast.scope_decl

Translates a scope

API

Sourceval translate_program : Ast.program -> Scopelang.Ast.program
OCaml

Innovation. Community. Security.