package catala

  1. Overview
  2. Docs

Scope dependencies computations using OCamlgraph

module Pos = Utils.Pos
module Errors = Utils.Errors

Graph declaration

module Vertex : sig ... end

Vertices: scope variables or subscopes.

module Edge : sig ... end

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 : sig ... end

Module of the graph, provided by OCamlGraph

module TopologicalTraversal : sig ... end

Module of the topological traversal of the graph, provided by OCamlGraph

module SCC : sig ... end

Tarjan's stongly connected components algorithm, provided by OCamlGraph

Graph computations

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

OCaml

Innovation. Community. Security.