Class ToCore

java.lang.Object
org.clafer.frontend.ToCore

public final class ToCore extends Object
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.
  1. 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.
  2. A constraint or assertion with a pattern or a transition gets the origin of the first one.
  3. The patterns become the LTL formulas of Dwyer et al.'s catalogue, and the transitions implications.
  4. An enumeration becomes an abstract clafer and a clafer for each literal; in a temporal model, they are final.
  5. The finality modifiers become constraints of their clafers, at the end of their elements.
  6. initial x becomes [ initially (some this.x) ] at the end of the parent's elements.
  7. The anchors become guards on the birth and the death of the context instance, this, or the root at the top level.
  8. The multiplicity of a top-level abstract clafer becomes a constraint right after it.
A model is temporal if it has a trace length, --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 Details

    • toCore

      public static Ir.Model toCore(Ir.Model model, String file)
      Parameters:
      model - a rich explicit model
      file - the name of its file, for the provenance
      Returns:
      its explicit core model
    • 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, as clafer -m clafer --core --record-provenance P.cfr does.
      Parameters:
      model - a rich explicit model
      position - the position of a span in its file, for the provenance
      clocklessValues - 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

      public static Ir.Model toCore(Ir.Model model)
      Parameters:
      model - a rich explicit model
      Returns:
      its explicit core model, its provenance positions in model.des.cfr