Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Runtime System

LFE provides a complete interpreter alongside its compiler. This dual execution mode enables:

  • REPL (interactive development)
  • lfescript (scripting without compilation)
  • eval-when-compile (compile-time code execution)
  • Dynamic code loading (slurp command in shell)
graph LR
    A[Source Code] --> B{Execution Mode}
    B -->|Compile| C[Compiler Pipeline]
    C --> D[BEAM Bytecode]
    D --> E[BEAM VM]

    B -->|Interpret| F[lfe_eval]
    F --> G[Direct Execution]

    H[lfe_shell] --> F
    I[lfescript] --> F
    J[eval-when-compile] --> F

    style C fill:#e1f5ff
    style F fill:#ffe1e1

Shared components:

  • lfe_scan and lfe_parse - same frontend
  • lfe_macro - same macro expansion
  • lfe_env - same environment model

Different backends:

  • Compiler: lfe_lint → lfe_codegen → lfe_translate → BEAM
  • Interpreter: lfe_eval (direct execution)