Interface CompilerAccess


public interface CompilerAccess
Shared compiler surface for MCP tools, Oracle extractors, AI sessions, and the IDE.

Provides the minimal gateway every consumer needs: access to the compiled program, the workspace, and the ability to trigger compilation. All Oracle tools (current and future) work from getLastCompiledProgram() and getWorkspace() — they walk the symbol table, scope chains, and IR directly.

In standalone ek9 -mcp mode, McpCompilerService implements this with its own internal state. In ek9 -ide mode, the IDE's compiler service implements it, and the MCP server delegates to it — one CompilableProgram per JVM, shared by all agents.

  • Method Details

    • initializeWorkspace

      void initializeWorkspace(List<String> roots)
      Initialize the workspace from root directories. Discovers source files and prepares for compilation.
    • compile

      boolean compile(CompilerFlags flags)
      Compile the workspace with the given flags.
      Returns:
      true if compilation succeeded without errors
    • getLastCompiledProgram

      SharedThreadContext<CompilableProgram> getLastCompiledProgram()
      Get the compiled program from the most recent compilation. This is the universal gateway for all Oracle tools — they resolve symbols, walk scopes, and traverse IR from this context.
      Returns:
      the shared thread context, or null if no compilation has occurred
    • getWorkspace

      Workspace getWorkspace()
      Get the current workspace containing all known source files.
    • collectDiagnostics

      List<CompilerAccessDiagnostic> collectDiagnostics(int errorLevel)
      Collect structured diagnostics from the most recent compilation.
      Parameters:
      errorLevel - controls rich error message inclusion (0=minimal, 3+=rich)
    • hasErrors

      boolean hasErrors()
      Check whether the most recent compilation produced any errors.