Class Ir

java.lang.Object
org.clafer.frontend.Ir

public final class Ir extends Object
The explicit IR: one tree for the rich and the core explicit language of Clafer, as the Clafer compiler prints them (clafer -m clafer, with --core for the core). The core is a strict subset of the rich language, so a core model is a rich model without rich nodes. Whether a node is rich is a property of its type (Ir.Node.isRich()), never of a field value: every rich part of a declaration is a node of its own, e.g., a Ir.Modifier or an Ir.Initializer of a Ir.ClaferDecl, which is core. Core.richNodes(Ir.Model) lists the rich nodes of a tree.

The tree is the text: names are not resolved, and every declaration and constraint stays where it was written, so that ExplicitPrinter prints it back as it was read. Resolving the names is the job of what reads the tree, e.g., chocosolver's ToAst.

The records are immutable; their lists are unmodifiable copies.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    The written bound of a top-level abstract clafer, which counts all its instances, rich: abstract Tools 3..6.
    static final record 
    An anchor, rich: initially p, at the birth of the context, or finally p, at its death.
    static final record 
    An assertion, assert [ exp ].
    static final record 
    A chain of one binary operator: a op b op c.
    static enum 
    The binary operators, by their syntax.
    static final record 
    A function of strings, concat(a, b), prefix(a, b) or suffix(a, b).
    static final record 
    A cardinality, low..high, or low..*.
    static final record 
    upcast(e, T) or downcast(e, T), as chocosolver's printer writes the casts of its analysis.
    static final record 
    A clafer: [abstract] [modifiers] gcard name [: super] [-> | ->> target] card [initializer] { elements }.
    static final record 
    connected(nodes, relation, directed).
    static final record 
    {[1, 2], [3, 4]} :: T * U, a constant set of chocosolver's printer: one row per column of the type.
    static final record 
    A constraint, [ exp ].
    static final record 
    A decimal as written, e.g., 19.99 or -0.5.
    static final record 
    The declarations of a quantifier, [disj] x; y : set.
    static final record 
    A double as written, with its exponent, e.g., 1.2e2.
    static final record 
    left.dref.
    static interface 
    A declaration or constraint of a model or of a clafer.
    static final record 
    An enumeration, rich: enum E = a | b, at the top level.
    static interface 
    An expression.
    static final record 
    if c then a else b, a formula or a set.
    static final record 
    An initializer, rich: = value, or := each value or := together value, with its clock written out (kbak/clafer-semantics#194).
    static enum 
    The initializers, by their syntax.
    static final record 
    An integer, -3 with its sign.
    static final record 
    A navigation, left.right: the right is a name (a child relation), or in chocosolver's printing a relation or a parenthesized set.
    static final record 
    A model: its declarations and constraints in the order they were written, then its objectives and assertions, which the compiler prints at the end.
    static final record 
    A temporal modifier of a clafer, rich.
    static enum 
    The temporal modifiers, by their keywords.
    static final record 
    A name as written: of a clafer, a variable, or a type.
    static final record 
    A name in an expression: a clafer, all its instances or, on the right of a navigation, its relation, or a variable.
    static final record 
    noclafer, the empty set.
    static interface 
    A node of the tree.
    static final record 
    An objective, << max exp >> or << min exp >>.
    static final record 
    The options of the first line, //# OPTIONS --explicit, as the compiler writes them.
    static final record 
    Where a clafer or constraint of the core comes from, as --record-provenance writes it: the rich construct that a lowering made it from, and the position of that construct, e.g., // final, model.cfr:56:5.
    static final record 
    left.parent.
    static final record 
    A behavioral pattern of Dwyer et al.'
    static enum 
    The patterns.
    static enum 
    The scopes of a pattern.
    static final record 
    A position in a source file, as in the compiler's messages.
    static final record 
    q decls | body.
    static final record 
    A quantifier over a set, without variables: some x, no x, lone x, one x, all x.
    static enum 
    The quantifiers.
    static final record 
    A reference: -> target, a set, or ->> target, a bag.
    static final record 
    dref(c) or parent(c), a relation of a clafer, as chocosolver's printer writes it.
    static final record 
    Constraints directly under the root, root { [ exp ] }, as chocosolver's AstPrinter prints a model of its Java API that has them; Clafer has none.
    static final record 
    A string literal as written, with its quotes and escapes.
    static final record 
    A temporal operator of the core: X, F, G, previous, once, historically on one formula, U, W, since, triggered between two.
    static enum 
    The temporal operators of the core.
    static final record 
    this.
    static final record 
    A transition, rich: a --> b, a -[g]-> b, a -->> b or a -[g]->> b, whose target may be a chain of transitions.
    static final record 
    A prefix operator.
    static enum 
    The prefix operators.
  • Method Summary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait