Desugared representation

This representation is the second in the compilation chain (see Architecture). Its main difference with the surface representation is that the legislative text has been discarded and all the definitions of each variables have been collected in the same place rather than being scattered across the code base.

The module describing the abstract syntax tree is:

Desugaring proceeds in three main steps:

Name resolution and translation

The desugaring consists of translating Surface.Ast to Desugared.Ast of the desugared representation. The translation is implemented in Desugared.From_surface, but it relies on a helper module to perform the name resolution: Desugared.Name_resolution. Indeed, in Surface.Ast, the variables identifiers are just string, whereas in Desugared.Ast they have been turned into well-categorized types with an unique identifier like Shared_ast.ScopeName.t.

Relevant modules:

Towards the scope language

Before the translation to the scope language, Desugared.Dependency checks that within a scope, there is no computational circular dependency between the variables of the scope. When the dependency graph is a DAG, Scopelang.From_desugared performs a topological ordering to produce an ordered list of the scope definitions compatible with the computation order. All the graph computations are done using the Ocamlgraph library.

Related modules: