Skip to content

Commit

Permalink
runtime: add CEK Evaluator
Browse files Browse the repository at this point in the history
- on track for #108
  • Loading branch information
doyougnu committed Jan 14, 2024
1 parent 9cc4dab commit ea1aea6
Show file tree
Hide file tree
Showing 11 changed files with 929 additions and 379 deletions.
1 change: 1 addition & 0 deletions klister.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ library
Core.Builder
Datatype
Env
CEKEvaluator
Evaluator
Expander
Expander.DeclScope
Expand Down
13 changes: 5 additions & 8 deletions repl/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
{-# LANGUAGE ViewPatterns #-}
module Main where

import Control.Exception
import Control.Exception hiding (evaluate)
import Control.Lens hiding (argument)
import Control.Monad
import Control.Monad.Trans.Reader
import Control.Monad.Trans.Except

import Data.Foldable (for_)
import Data.IORef
Expand All @@ -22,7 +20,7 @@ import System.Exit (exitFailure, exitSuccess)
import System.IO
import System.Directory

import Evaluator
import CEKEvaluator
import Expander
import ModuleName
import Parser
Expand Down Expand Up @@ -148,7 +146,6 @@ repl ctx startWorld = do
prettyPrint expr
putStrLn ""
currentWorld <- readIORef theWorld
runExceptT (runReaderT (runEval (eval expr)) (phaseEnv runtime currentWorld)) >>=
\case
Left evalErr -> print evalErr
Right val -> prettyPrintLn val
prettyPrintLn $ evaluateIn (phaseEnv runtime currentWorld) expr
-- Left evalErr -> print evalErr
-- Right val -> prettyPrintLn val
Loading

0 comments on commit ea1aea6

Please sign in to comment.