Commit dacc5d1f authored by Michael Hanus 's avatar Michael Hanus

Adapt to version3

parent 02e322b7
{
"name": "icurry",
"version": "3.0.1",
"version": "3.1.0",
"author": "Michael Hanus <mh@informatik.uni-kiel.de>",
"synopsis": "Intermediate format for compiling Curry to imperative languages",
"category": [ "Metaprogramming" ],
"license": "BSD-3-Clause",
"licenseFile": "LICENSE",
"dependencies": {
"base" : ">= 1.0.0, < 2.0.0",
"currypath" : ">= 0.0.1",
"flatcurry" : ">= 2.0.0, < 3.0.0",
"graphviz" : ">= 2.0.0, < 3.0.0",
"transformers" : ">= 2.0.0"
"base" : ">= 3.0.0, < 4.0.0",
"currypath" : ">= 3.0.0, < 4.0.0",
"directory" : ">= 3.0.0, < 4.0.0",
"filepath" : ">= 3.0.0, < 4.0.0",
"flatcurry" : ">= 3.0.0, < 4.0.0",
"graphviz" : ">= 3.0.0, < 4.0.0",
"io-extra" : ">= 3.0.0, < 4.0.0",
"process" : ">= 3.0.0, < 4.0.0",
"read-legacy" : ">= 3.0.0, < 4.0.0",
"transformers" : ">= 3.0.0, < 4.0.0",
"wl-pprint" : ">= 3.0.0, < 4.0.0"
},
"compilerCompatibility": {
"pakcs": ">= 2.0.0, < 3.0.0",
"kics2": ">= 2.0.0, < 3.0.0"
"pakcs": ">= 3.0.0, < 4.0.0",
"kics2": ">= 3.0.0, < 4.0.0"
},
"exportedModules": [ "ICurry.Types", "ICurry.Files", "ICurry.Pretty",
"ICurry.Compiler", "ICurry.Interpreter" ],
......
......@@ -5,12 +5,12 @@
--- constructor ordering of the corresponding data definitions.
---
--- @author Michael Hanus
--- @version January 2020
--- @version November 2020
------------------------------------------------------------------------------
module FlatCurry.CaseCompletion where
import List
import Data.List
import FlatCurry.Files
import FlatCurry.Types
......@@ -113,6 +113,8 @@ dataDeclsOf :: Prog -> [DataDecl]
dataDeclsOf (Prog _ _ tdecls _ _) = concatMap dataDeclsOfTypeDecl tdecls
where
dataDeclsOfTypeDecl (TypeSyn _ _ _ _) = []
dataDeclsOfTypeDecl (TypeNew _ _ _ _) =
error $ "FlatCurry.CaseCompletion: newtype occurred!" -- TODO!
dataDeclsOfTypeDecl (Type tn _ _ cdecl) =
[(tn, map (\ (Cons cn ar _ _) -> (cn,ar)) cdecl)]
......
......@@ -7,12 +7,12 @@
--- should only be used if the actual function types are irrelevant!
---
--- @author Michael Hanus
--- @version June 2020
--- @version November 2020
------------------------------------------------------------------------------
module FlatCurry.CaseLifting where
import List ( maximum, union )
import Data.List ( maximum, union )
import Control.Monad.Trans.State ( State, get, put, modify, evalState )
import FlatCurry.Goodies ( allVars, funcName )
......
......@@ -6,7 +6,7 @@
--- * remove declarations/assignments of unused variables in ICurry code
---
--- @author Michael Hanus
--- @version August 2020
--- @version November 2020
------------------------------------------------------------------------------
module ICurry.Compiler
......@@ -14,7 +14,8 @@ module ICurry.Compiler
, printStatus, printIntermediate )
where
import List ( elemIndex, maximum )
import Control.Monad ( when )
import Data.List ( elemIndex, maximum )
import FlatCurry.Files ( readFlatCurry )
import FlatCurry.Goodies ( allVars, consName, funcName, funcVisibility
......@@ -159,6 +160,8 @@ flat2icurry opts (Prog modname imps types funs _) =
(map (trFunc opts) funs)
where
trTypeDecl (_, TypeSyn _ _ _ _) = []
trTypeDecl (_, TypeNew _ _ _ _) =
error $ "ICurry.Compiler: newtype occurred!" -- TODO!
trTypeDecl (ti, Type (mn,tn) _ _ cdecl) =
[IDataType (mn,tn,ti)
(map (\ (i, Cons (cmn,cn) ar _ _) -> ((cmn,cn,i),ar))
......
......@@ -2,18 +2,17 @@
--- This library defines I/O actions to read and write ICurry programs.
---
--- @author Michael Hanus
--- @version February 2020
--- @version November 2020
------------------------------------------------------------------------------
module ICurry.Files where
import Directory ( doesFileExist )
import FilePath ( takeFileName, (</>), (<.>) )
import ReadShowTerm ( readUnqualifiedTerm, showTerm )
import ReadShowTerm ( readUnqualifiedTerm, showTerm )
import System.CurryPath ( inCurrySubdir, stripCurrySuffix
, lookupModuleSourceInLoadPath
)
import System.Directory ( doesFileExist )
import System.FilePath ( takeFileName, (</>), (<.>) )
import ICurry.Types
......
......@@ -2,16 +2,17 @@
--- An implementation of term graphs used by the ICurry interpreter.
---
--- @author Michael Hanus
--- @version January 2020
--- @version November 2020
------------------------------------------------------------------------------
module ICurry.Graph
where
import IO ( hPutStr, hClose )
import IOExts ( connectToCommand )
import List ( intercalate, nub )
import System ( system )
import Data.List ( intercalate, nub )
import System.IO ( hPutStr, hClose )
import System.IOExts ( connectToCommand )
import System.Process ( system )
import ShowDotGraph as Dot
......@@ -31,10 +32,10 @@ viewDot withviewer num =
dothdl <- connectToCommand $ "dot -Tpdf -o" ++ outpdf
hPutStr dothdl dottxt
hClose dothdl
maybe done
maybe (return ())
(\c -> do
system $ unwords [c, outpdf, "2> /dev/null", "> /dev/null", "&"]
done)
return ())
withviewer
------------------------------------------------------------------------------
......
------------------------------------------------------------------------------
--- A simple interpreter for ICurry based on the a small-step semantics.
---
-- The following invariants are required for ICurry programs:
-- 1. No nested case expression
-- 2. If there is a case expression, it is on some argument and the
-- argument index is contained in the demand information of the function.
--- The following invariants are required for ICurry programs:
--- 1. No nested case expression
--- 2. If there is a case expression, it is on some argument and the
--- argument index is contained in the demand information of the function.
---
--- @author Michael Hanus
--- @version November 2020
------------------------------------------------------------------------------
module ICurry.Interpreter
where
import List ( init, isPrefixOf, last, replace )
import System ( sleep, system )
import Control.Monad ( when )
import Data.List ( init, isPrefixOf, last, replace )
import System.Process ( sleep, system )
import ICurry.Types
import ICurry.Graph
......
......@@ -2,16 +2,18 @@
--- This module contains a simple compiler from FlatCurry to ICurry programs.
---
--- @author Michael Hanus
--- @version August 2020
--- @version November 2020
------------------------------------------------------------------------------
module ICurry.Main where
import GetOpt
import ReadNumeric ( readNat )
import System ( exitWith, getArgs )
import Control.Monad ( when, unless )
import Numeric ( readNat )
import System.Environment ( getArgs )
import System.Console.GetOpt
import System.CurryPath ( stripCurrySuffix )
import System.CurryPath ( stripCurrySuffix )
import System.Process ( exitWith )
import ICurry.Compiler
import ICurry.Files
......@@ -30,8 +32,8 @@ testI p =
banner :: String
banner = unlines [bannerLine, bannerText, bannerLine]
where
bannerText = "ICurry Compiler (Version of 06/08/20)"
bannerLine = take (length bannerText) (repeat '=')
bannerText = "ICurry Compiler (Version of 30/11/20)"
bannerLine = take (length bannerText) (repeat '=')
main :: IO ()
main = do
......@@ -115,11 +117,9 @@ options =
"do not generate variable declarations when\nvariables are introduced by assignments"
]
where
safeReadNat opttrans s opts =
let numError = error "Illegal number argument (try `-h' for help)"
in maybe numError
(\ (n,rs) -> if null rs then opttrans n opts else numError)
(readNat s)
safeReadNat opttrans s opts = case readNat s of
[(n,"")] -> opttrans n opts
_ -> error "Illegal number argument (try `-h' for help)"
checkVerb n opts = if n>=0 && n<4
then opts { optVerb = n }
......
......@@ -2,12 +2,14 @@
--- This module contains a pretty printer for ICurry programs.
---
--- @author Marc Andre Wittorf and Michael Hanus
--- @version June 2020
--- @version November 2020
------------------------------------------------------------------------------
module ICurry.Pretty where
import List ( intercalate, intersperse )
import Prelude hiding ( empty )
import Data.List ( intercalate, intersperse )
import ICurry.Types
import Text.Pretty
......
......@@ -5,7 +5,7 @@
--- to visualize them.
---
--- @author Michael Hanus
--- @version December 2020
--- @version November 2020
--------------------------------------------------------------------------
module ShowDotGraph
......@@ -14,13 +14,13 @@ module ShowDotGraph
, getDotViewCmd, setDotViewCmd )
where
import Char ( isAlphaNum )
import Distribution ( rcFileName )
import IO
import IOExts
import List ( intercalate, last )
import Data.Char ( isAlphaNum )
import Data.List ( intercalate, last )
import System.IO ( hClose, hPutStr )
import Data.PropertyFile ( getPropertyFromFile, updatePropertyFile )
import System.CurryPath ( curryrcFileName )
import System.IOExts ( connectToCommand )
--------------------------------------------------------------------------
-- Data types for graphs.
......@@ -120,14 +120,14 @@ viewDot dottxt = do
--- Curry system.
getDotViewCmd :: IO String
getDotViewCmd = do
rcfile <- rcFileName
rcfile <- curryrcFileName
getPropertyFromFile rcfile "dotviewcommand" >>= return . maybe "" id
--- Sets the command for viewing dot files in the rc file of the
--- Curry system.
setDotViewCmd :: String -> IO ()
setDotViewCmd dvcmd = do
rcfile <- rcFileName
rcfile <- curryrcFileName
updatePropertyFile rcfile "dotviewcommand" dvcmd
-------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment