How do I use verbose or debug compilation modes?

← Debugging and Troubleshooting · Ref: Q252

EK9 provides a comprehensive set of command-line flags for controlling compilation verbosity, debugging, and output.

ERROR FORMATS (-E0 through -E3)

  -E0    Minimal: single-line error messages with location and code
  -E1    Visual: Rust-style display with source snippets and caret markers
  -E2    Suggestions: visual plus 'Did you mean?' fuzzy matching
  -E3    Full: detailed explanations with diagnosis, rationale, and examples

The default is -E0. Use -E3 when learning EK9 or when an error is confusing. (-E4, -E5 and -E6 are not error formats: they print the paradigm summary and the AI bootstrap references, for example 'ek9 -h -E4'.)

COMPILATION MODES

  -c     Incremental compile (only recompile changed files)
  -C     Full recompile (recompile everything from scratch)
  -r name   Which program to run, when the EK9 file defines more than one
  -t     Run tests (@Test methods and expected_output.txt)

Incremental compilation is faster for large projects. Use -C when you suspect stale cached output.

DEBUG AND VERBOSE FLAGS

  -v     Verbose output: shows which files are being compiled and which phases complete
  -dv    Debug verbose: more detail including symbol resolution and phase timing
  -cg    Compile with debugging information, so 'ek9 -d <port>' and 'ek9 -dap' can step through EK9 source
  -cd    Combined development and debug mode

A failed require reports its source location without -cg; the -cg flag is what a debugger needs.

ANALYSIS FLAGS

  -di    DI/AOP analysis: outputs dependency injection wiring and aspect pointcut information
  -Cp PHASE  Stop at the named phase (for example -Cp PRE_IR_CHECKS, not a number): compiles up to that phase and stops. Not typical for end users, but valuable for AI tools learning EK9 (verify syntax and types compile correctly without generating runnable programs) and for compiler developers

HELP AND INFORMATION

  -h keyword    Help for a built-in type (e.g., 'ek9 -h String', 'ek9 -h List')
  -h EXXXXX     Explain a specific error code
  -H            List all available help keywords
  -V            Show compiler version

TEST OUTPUT FORMATS

  -t, -t1   Human-readable test output (the default)
  -t0       Terse output, a minimal summary for scripting
  -t2       JSON output, for tools and AI
  -t3       JUnit XML output, for CI/CD integration
  -t4       Detailed coverage report listing what is uncovered
  -t5       Verbose coverage report listing what is covered and uncovered
  -t6       Interactive HTML coverage report

Use -t3 for CI/CD integration.

COVERAGE

  -tC    Display coverage results after the tests have run
  -tp    Add profiling (call counts and durations) to the test run; -t2p and -t6p give JSON and an HTML flame graph

Coverage is reported with the tests, and the threshold is 80%: when all tests pass but coverage is lower, the exit code is 12.

See Q246 for debugging strategies. See Q247 for reading error messages. See Q253 for understanding compiler phases. See Q323 for AI quality workflow. See Q622 for formatting flags. See Q627 for profiling flags.

Example

defines module qa.debugging.verbosemodes

  defines function

    describeFeature()
      ->
        featureEnabled as Boolean
        featureName as String
      <- description as String: String()

      if featureEnabled
        description: `${featureName} is enabled`
      else
        description: `${featureName} is disabled`

  defines program

    VerboseModesDemo()
      stdout <- Stdout()

      // Simple program to demonstrate compilation
      stdout.println("Compilation modes demo")

      // Use string interpolation
      version <- "1.0"
      stdout.println(`Version: ${version}`)

      // Simple arithmetic
      a <- 10
      b <- 20
      stdout.println(`Sum: ${a + b}`)

      // Boolean check via function parameter
      stdout.println(describeFeature(true, "Logging"))

      // List operations
      items <- ["alpha", "beta", "gamma"]
      for item in items
        stdout.println(`Item: ${item}`)

Common mistakes

E08090 — If 'featureDesc' is declared but never used anywhere, the compiler rejects it as unused. Every variable must be referenced. See ek9 -h E08090 for details.

Incorrect:

featureDesc <- describeFeature(true, "Logging")

Correct:

stdout.println(describeFeature(true, "Logging"))
Other ways to ask this
  • What compiler flags does EK9 support?
  • How do I get more detail from the EK9 compiler?
  • What are the EK9 compilation modes?

Coming from another language?

Java: javac has minimal flags, IDEs provide most analysis. Python: python -v for verbose, -W for warnings, no compilation phases. Rust: RUST_LOG for verbose, cargo build --verbose, rustc --explain. Go: go build -v for verbose, go vet for analysis. C++: compiler-specific flags (-Wall, -Wextra, -g for debug info). Kotlin: kotlinc has minimal flags, relies on IDE. EK9: four error formats, debugging information for a DAP debugger, phase-level control, built-in test formats, coverage and profiling, offline error code lookup.

Keywords: verbose, debug, cg, instrumentation, compile, flag, migrate, troubleshoot, phase, mode, test, error-message, coverage, output, E0, E1, E2, E3