Interface Compiler

All Superinterfaces:
Plugin
All Known Implementing Classes:
AbstractCompiler

public interface Compiler extends Plugin
Compiler plugin root interface.

Should be implemented by a plugin. There should exist just one implementation. Compilers usually extend AbstractCompiler.

  • Method Details

    • addCompilerListener

      void addCompilerListener(CompilerListener listener)
      Adds compiler listener.
      Parameters:
      listener - compiler listener
    • removeCompilerListener

      void removeCompilerListener(CompilerListener listener)
      Removes compiler listener.
      Parameters:
      listener - compiler listener
    • compile

      void compile(Path inputPath, Optional<Path> outputPath)
      Compile given input file.

      If output path is not given, it is derived by replacing the source file extension of the input path. Usually a successfully compiled program is loaded in memory.

      Parameters:
      inputPath - input file path (source code)
      outputPath - optional output file path
    • createLexer

      LexicalAnalyzer createLexer()
      Creates a lexical analyzer.
      Returns:
      new lexer object
    • findIncludes

      default List<Compiler.IncludeReference> findIncludes(Path sourceFile, String text)
      Finds include targets in the current editor text. Compilers resolve them against the source file using the same rules as during compilation.
    • getSourcePositionColumnUnit

      default SourceCodePosition.ColumnUnit getSourcePositionColumnUnit()
      Coordinate convention of this compiler's memory source-position annotations. Declaring a known unit also declares one-based lines, zero-based columns, and tabs counting as one column. UNKNOWN means the consumer cannot safely resolve positions to source offsets. Lexical Token offsets remain UTF-16 independently of this convention.
    • getSourceFileTypes

      List<FileType> getSourceFileTypes()
      Get source file types supported by the compiler.
      Returns:
      supported source file types
    • isAutomationSupported

      default boolean isAutomationSupported()
      Determine if automation is supported.
      Specified by:
      isAutomationSupported in interface Plugin
      Returns:
      true by default