Class Frontend

java.lang.Object
org.clafer.cli.Frontend

public final class Frontend extends Object
Reads a .cfr model that is not an explicit model: with the Java frontend (ToIr, then ToAst) in this JVM, or, when the Java frontend cannot take the model, with the Haskell compiler (clafer -k -m choco), whose .js file is read with Rhino. The compiler is ClaferExecutable.find(): clafer next to clafersg.jar, as in Clafer Tools, or on the PATH.

The Haskell compiler reads the model when:

  • --haskell-frontend is given;
  • the model has a [choco| |] escape, which is JavaScript;
  • the Java frontend reports errors or fails: if the compiler compiles the model, chocosolver solves its output and says that the Java frontend rejected the model; otherwise the Java frontend's errors are the model's.
The imports are read as the compiler reads them, URLs included, with the restrictions of --import-root, --public-imports and --import-base (ModelFiles.ImportOptions).

The model's scopes are those of its explicit model's scope file (Scopes), as the compiler writes them with -m clafer --meta-data.