Class CompilerFactory
java.lang.Object
ca.mcscert.jpipe.compiler.CompilerFactory
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 Summary
Modifier and TypeMethodDescriptionstatic Compilerbuild(CompilationConfig config, OutputStream stdout) Build a process-mode compiler from the given configuration.static CompilerbuildDiagnosticCompiler(DiagnosticFormat format, OutputStream stdout) Build a diagnostic-mode compiler that parses the source and reports on it without exporting any model.static CompilerbuildDiagnosticCompiler(OutputStream stdout) Build a diagnostic-mode compiler producing a human-readable report.static ChainBuilder<InputStream, List<Command>> Parsing chain: reads a source file, lexes, parses, and extracts the action list.static Transformation<List<Command>, Unit> Full unit builder: extends the parsing chain with model construction, consistency checking, and completeness checking.
-
Method Details
-
build
Build a process-mode compiler from the given configuration.- Parameters:
config- the compilation configuration.stdout- stream to use when the output target isCompilationConfig.STDOUT.- Returns:
- a ready-to-use
Compiler. - Throws:
UnsupportedOperationException- if the requested format is not yet implemented.
-
buildDiagnosticCompiler
Build a diagnostic-mode compiler producing a human-readable report. Equivalent tobuildDiagnosticCompiler(DiagnosticFormat, OutputStream)withDiagnosticFormat.TEXT.- Parameters:
stdout- stream to use when the output target isCompilationConfig.STDOUT.- Returns:
- a ready-to-use
Compiler.
-
buildDiagnosticCompiler
Build a diagnostic-mode compiler that parses the source and reports on it without exporting any model.Both formats share the
CollectDiagnosticsstep and differ only in their renderer, so they always describe the same compilation.The report is written by a
DiagnosticCompilerrather than assembled as the tail of the analysis chain, so that a compilation which aborts on a fatal diagnostic is still reported on.- Parameters:
format- how to render the report.stdout- stream to use when the output target isCompilationConfig.STDOUT.- Returns:
- a ready-to-use
Compiler.
-
parsingChain
Parsing chain: reads a source file, lexes, parses, and extracts the action list. Aborts on any syntax error viaHaltAndCatchFire. -
unitBuilder
Full unit builder: extends the parsing chain with model construction, consistency checking, and completeness checking.
-