summaryrefslogtreecommitdiff
path: root/src-3.0/Transfer/InterpreterAPI.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-25 16:54:35 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-25 16:54:35 +0000
commite9e80fc389365e24d4300d7d5390c7d833a96c50 (patch)
treef0b58473adaa670bd8fc52ada419d8cad470ee03 /src-3.0/Transfer/InterpreterAPI.hs
parentb96b36f43de3e2f8b58d5f539daa6f6d47f25870 (diff)
changed names of resource-1.3; added a note on homepage on release
Diffstat (limited to 'src-3.0/Transfer/InterpreterAPI.hs')
-rw-r--r--src-3.0/Transfer/InterpreterAPI.hs39
1 files changed, 0 insertions, 39 deletions
diff --git a/src-3.0/Transfer/InterpreterAPI.hs b/src-3.0/Transfer/InterpreterAPI.hs
deleted file mode 100644
index 2fe04e8f3..000000000
--- a/src-3.0/Transfer/InterpreterAPI.hs
+++ /dev/null
@@ -1,39 +0,0 @@
-module Transfer.InterpreterAPI (Env, builtin,
- load, loadFile,
- evaluateString, evaluateExp
- ) where
-
-import Transfer.Core.Abs
-import Transfer.Core.Lex
-import Transfer.Core.Par
-import Transfer.Core.Print
-import Transfer.Interpreter
-import Transfer.ErrM
-
--- | Read a transfer module in core format from a string.
-load :: Monad m =>
- String -- ^ Input source name, for error messages.
- -> String -- ^ Module contents.
- -> m Env
-load n s = case pModule (myLexer s) of
- Bad e -> fail $ "Parse error in " ++ n ++ ": " ++ e
- Ok m -> return $ addModuleEnv builtin m
-
--- | Read a transfer module in core format from a file.
--- Fails in the IO monad if there is a problem loading the file.
-loadFile :: FilePath -> IO Env
-loadFile f = readFile f >>= load f
-
--- | Read a transfer expression from a string and evaluate it.
--- Returns the result as a string.
-evaluateString :: Monad m => Env -> String -> m String
-evaluateString env s =
- case pExp (myLexer s) of
- Bad e -> fail $ "Parse error: " ++ e
- Ok e -> do
- let v = eval env e
- return $ printValue v
-
--- | Evaluate an expression in the given environment.
-evaluateExp :: Env -> Exp -> Exp
-evaluateExp env exp = valueToExp $ eval env exp