Module System.FrontendExec

This module contains operations to execute the front end of the Curry system.

Author: Bernd Brassel, Michael Hanus, Bjoern Peemoeller, Finn Teegen

Version: March 2021

Summary of exported operations:

defaultParams :: FrontendParams  Deterministic 
The default parameters of the front end.
rcParams :: IO FrontendParams  Deterministic 
The default parameters of the front end as configured by the compiler specific resource configuration file.
setQuiet :: Bool -> FrontendParams -> FrontendParams  Deterministic 
Set quiet mode of the front end.
setExtended :: Bool -> FrontendParams -> FrontendParams  Deterministic 
Set extended mode of the front end.
setCpp :: Bool -> FrontendParams -> FrontendParams  Deterministic 
Set cpp mode of the front end.
addDefinition :: (String,Int) -> FrontendParams -> FrontendParams  Deterministic 
Add cpp definition of the front end.
setDefinitions :: [(String,Int)] -> FrontendParams -> FrontendParams  Deterministic 
Set cpp definitions of the front end.
setOverlapWarn :: Bool -> FrontendParams -> FrontendParams  Deterministic 
Set overlap warn mode of the front end.
setFullPath :: [String] -> FrontendParams -> FrontendParams  Deterministic 
Set the full path of the front end.
setHtmlDir :: String -> FrontendParams -> FrontendParams  Deterministic 
Set the htmldir parameter of the front end.
setOutDir :: String -> FrontendParams -> FrontendParams  Deterministic 
Sets the output directory of frontend artifacts (currySubdir by default)
setLogfile :: String -> FrontendParams -> FrontendParams  Deterministic 
Set the logfile parameter of the front end.
setSpecials :: String -> FrontendParams -> FrontendParams  Deterministic 
Set additional specials parameters of the front end.
addTarget :: FrontendTarget -> FrontendParams -> FrontendParams  Deterministic 
Add an additional front end target.
setFrontendPath :: String -> FrontendParams -> FrontendParams  Deterministic 
Sets the path to the frontend executable.
callFrontend :: FrontendTarget -> String -> IO ()  Non-deterministic 
In order to make sure that compiler generated files (like .fcy, .fint, .acy) are up to date, one can call the front end of the Curry compiler with this action.
callFrontendWithParams :: FrontendTarget -> FrontendParams -> String -> IO ()  Non-deterministic 
In order to make sure that compiler generated files (like .fcy, .fint, .acy) are up to date, one can call the front end of the Curry compiler with this action where various parameters can be set.
getFrontendCall :: FrontendTarget -> FrontendParams -> String -> IO String  Non-deterministic 
Returns the system command invoked to call the front end of the Curry compiler where various parameters can be set.

Exported datatypes:


FrontendTarget

Data type for representing the different target files that can be produced by the front end of the Curry compiler.

Constructors:

  • FCY :: FrontendTarget : FlatCurry file ending with .fcy
  • TFCY :: FrontendTarget : Typed FlatCurry file ending with .tfcy
  • FINT :: FrontendTarget : FlatCurry interface file ending with .fint
  • ACY :: FrontendTarget : AbstractCurry file ending with .acy
  • UACY :: FrontendTarget : Untyped (without type checking) AbstractCurry file ending with .uacy
  • HTML :: FrontendTarget : colored HTML representation of source program
  • CY :: FrontendTarget : source representation employed by the frontend
  • TOKS :: FrontendTarget : token stream of source program
  • TAFCY :: FrontendTarget : Type Annotated FlatCurry file ending with .tafcy
  • AST :: FrontendTarget : abstract syntax tree ending with .sast
  • SAST :: FrontendTarget : shortened abstract syntax tree ending with .sast
  • COMMS :: FrontendTarget : comments stream ending with .cycom

FrontendParams

Abstract data type for representing parameters supported by the front end of the Curry compiler.

Constructors:

  • FrontendParams :: Bool -> Bool -> Bool -> [(String,Int)] -> Bool -> (Maybe [String]) -> (Maybe String) -> String -> (Maybe String) -> [FrontendTarget] -> String -> String -> FrontendParams

    Fields:

    • quiet :: Bool
    • extended :: Bool
    • cpp :: Bool
    • definitions :: [(String,Int)]
    • overlapWarn :: Bool
    • fullPath :: (Maybe [String])
    • htmldir :: (Maybe String)
    • outdir :: String
    • logfile :: (Maybe String)
    • targets :: [FrontendTarget]
    • specials :: String
    • frontendPath :: String

Exported operations:

defaultParams :: FrontendParams  Deterministic 

The default parameters of the front end.

rcParams :: IO FrontendParams  Deterministic 

The default parameters of the front end as configured by the compiler specific resource configuration file.

setQuiet :: Bool -> FrontendParams -> FrontendParams  Deterministic 

Set quiet mode of the front end.

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

setExtended :: Bool -> FrontendParams -> FrontendParams  Deterministic 

Set extended mode of the front end.

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

setCpp :: Bool -> FrontendParams -> FrontendParams  Deterministic 

Set cpp mode of the front end.

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

addDefinition :: (String,Int) -> FrontendParams -> FrontendParams  Deterministic 

Add cpp definition of the front end.

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

setDefinitions :: [(String,Int)] -> FrontendParams -> FrontendParams  Deterministic 

Set cpp definitions of the front end.

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

setOverlapWarn :: Bool -> FrontendParams -> FrontendParams  Deterministic 

Set overlap warn mode of the front end.

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

setFullPath :: [String] -> FrontendParams -> FrontendParams  Deterministic 

Set the full path of the front end. If this parameter is set, the front end searches all modules in this path (instead of using the default path).

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

setHtmlDir :: String -> FrontendParams -> FrontendParams  Deterministic 

Set the htmldir parameter of the front end. Relevant for HTML generation.

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

setOutDir :: String -> FrontendParams -> FrontendParams  Deterministic 

Sets the output directory of frontend artifacts (currySubdir by default)

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

setLogfile :: String -> FrontendParams -> FrontendParams  Deterministic 

Set the logfile parameter of the front end. If this parameter is set, all messages produced by the front end are stored in this file.

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

setSpecials :: String -> FrontendParams -> FrontendParams  Deterministic 

Set additional specials parameters of the front end. These parameters are specific for the current front end and should be used with care, since their form might change in the future.

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

addTarget :: FrontendTarget -> FrontendParams -> FrontendParams  Deterministic 

Add an additional front end target.

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

setFrontendPath :: String -> FrontendParams -> FrontendParams  Deterministic 

Sets the path to the frontend executable.

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

callFrontend :: FrontendTarget -> String -> IO ()  Non-deterministic 

In order to make sure that compiler generated files (like .fcy, .fint, .acy) are up to date, one can call the front end of the Curry compiler with this action. If the front end returns with an error, an exception is raised.

Example call:
(callFrontend target progname)
Parameters:
  • target : the kind of target file to be generated
  • progname : the name of the main module to be compiled

callFrontendWithParams :: FrontendTarget -> FrontendParams -> String -> IO ()  Non-deterministic 

In order to make sure that compiler generated files (like .fcy, .fint, .acy) are up to date, one can call the front end of the Curry compiler with this action where various parameters can be set. If the front end returns with an error, an exception is raised.

Example call:
(callFrontendWithParams target params modpath)
Parameters:
  • target : the kind of target file to be generated
  • params : parameters for the front end
  • modpath : the name of the main module possibly prefixed with a directory where this module resides

getFrontendCall :: FrontendTarget -> FrontendParams -> String -> IO String  Non-deterministic 

Returns the system command invoked to call the front end of the Curry compiler where various parameters can be set.

Example call:
(getFrontendCall target params modpath)
Parameters:
  • target : the kind of target file to be generated
  • params : parameters for the front end
  • modpath : the name of the main module possibly prefixed with a directory where this module resides