package catala

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

Scope dependencies computations using OCamlgraph

Scope variables dependency graph

Graph declaration

Vertices: scope variables or subscopes.

The vertices of the scope dependency graph are either :

  • the variables of the scope ;
  • the subscopes of the scope.

Indeed, during interpretation, subscopes are executed atomically.

module Vertex : sig ... end
module Edge : Graph.Sig.ORDERED_TYPE_DFT with type t = Utils.Pos.t

On the edges, the label is the position of the expression responsible for the use of the variable. In the graph, x -> y if x is used in the definition of y.

module ScopeDependencies : Graph.Sig.P with type V.t = Vertex.t and type E.label = Edge.t

Module of the graph, provided by OCamlGraph

Graph computations

Returns an ordering of the scope variables and subscope compatible with the dependencies of the computation

val correct_computation_ordering : ScopeDependencies.t -> Vertex.t list

Returns an ordering of the scope variables and subscope compatible with the dependencies of the computation

val check_for_cycle : Ast.scope -> ScopeDependencies.t -> unit

Outputs an error in case of cycles.

val build_scope_dependencies : Ast.scope -> ScopeDependencies.t

Builds the dependency graph of a particular scope

Exceptions dependency graph

module EdgeExceptions : Graph.Sig.ORDERED_TYPE_DFT with type t = Utils.Pos.t list
module ExceptionsDependencies : Graph.Sig.P with type V.t = Desugared.Ast.RuleSet.t and type E.label = EdgeExceptions.t
val build_exceptions_graph : Ast.rule Desugared.Ast.RuleMap.t -> Ast.ScopeDef.t -> ExceptionsDependencies.t
val check_for_exception_cycle : ExceptionsDependencies.t -> unit
OCaml

Innovation. Community. Security.