Class ExplicitParser

java.lang.Object
org.clafer.frontend.ExplicitParser

public final class ExplicitParser extends Object
Reads the rich or the core explicit language, as the Clafer compiler prints them (clafer -m clafer, and --core), and the explicit form that chocosolver's AstPrinter prints, into the explicit IR. ExplicitPrinter prints the tree back as it was read.

The parser does not resolve names, so it reads the model in one pass; what reads the tree resolves them. It reads the options of the first line and the provenance comments, // construct, file:line:column, at the end of the line of a clafer's opening brace or of a constraint. Other comments are not in the tree.

The explicit languages have no sugar and no defaults: every card and group card is written, every name is a UID, nesting is in braces, and every operand that is not an atom or a navigation is parenthesized, so the expressions have no precedence. Errors are diagnostics: the parser goes on with the next declaration or constraint.

  • Method Details