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.

    Compiler can define a "compiler context", which can specify e.g. a format of compiled file, or other additional meta-information for runtime, which can be used by other plugins.

    See Also:
    CompilerContext
    • Method Detail

      • addCompilerListener

        void addCompilerListener​(CompilerListener listener)
        Adds CompilerListener object into list of listeners. If some event is occurred in the compiler, listeners methods will be called.
        Parameters:
        listener - CompilerListener object
      • removeCompilerListener

        void removeCompilerListener​(CompilerListener listener)
        Removes CompilerListener object from the listeners list.
        Parameters:
        listener - CompilerListener object
      • compile

        boolean compile​(java.lang.String inputFileName,
                        java.lang.String outputFileName)
        Compile an input file into the output file.
        Parameters:
        inputFileName - name of the input file (source code)
        outputFileName - name of the output file (compiled code)
        Returns:
        true if compile was successful, false otherwise
      • compile

        boolean compile​(java.lang.String inputFileName)
        Compile an input file into the output file.

        Output file name is derived by the compiler itself. Usually, the extension of the input file is replaced by another one, denoting compiled file. It is compiler-specific.

        Parameters:
        inputFileName - name of the input file (source code)
        Returns:
        true if compile was successful, false otherwise
      • getLexer

        LexicalAnalyzer getLexer​(java.io.Reader reader)
        Get a lexical analyzer of the compiler. It is used by main module for syntax highlighting. In the compilation process the compiler should use own, independent lexical analyzer.
        Parameters:
        reader - Reader of the source code
        Returns:
        lexical analyzer object
      • getProgramLocation

        int getProgramLocation()
        Gets location of compiled program in memory.

        Program location should be valid only after successful compilation. The location should point to the starting position of the program in memory, where the CPU can start emulating.

        Returns:
        location of compiled program in memory
      • getSourceFileExtensions

        java.util.List<SourceFileExtension> getSourceFileExtensions()
        Get the list of source file extensions supported by the compiler.
        Returns:
        list of supported source file extensions