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: August 2020

Summary of exported operations:

icCompile :: ICOptions -> String -> IO IProg   
Generates an ICurry program by reading a FlatCurry program and compiling it to ICurry.
flatCurry2ICurry :: ICOptions -> Prog -> IO IProg   
Translates a FlatCurry program into an ICurry program.
defaultICOptions :: ICOptions   
printStatus :: ICOptions -> String -> IO ()   
printIntermediate :: ICOptions -> String -> IO ()   

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:

icCompile :: ICOptions -> String -> IO IProg   

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

flatCurry2ICurry :: ICOptions -> Prog -> IO IProg   

Translates a FlatCurry program into an ICurry program. It also reads the imported modules in order to access their data and function declarations.

defaultICOptions :: ICOptions   

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

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

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