pyk.krepl.repl module

class BaseRepl[source]

Bases: Cmd, Generic[T], ABC

CAT_BUILTIN: Final = 'Built-in Commands'
CAT_DEBUG: Final = 'Debugger Commands'
abstract do_load(args: Any) bool | None[source]

Abstract method to set up the interpreter. Subclasses are expected to * decorate the method with with_argparser to ensure the right set of arguments is parsed; * instantiate an Interpreter[T] based on args, then set self.interpreter; * set self.state to self.interpreter.init_state().

do_show(args: Namespace) None[source]

Show the current configuration

do_step(args: Namespace) None[source]

Execute steps in the program

interpreter: Interpreter[T] | None
prompt = '> '
state: T | None
class Interpreter[source]

Bases: Generic[T], ABC

abstract init_state() T[source]
abstract next_state(state: T, steps: int | None = None) T[source]
class KInterpreter(definition_dir: Path, program_file: Path)[source]

Bases: Interpreter[KState]

definition_dir: Path
init_state() KState[source]
next_state(state: KState, steps: int | None = None) KState[source]
program_file: Path
class KRepl(definition_dir: Path)[source]

Bases: BaseRepl[KState]

do_load(args: Namespace) None[source]

Load a program

intro = 'K-REPL Shell\nType "help" or "?" for more information.'
final class KState(definition_dir: 'Path', pattern: 'Pattern')[source]

Bases: object

definition_dir: Path
pattern: Pattern
property pretty: str
exception ReplError[source]

Bases: Exception