"fast.spl" import func main { mega | with args ; "Welcome to the SPL REPL!" println "Enter any code after the cursor to execute it." println "fast.spl (for shell-like functions) is included.\n" println "REPL" =program-name while { 1 } { catch { def line "" =line while { line repl-is-complete not } { def s line " > " print readln =s s "\n" concat concat =line } line _barray =line line:sub<0 line:len 1 -> _str =line "!!-end" line:contains if { 2 stop } "\n" line:contains if { "" println line println "." println } line 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 } } } func repl-is-complete { bool | with line ; "!!-end" line:contains 0 line _array :foreach<{ | with char ; char "{" :_char eq char "(" :_char eq or char "<" :_char eq or char "[" :_char eq or if { ++ } char "}" :_char eq char ")" :_char eq or char ">" :_char eq or char "]" :_char eq or if { -- } }> not or "" line eq not and }