Class ClaferCommand

java.lang.Object
org.clafer.frontend.ClaferCommand

public final class ClaferCommand extends Object
claferc: the Clafer compiler's clafer -m clafer and clafer -m alloy in Java. With -m alloy, the default, it prints the Alloy 6 model (P.als) of the port of the compiler's temporal generator (AlloyGenerator), for static and temporal models alike. With -m clafer it prints the rich explicit model (P.des.cfr) or, with --core, the explicit core model (P.core.cfr, with --record-provenance its provenance comments), and with --meta-data the explicit model's scope file and the map of names (P.cfr-map), with the compiler's file names, statistics and errors.

Everything else is forwarded to clafer on the path, with the same arguments: a model that the Alloy generator does not translate (e.g., with a decimal or an [alloy| |] escape), the other modes (-m choco, json, html, graph, cvlgraph), the options that the Java side does not implement (e.g., -i, -v, -c, --check-afm, -l), and any argument that it does not read, so that the compiler gives its own message for it. The executable is ClaferExecutable.find(): -Dclafer.executable, or clafer next to claferc.jar, or on the PATH.

  • Constructor Details

    • ClaferCommand

      public ClaferCommand(InputStream in, PrintStream out, String executable)
      Parameters:
      in - the standard input, which holds the model if no file is given
      out - the standard output
      executable - the compiler that the other modes are forwarded to
  • Method Details

    • main

      public static void main(String[] args)
    • run

      public int run(List<String> args)
      Runs the command.
      Returns:
      the exit code