Module System.FrontendExec

Author
Bernd Brassel, Michael Hanus, Bjoern Peemoeller, Finn Teegen
Version
March 2021

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

Type of targets of the front end


data 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 (written to M_curry.html for source module M.curry)
  • CY :: FrontendTarget
    source representation employed by the frontend ending with .cy
  • TOKS :: FrontendTarget
    token stream of source program ending with .tokens
  • TAFCY :: FrontendTarget
    Type Annotated FlatCurry file ending with .tafcy
  • AST :: FrontendTarget
    abstract syntax tree ending with .ast
  • SAST :: FrontendTarget
    shortened abstract syntax tree ending with .sast
  • COMMS :: FrontendTarget
    comments stream ending with .cycom

Known instances:


Parameters of the front end and their manipulation


data FrontendParams

Abstract data type for representing parameters supported by the front end of the Curry compiler. The parameters are of the form FrontendParams Quiet Extended Cpp NoOverlapWarn FullPath HtmlDir LogFile Specials FrontendPath

Constructors:

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

    Fields:

    • quiet :: Bool : work silently
    • extended :: Bool : support extended Curry syntax
    • cpp :: Bool : enable conditional compiling
    • definitions :: [(String, Int)] : definitions for conditional compiling
    • overlapWarn :: Bool : warn for overlapping rules
    • fullPath :: (Maybe [String]) : the complete list of directory names for loading modules
    • htmldir :: (Maybe String) : output directory for HTML target
    • outdir :: String : output directory for Curry artifacts
    • logfile :: (Maybe String) : store all output (including errors) of the front end in file
    • targets :: [FrontendTarget] : additional targets for the front end
    • specials :: String : additional special parameters (use with care!)
    • frontendPath :: String : the path to the frontend executable

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

addTarget :: FrontendTarget -> FrontendParams -> FrontendParams  Deterministic 

Add an additional front end target.

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

setFrontendPath :: String -> FrontendParams -> FrontendParams  Deterministic 

Sets the path to the frontend executable.

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

Operations to call the front end


callFrontend :: FrontendTarget -> String -> IO ()  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.

:: FrontendTarget  the kind of target file to be generated
-> String  the name of the main module to be compiled
-> IO () 

callFrontendWithParams :: FrontendTarget -> FrontendParams -> String -> IO ()  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.

:: FrontendTarget  the kind of target file to be generated
-> FrontendParams  parameters for the front end
-> String  the name of the main module to be compiled (possibly prefixed with a directory where this module resides)
-> IO () 

getFrontendCall :: FrontendTarget -> FrontendParams -> String -> IO String  Deterministic 

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

:: FrontendTarget  the kind of target file to be generated
-> FrontendParams  parameters for the front end
-> String  the name of the main module possibly prefixed with a directory where the module resides
-> IO String  system command to invoke the front end