Module Main

The main module of currypp, the Curry Preprocessor

The Curry Preprocessor transforms the source code of Curry programs. Currently, only the translation of foreign code integrated in Curry code is supported (option foreigncode, see module Translator).

Author: Michael Hanus

Version: November 2021

Summary of exported operations:

cppBanner :: String  Deterministic 
parseTarget :: String -> Maybe PPTarget  Deterministic 
initOpts :: PPOpts  Deterministic 
main :: IO ()  Non-deterministic 
The main function of the Curry Preprocessor.
processOptions :: PPOpts -> [String] -> Maybe PPOpts  Deterministic 
showUsage :: [String] -> IO ()  Deterministic 
usageText :: String  Deterministic 
preprocess :: PPOpts -> String -> String -> String -> String -> IO ()  Non-deterministic 
callPreprocessors :: PPOpts -> String -> String -> String -> String -> IO String  Non-deterministic 
pathToModName :: String -> String -> (Maybe String,String)  Deterministic 
Transforms a file path name for a module back into a hierarchical module name since only the file path of a module is passed to the preprocessor.
replaceOptionsLine :: String -> String  Deterministic 
isOptionLine :: String -> Bool  Deterministic 
optionLines :: String -> String  Deterministic 

Exported datatypes:


PPTarget

Preprocessor targets, i.e., kind of entities to be preprocessed:

Constructors:

  • ForeignCode :: PPTarget
  • DefaultRules :: PPTarget
  • Contracts :: PPTarget

PPOpts

Preprocessor options:

Constructors:

  • PPOpts :: Bool -> Bool -> Int -> [PPTarget] -> String -> [String] -> [String] -> PPOpts

    Fields:

    • optHelp :: Bool
    • optSave :: Bool
    • optVerb :: Int
    • optTgts :: [PPTarget]
    • optModel :: String
    • optDefRules :: [String]
    • optContracts :: [String]

Exported operations:

cppBanner :: String  Deterministic 

parseTarget :: String -> Maybe PPTarget  Deterministic 

initOpts :: PPOpts  Deterministic 

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

main :: IO ()  Non-deterministic 

The main function of the Curry Preprocessor.

processOptions :: PPOpts -> [String] -> Maybe PPOpts  Deterministic 

showUsage :: [String] -> IO ()  Deterministic 

usageText :: String  Deterministic 

preprocess :: PPOpts -> String -> String -> String -> String -> IO ()  Non-deterministic 

callPreprocessors :: PPOpts -> String -> String -> String -> String -> IO String  Non-deterministic 

pathToModName :: String -> String -> (Maybe String,String)  Deterministic 

Transforms a file path name for a module back into a hierarchical module name since only the file path of a module is passed to the preprocessor. This is done if the file path name is prefixed by a directory in the currypath, otherwise the directory of the path is returned in the first result component and the plain base name in the second. This might be wrong for a hierachical module not occurring in the currypath, but in this case it is difficult to reconstruct the original module name from the file path without looking inside the module.

replaceOptionsLine :: String -> String  Deterministic 

isOptionLine :: String -> Bool  Deterministic 

optionLines :: String -> String  Deterministic