Skip to main content

Module repl

Module repl 

Source
Expand description

RML — Interactive REPL (issue #29)

Maintains a persistent Env between user inputs and prints diagnostics inline. Meta-commands start with ::

  :help           show this help message
  :reset          discard all state and start a fresh Env
  :env            print declared terms / assignments / types / lambdas
  :load <file>    evaluate a `.lino` file in the current Env
  :save <file>    write the session transcript (as `.lino`) to <file>
  :quit           exit the REPL (also :exit, Ctrl-D)

Tab-completion is best-effort: the Repl::completion_candidates helper returns known meta-commands plus declared terms, operators, and lambda names. The CLI driver (main.rs) wires it into the line-editor.

Structs§

Repl
REPL state. Owns the persistent Env and the running transcript so :save can replay the session.
ReplStep
Outcome of feeding a single line into the REPL. Output and error are stringified for the driver to emit; exit requests termination.

Functions§

format_env
Render a snapshot of the env’s user-visible state for :env.
run_repl
Drive the REPL on the given input/output streams. Used by main.rs. Suppresses prompts when stdin is not a TTY so piped input stays clean.