26 lines
608 B
Haskell
26 lines
608 B
Haskell
module FileEval where
|
|
|
|
import Eval
|
|
import Library
|
|
import Parser
|
|
import Research
|
|
|
|
import System.IO
|
|
|
|
import qualified Data.Map as Map
|
|
|
|
evaluateFile :: FilePath -> IO T
|
|
evaluateFile filePath = do
|
|
contents <- readFile filePath
|
|
let asts = parseTricu contents
|
|
let finalEnv = evalTricu library asts
|
|
case Map.lookup "__result" finalEnv of
|
|
Just finalResult -> return finalResult
|
|
Nothing -> error "No result found in final environment"
|
|
|
|
evaluateFileEnv :: FilePath -> IO Env
|
|
evaluateFileEnv filePath = do
|
|
contents <- readFile filePath
|
|
let asts = parseTricu contents
|
|
pure $ evalTricu library asts
|