spl/spl/repl.spl

29 lines
776 B
Text

func main { mega | with args ;
"Welcome to the SPL REPL!" println
"Enter any code after the cursor to execute it.\n" println
"REPL" =program-name
while { 1 } {
catch {
" > " print readln dyn-read exec2 "\n" print
}
{ with err ;
err:message dup null eq if {
pop
"Uncaught error."
} err:trace
with msg trace ;
program-name dup if {
program-name print " panicked at:" println
} not if {
"Program panicked at:" println
}
&println trace:foreach
"\nPanic message:" println
" " print msg println
"\nRecovering." println
}
}
}