module Compiler where import Eval import Parser import Research import System.IO import qualified Data.Map as Map evaluateFile :: FilePath -> IO T evaluateFile filePath = do contents <- readFile filePath let linesOfFile = lines contents let env = foldl evaluateLine Map.empty linesOfFile case Map.lookup "__result" env of Just finalResult -> return finalResult Nothing -> error "No result found in final environment" evaluateLine :: Env -> String -> Env evaluateLine env line = let ast = parseSingle line in evalSingle env ast