Class Ir
java.lang.Object
org.clafer.frontend.Ir
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 ClassesModifier and TypeClassDescriptionstatic final recordThe written bound of a top-level abstract clafer, which counts all its instances, rich:abstract Tools 3..6.static final recordAn anchor, rich:initially p, at the birth of the context, orfinally p, at its death.static final recordAn assertion,assert [ exp ].static final recordA chain of one binary operator:a op b op c.static enumThe binary operators, by their syntax.static final recordA function of strings,concat(a, b),prefix(a, b)orsuffix(a, b).static final recordA cardinality,low..high, orlow..*.static final recordupcast(e, T)ordowncast(e, T), as chocosolver's printer writes the casts of its analysis.static final recordA clafer:[abstract] [modifiers] gcard name [: super] [-> | ->> target] card [initializer] { elements }.static final recordconnected(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 recordA constraint,[ exp ].static final recordA decimal as written, e.g.,19.99or-0.5.static final recordThe declarations of a quantifier,[disj] x; y : set.static final recordA double as written, with its exponent, e.g.,1.2e2.static final recordleft.dref.static interfaceA declaration or constraint of a model or of a clafer.static final recordAn enumeration, rich:enum E = a | b, at the top level.static interfaceAn expression.static final recordif c then a else b, a formula or a set.static final recordAn initializer, rich:= value, or:= each valueor:= together value, with its clock written out (kbak/clafer-semantics#194).static enumThe initializers, by their syntax.static final recordAn integer,-3with its sign.static final recordA navigation,left.right: the right is a name (a child relation), or in chocosolver's printing a relation or a parenthesized set.static final recordA 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 recordA temporal modifier of a clafer, rich.static enumThe temporal modifiers, by their keywords.static final recordA name as written: of a clafer, a variable, or a type.static final recordA name in an expression: a clafer, all its instances or, on the right of a navigation, its relation, or a variable.static final recordnoclafer, the empty set.static interfaceA node of the tree.static final recordAn objective,<< max exp >>or<< min exp >>.static final recordThe options of the first line,//# OPTIONS --explicit, as the compiler writes them.static final recordWhere a clafer or constraint of the core comes from, as--record-provenancewrites 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 recordleft.parent.static final recordA behavioral pattern of Dwyer et al.'static enumThe patterns.static enumThe scopes of a pattern.static final recordA position in a source file, as in the compiler's messages.static final recordq decls | body.static final recordA quantifier over a set, without variables:some x,no x,lone x,one x,all x.static enumThe quantifiers.static final recordA reference:-> target, a set, or->> target, a bag.static final recorddref(c)orparent(c), a relation of a clafer, as chocosolver's printer writes it.static final recordConstraints directly under the root,root { [ exp ] }, as chocosolver'sAstPrinterprints a model of its Java API that has them; Clafer has none.static final recordA string literal as written, with its quotes and escapes.static final recordA temporal operator of the core:X,F,G,previous,once,historicallyon one formula,U,W,since,triggeredbetween two.static enumThe temporal operators of the core.static final recordthis.static final recordA transition, rich:a --> b,a -[g]-> b,a -->> bora -[g]->> b, whose target may be a chain of transitions.static final recordA prefix operator.static enumThe prefix operators. -
Method Summary