Class ToCore
java.lang.Object
org.clafer.frontend.ToCore
The lowering of the rich explicit model to the explicit core model: the
port of the Clafer compiler's
lowerAbstractBounds TopLevelBounds .
lowerToCore (Intermediate/Core.hs, Initializers.hs,
Finality.hs, AbstractMultiplicity.hs), pass by pass and in
the same order, so that ExplicitPrinter.print(toCore(m)) is the
compiler's --core output for the model of m.
- The initializers become constraints: of the parent, right after the
clafer, or, for the per-instance
:=of a temporal model whose value has no temporal operator, of the clafer, at the end of its elements. - A constraint or assertion with a pattern or a transition gets the origin of the first one.
- The patterns become the LTL formulas of Dwyer et al.'s catalogue, and the transitions implications.
- An enumeration becomes an abstract clafer and a clafer for each literal; in a temporal model, they are final.
- The finality modifiers become constraints of their clafers, at the end of their elements.
initial xbecomes[ initially (some this.x) ]at the end of the parent's elements.- The anchors become guards on the birth and the death of the context
instance,
this, or the root at the top level. - The multiplicity of a top-level abstract clafer becomes a constraint right after it.
--tl=N: then
:= gives the value at the start of each lifetime; in a static model,
it is =.
The core is a fixpoint: toCore of a core model is the model.
The provenance of the lowered clafers and constraints names the rich
construct and its position, in the rich model or in the files of the source. The
rich model writes the clock of every :=, so the origin of a lowered
:= is := each or := together, where the compiler,
from the source, writes := for one without a written clock.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Ir.Modelstatic Ir.Modelstatic Ir.ModeltoCore(Ir.Model model, Function<SourceSpan, Ir.Position> position, Set<SourceSpan> clocklessValues) The lowering of a model compiled from its source, whose provenance names the positions in the source's files, asclafer -m clafer --core --record-provenance P.cfrdoes.
-
Method Details
-
toCore
-
toCore
public static Ir.Model toCore(Ir.Model model, Function<SourceSpan, Ir.Position> position, Set<SourceSpan> clocklessValues) The lowering of a model compiled from its source, whose provenance names the positions in the source's files, asclafer -m clafer --core --record-provenance P.cfrdoes.- Parameters:
model- a rich explicit modelposition- the position of a span in its file, for the provenanceclocklessValues- the spans of the values of the:=written without a clock, whose provenance is:=, as the compiler writes it- Returns:
- its explicit core model
-
toCore
-