Documentation
¶
Overview ¶
Package repl provides an interactive Read-Eval-Print Loop for Wile Scheme.
The package offers both a full-featured REPL with readline support and a simple fallback mode:
repl := repl.New(env,
repl.WithHistoryFile("~/.wile_history"),
repl.WithPrompt("> "),
)
repl.Run(ctx)
Features ¶
- Readline with history, line editing, and continuation prompts
- Integrated source-level debugger with breakpoints and stepping
- Multi-line input accumulation for incomplete expressions
- Ctrl-C clears input, Ctrl-D exits cleanly
Debug Commands ¶
Commands start with comma (,) when the input buffer is empty:
,break FILE:LINE Set breakpoint ,step Step into next expression ,next Step over (same frame) ,continue Continue execution ,backtrace Show stack trace
Standalone Functions ¶
Compile and Run are exported for use outside the REPL loop, providing the canonical compilation pipeline entry points.
Package repl provides an interactive Read-Eval-Print Loop for Scheme.
Index ¶
- func Compile(env *environment.EnvironmentFrame, expr syntax.SyntaxValue) (*machine.NativeTemplate, error)deprecated
- func Load(ctx context.Context, env *environment.EnvironmentFrame, r io.Reader, ...) errordeprecated
- func Run(ctx context.Context, tpl *machine.NativeTemplate, ...) (machine.MultipleValues, error)deprecated
- type DebugContext
- type Option
- type REPL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile
deprecated
func Compile(env *environment.EnvironmentFrame, expr syntax.SyntaxValue) (*machine.NativeTemplate, error)
Compile expands and compiles a syntax expression into a native template.
Deprecated: Use github.com/aalpar/wile/runtime.Compile instead. This function delegates to the runtime package.
func Load
deprecated
func Load(ctx context.Context, env *environment.EnvironmentFrame, r io.Reader, filename string) error
Load reads and evaluates Scheme expressions from a reader into the environment.
Deprecated: Use github.com/aalpar/wile/runtime.Load instead. This function delegates to the runtime package.
func Run
deprecated
func Run(ctx context.Context, tpl *machine.NativeTemplate, env *environment.EnvironmentFrame) (machine.MultipleValues, error)
Run executes a compiled template and returns the result values.
Deprecated: Use github.com/aalpar/wile/runtime.Run instead. This function delegates to the runtime package.
Types ¶
type DebugContext ¶
type DebugContext struct {
// contains filtered or unexported fields
}
DebugContext holds the state for debug commands.
func NewDebugContext ¶
func NewDebugContext() *DebugContext
NewDebugContext creates a new debug context.
func (*DebugContext) Debugger ¶
func (p *DebugContext) Debugger() *machine.Debugger
Debugger returns the debugger instance.
func (*DebugContext) HandleDebugCommand ¶
func (p *DebugContext) HandleDebugCommand(line string, out io.Writer) bool
HandleDebugCommand processes a debug command starting with ','. Returns true if a command was handled, false otherwise.
func (*DebugContext) SetCurrentMC ¶
func (p *DebugContext) SetCurrentMC(mc *machine.MachineContext)
SetCurrentMC sets the current machine context (for inspection commands).
type Option ¶
type Option func(*REPL)
Option configures a REPL.
func WithContinuationPrompt ¶
WithContinuationPrompt sets the continuation prompt for multi-line input.
func WithErrorOutput ¶
WithErrorOutput sets the error output writer.
func WithHistoryFile ¶
WithHistoryFile sets the history file path.
type REPL ¶
type REPL struct {
// contains filtered or unexported fields
}
REPL is an interactive Read-Eval-Print Loop.
func New ¶
func New(env *environment.EnvironmentFrame, opts ...Option) *REPL
New creates a new REPL with the given environment and options.