Module ICurry.Compiler

This module contains a simple compiler from FlatCurry to ICurry programs.

To do in future work:

  • compile also imported modules depending on their date
  • remove declarations/assignments of unused variables in ICurry code

Author: Michael Hanus

Version: May 2020

Summary of exported operations:

test :: String -> IO ()   
icCompile :: ICOptions -> String -> IO IProg   
Generates an ICurry program by reading a FlatCurry program and compiling it to ICurry.
defaultICOptions :: ICOptions   
arityPosOfCons :: ICOptions -> (String,String) -> (Int,Int)   
posOfCons :: ICOptions -> (String,String) -> Int   
posOfFun :: ICOptions -> (String,String) -> Int   
printStatus :: ICOptions -> String -> IO ()   
printIntermediate :: ICOptions -> String -> IO ()   
printDetails :: ICOptions -> String -> IO ()   
funError :: ICOptions -> String -> a   
flat2icurry :: ICOptions -> Prog -> IProg   
Translation from FlatCurry to ICurry according to the transformation specified in the paper.
trVis :: Visibility -> IVisibility   
trFunc :: ICOptions -> FuncDecl -> IFunction   
demandOf :: Rule -> [Int]   
trRule :: ICOptions -> Rule -> IFuncBody   
toIBlock :: ICOptions -> [Int] -> Expr -> Int -> IBlock   
toIExpr :: ICOptions -> Expr -> IExpr   
trLit :: Literal -> ILiteral   
varPos :: [Int] -> IExpr -> [(Int,[Int])]   
showIProg :: IProg -> String   
Simple show for ICurry programs.
pre :: String -> (String,String)   

Exported datatypes:


ICOptions

Options for the ICurry compiler. Contains mappings from constructor and functions names into locally unique integers and other stuff.

Constructors:

  • ICOptions :: Int -> Bool -> Bool -> String -> Bool -> String -> Bool -> Bool -> [(QName,(IArity,Int))] -> [(QName,Int)] -> QName -> ICOptions

    Fields:

    • optVerb :: Int
    • optHelp :: Bool
    • optLift :: Bool
    • optMain :: String
    • optShowGraph :: Bool
    • optViewPDF :: String
    • optInteractive :: Bool
    • optVarDecls :: Bool
    • optConsMap :: [(QName,(IArity,Int))]
    • optFunMap :: [(QName,Int)]
    • optFun :: QName

Exported operations:

test :: String -> IO ()   

icCompile :: ICOptions -> String -> IO IProg   

Generates an ICurry program by reading a FlatCurry program and compiling it to ICurry.

defaultICOptions :: ICOptions   

Further infos:
  • solution complete, i.e., able to compute all solutions

arityPosOfCons :: ICOptions -> (String,String) -> (Int,Int)   

posOfCons :: ICOptions -> (String,String) -> Int   

posOfFun :: ICOptions -> (String,String) -> Int   

printStatus :: ICOptions -> String -> IO ()   

printIntermediate :: ICOptions -> String -> IO ()   

printDetails :: ICOptions -> String -> IO ()   

funError :: ICOptions -> String -> a   

flat2icurry :: ICOptions -> Prog -> IProg   

Translation from FlatCurry to ICurry according to the transformation specified in the paper.

trVis :: Visibility -> IVisibility   

Further infos:
  • solution complete, i.e., able to compute all solutions

demandOf :: Rule -> [Int]   

trRule :: ICOptions -> Rule -> IFuncBody   

toIBlock :: ICOptions -> [Int] -> Expr -> Int -> IBlock   

toIExpr :: ICOptions -> Expr -> IExpr   

trLit :: Literal -> ILiteral   

Further infos:
  • solution complete, i.e., able to compute all solutions

varPos :: [Int] -> IExpr -> [(Int,[Int])]   

showIProg :: IProg -> String   

Simple show for ICurry programs.

pre :: String -> (String,String)   

Further infos:
  • solution complete, i.e., able to compute all solutions