Class CompilerFactory

java.lang.Object
ca.mcscert.jpipe.compiler.CompilerFactory

public final class CompilerFactory extends Object
Assembles a Compiler from a CompilationConfig by wiring the appropriate pipeline steps.

Not all formats are implemented yet. Unsupported combinations throw UnsupportedOperationException at factory time, before any file I/O occurs.

  • Method Details

    • build

      public static Compiler build(CompilationConfig config, OutputStream stdout)
      Build a process-mode compiler from the given configuration.
      Parameters:
      config - the compilation configuration.
      stdout - stream to use when the output target is CompilationConfig.STDOUT.
      Returns:
      a ready-to-use Compiler.
      Throws:
      UnsupportedOperationException - if the requested format is not yet implemented.
    • buildDiagnosticCompiler

      public static Compiler buildDiagnosticCompiler(OutputStream stdout)
      Build a diagnostic-mode compiler that parses the source and produces a human-readable report without exporting any model.
      Parameters:
      stdout - stream to use when the output target is CompilationConfig.STDOUT.
      Returns:
      a ready-to-use Compiler.
    • parsingChain

      public static ChainBuilder<InputStream, List<Command>> parsingChain()
      Parsing chain: reads a source file, lexes, parses, and extracts the action list. Aborts on any syntax error via HaltAndCatchFire.
    • unitBuilder

      public static Transformation<List<Command>, Unit> unitBuilder()
      Full unit builder: extends the parsing chain with model construction, consistency checking, and completeness checking.