Class ToAst
AstModel from a static explicit model of the
explicit IR: the core explicit model that clafer -m clafer
--core prints, a static rich one, which it lowers to the core with
ToCore, or what
AstPrinter prints. It resolves the names: the clafers, which may be
used before they are declared, and the variables of the quantifiers.
The clafers are created in the order of the source, so that the instances are numbered as the compiler numbers them, then given their super clafers, and then their references and group cards, after their super clafers'. What the printer writes because it applies, this sets only where it is not inherited: a group card equal to the super clafer's is the super clafer's. A written reference is the clafer's own.
A nested abstract clafer's multiplicity counts the instances of its
subclafers in each parent, so it becomes a constraint of the parent on
#this.A, as the compiler gives it to chocosolver. A temporal
model has a diagnostic on each line with a temporal construct, since
chocosolver solves only static models. real and double have
no solver.
Clafers, constraints, objectives and assertions get the spans of their source, so chocosolver's errors name their positions. Errors do not stop the build: it reports a diagnostic and goes on with the next declaration or constraint.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA model built from an explicit model. -
Method Summary
Modifier and TypeMethodDescriptionstatic ToAst.ResultParses an explicit model and builds itsAstModel.static ToAst.ResultBuilds theAstModelof an explicit model.
-
Method Details
-
parse
Parses an explicit model and builds itsAstModel.- Parameters:
source- the text- Returns:
- the model, its objectives and assertions, and the errors of the parser and the build, by position
-
toAst
Builds theAstModelof an explicit model.- Parameters:
tree- the explicit model- Returns:
- the model, its objectives and assertions, and the errors
-