Add enhanced REPL with rustyline

REPL improvements:
- Tab completion for keywords, commands, and user definitions
- Persistent history saved to ~/.lux_history
- Better line editing with Emacs keybindings
- Ctrl-C to cancel input, Ctrl-D to exit
- History search with Ctrl-R

New commands:
- :info <name> - Show type information for a binding
- :env - List user-defined bindings with types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 04:32:52 -05:00
parent db516f5cff
commit 052db9c88f
2 changed files with 300 additions and 54 deletions

View File

@@ -114,6 +114,11 @@ impl TypeChecker {
}
}
/// Look up a type scheme by name (for REPL :info command)
pub fn lookup(&self, name: &str) -> Option<&TypeScheme> {
self.env.bindings.get(name)
}
/// Type check a program
pub fn check_program(&mut self, program: &Program) -> Result<(), Vec<TypeError>> {
// First pass: collect all declarations