Fixes identifier lexing; support REPL file loading

This commit is contained in:
James Eversole
2025-01-01 18:05:21 -06:00
parent bf58c9afbd
commit 39be66a4d1
5 changed files with 23 additions and 11 deletions

View File

@ -1,6 +1,7 @@
module REPL where
import Eval
import FileEval
import Lexer
import Parser
import Research
@ -21,6 +22,15 @@ repl env = runInputT defaultSettings (loop env)
case minput of
Nothing -> outputStrLn "Goodbye!"
Just ":_exit" -> outputStrLn "Goodbye!"
Just ":_load" -> do
path <- getInputLine "File path to load < "
case path of
Nothing -> do
outputStrLn "No input received; stopping import."
loop env
Just path -> do
loadedEnv <- liftIO $ evaluateFileEnv path
loop $ Map.union loadedEnv env
Just "" -> do
outputStrLn ""
loop env