ivory-eval 0.1.0.3 → 0.1.0.4
raw patch · 2 files changed
+19/−16 lines, 2 filesdep ~basedep ~ivory
Dependency ranges changed: base, ivory
Files
- ivory-eval.cabal +4/−4
- src/Ivory/Eval.hs +15/−12
ivory-eval.cabal view
@@ -1,5 +1,5 @@ name: ivory-eval-version: 0.1.0.3+version: 0.1.0.4 author: Galois, Inc. copyright: 2014 Galois, Inc. maintainer: leepike@galois.com@@ -8,13 +8,13 @@ cabal-version: >= 1.10 synopsis: Simple concrete evaluator for Ivory programs description: Warning! This module is experimental and its implementation may change dramatically.-homepage: http://smaccmpilot.org/languages/ivory-introduction.html+homepage: http://ivorylang.org license: BSD3 license-file: LICENSE source-repository head type: git location: https://github.com/GaloisInc/ivory- tag: hackage-0103+ tag: hackage-0.1.0.4 library exposed-modules: Ivory.Eval@@ -33,7 +33,7 @@ main-is: Test.hs ghc-options: -Wall - build-depends: base >= 4.6 && < 5+ build-depends: base >= 4.7 && < 5 , base-compat , containers , tasty >= 0.10
src/Ivory/Eval.hs view
@@ -1,5 +1,5 @@+{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE RankNTypes #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} -- | A simple interpreter for a subset of Ivory.@@ -24,23 +24,26 @@ , evalStmt ) where -import Prelude ()-import qualified Prelude.Compat as Prelude-import Prelude.Compat hiding (negate, div, mod, not, and, or)+import Prelude ()+import Prelude.Compat hiding (and, div, mod,+ negate, not, or)+import qualified Prelude.Compat as Prelude -import Control.Monad (unless,foldM,void)+import Control.Monad (foldM, unless, void) import Data.Int import qualified Data.Map as Map import Data.Maybe import qualified Data.Sequence as Seq import Data.Word-import MonadLib- (ExceptionM(..),runId,Id,ExceptionT,runExceptionT,sets_- ,StateT,runStateT,StateM(..))-import Ivory.Language.Syntax.Concrete.Location import qualified Ivory.Language.Array as I import qualified Ivory.Language.Syntax as I+import Ivory.Language.Syntax.Concrete.Location+import MonadLib (ExceptionM (..),+ ExceptionT, Id,+ StateM (..), StateT,+ runExceptionT, runId,+ runStateT, sets_) -- XXX: DEBUG -- import Debug.Trace@@ -62,7 +65,7 @@ initState :: Map.Map I.Sym Value -> EvalState initState st = EvalState st NoLoc Map.empty- + -- | Run an action inside the scope of a given module. openModule :: I.Module -> Eval a -> Eval a openModule (I.Module {..}) doThis = do@@ -421,12 +424,12 @@ evalInit ty init = case init of I.InitZero -> case ty of- I.TyArr _ _ -> evalInit ty (I.InitArray [])+ I.TyArr _ _ -> evalInit ty (I.InitArray [] True) I.TyStruct _ -> evalInit ty (I.InitStruct []) _ -> return (mkVal ty 0) I.InitExpr ty expr -> evalExpr ty expr- I.InitArray inits+ I.InitArray inits _ -> case ty of I.TyArr len ty -> Array . Seq.fromList