Class ExplicitPrinter

java.lang.Object
org.clafer.frontend.ExplicitPrinter

public final class ExplicitPrinter extends Object
Prints the explicit IR exactly as the Clafer compiler prints the rich and the core explicit model (Generator/Explicit.hs), with or without the provenance comments, so that every comparison of two models is a comparison of text. A tree that ExplicitParser read from the compiler's output prints as that output.

The declarations and constraints are printed where they were written, the objectives and assertions at the end. Every operand that is not an atom or a navigation is parenthesized. Literals are printed as they were written.

  • Method Details

    • print

      public static String print(Ir.Model model)
      Parameters:
      model - the model
      Returns:
      the model, with its provenance comments
    • print

      public static String print(Ir.Model model, boolean withOrigins)
      Parameters:
      model - the model
      withOrigins - whether to print the provenance comments
      Returns:
      the model as text
    • print

      public static String print(Ir.Exp exp)
      Parameters:
      exp - an expression
      Returns:
      the expression as text, its operands parenthesized unless they are atoms or navigations