Runs the tool |
Implementation of the command-line interface/tool and abstract RW program generation.
Author: Lasse Züngel
Version: July 2024
version
:: Float
Implementation of the abstract ReadWrite program generation tool The codegen version. |
genClass
:: [CFuncDecl] -> RWM CClassDecl
Generates the ReadWrite class. |
genInstance
:: CTypeDecl -> RWM CInstanceDecl
Generates a ReadWrite
instance for a type declaration.
|
genInstances
:: [CTypeDecl] -> RWM [CInstanceDecl]
|
gen
:: RWM CurryProg
Generates the complete RW curry program. |
genFunction
:: CTypeDecl -> FunctionLayout -> RWM CFuncDecl
For a given type t and a function layout, this function generates a function declaration. |
allDataDefs
:: CurryProg -> [(String,String)]
Analyzes the module, handles missing data definitions Returns the names of all data definitions in the given program. |
allDataUsed
:: CurryProg -> [(String,String)]
Returns the names of all data definitions used in the program. |
allPredefined
:: Naming -> [CInstanceDecl] -> [(String,String)]
Returns the names of all data names defined in the program. |
containsFunction
:: CTypeDecl -> Bool
Returns true iff the type declaration contains functional types. |
modules
:: [(String,String)] -> [String]
Returns the module names of all qualified names. |
defaultStrLn
:: Int
CLI tool implementation The default minimum string length for extraction. |
defaultAlphabetLength
:: Int
The default string id alphabet length. |
runTool
:: [String] -> [FunctionLayout] -> IO ()
Runs the codegen tool for the given read and write generator as well as the format representation type. |
toolBanner
:: String
Command line processing |
processOptions
:: [String] -> IO (CLOptions,[String])
|
printUsage
:: IO ()
|
options
:: [OptDescr (CLOptions -> CLOptions)]
|
generateOperations
:: CLOptions -> CurryProg
Based on the command line options, this function generates a module containing specific parametrized versions of the write and show functions. |
coding
:: String
FunctionGenerator implementations for the RW class instances hexadezimal coding |
logI
:: Int -> Int -> Int
Logarithm to base b |
codingI
:: Int -> Int -> String
Used to encode a constructor index as a list of characters (for pattern matching in the read function). |
generatorShow
:: CTypeDecl -> RWM [CRule]
show generator implementation |
generatorRead
:: CTypeDecl -> RWM [CRule]
read generator implementation |
generatorWrite
:: CTypeDecl -> RWM [CRule]
write generator implementation |
generatorTypeOf
:: CTypeDecl -> RWM [CRule]
For a data definition data T a b ... |
rwbaseName
:: String -> (String,String)
|
main
:: IO ()
Runs the tool |
runWith
:: [String] -> IO ()
|
Implementation of the abstract ReadWrite program generation tool The codegen version.
|
Generates the ReadWrite class. |
Generates a T t1 ... tn = C1 c1_1 ... c1_k1 | ... | Cn cn_1 ... cn_kn the function generates an instance instance (ReadWrite t1, ..., ReadWrite tn) => ReadWrite (T t1 ... tn) where read = ... write = ... ... The concrete read and write (and/or possibly other) function generation depends on the generator functions supplied by the concrete implementation. |
|
For a given type t and a function layout, this function generates a function declaration. The function layout contains the name of the function, the type of the function and the generator function for the function body. |
Analyzes the module, handles missing data definitions Returns the names of all data definitions in the given program. |
Returns the names of all data definitions used in the program. |
Returns the names of all data names defined in the program. Used to retrieve the names of all predefined data definition instances. |
Returns true iff the type declaration contains functional types. |
Returns the module names of all qualified names. |
CLI tool implementation The default minimum string length for extraction.
|
The default string id alphabet length.
|
Runs the codegen tool for the given read and write generator as well as the format representation type. |
Command line processing
|
|
|
Based on the command line options, this function generates a module containing specific parametrized versions of the write and show functions. |
FunctionGenerator implementations for the RW class instances hexadezimal coding |
Logarithm to base b |
Used to encode a constructor index as a list of characters (for pattern matching in the read function). |
show generator implementation |
read generator implementation |
write generator implementation |
For a data definition data T a b ... = ... this function generates the following code: typeOf :: T a b ... -> RWType typeOf n = RWType "T" [typeOf (geta n), typeOf (getb n), ...] where geta :: T a b ... -> a geta (T a b ...) = failed ... |
|
Runs the tool |
|