Library to support meta-programming in Curry.
This library contains a definition for representing Curry programs
in Curry (type "CProg").
NOTE: The I/O actions to read Curry programs and transform them
into this abstract representation can be found in the module
AbsCurryIO.
Author: Michael Hanus
Version: May 2004
| Exported names: |
Datatypes:
CBranchExpr
| CConsDecl
| CEvalAnnot
| CExpr
| CFixity
| CFuncDecl
| CLiteral
| CLocalDecl
| COpDecl
| CPattern
| CProg
| CRule
| CRules
| CStatement
| CTVarIndex
| CTypeDecl
| CTypeExpr
| CVarIndex
| CVisibility
Constructors:
CApply
| CBranch
| CCase
| CCharc
| CChoice
| CCons
| CDoExpr
| CExported
| CExternal
| CFlex
| CFloatc
| CFunc
| CFuncType
| CInfixlOp
| CInfixOp
| CInfixrOp
| CIntc
| CLambda
| CLetDecl
| CListComp
| CLit
| CLocalFunc
| CLocalPat
| CLocalVar
| COp
| CPComb
| CPLit
| CPrivate
| CProg
| CPVar
| CRigid
| CRule
| CRules
| CSExpr
| CSLet
| CSPat
| CSymbol
| CTCons
| CTVar
| CType
| CTypeSyn
| CVar
| Summary of exported functions: |
| Imported modules: |
| Exported datatypes: |
The data type for representing type variables. They are represented by (CTVar i) where i is a type variable index.
Type synonym: CTVarIndex = Int
Data types for representing object variables. Object variables occurring in expressions are represented by (Var i) where i is a variable index.
Type synonym: CVarIndex = Int
Data type for representing a Curry module in the intermediate form.
A value of this data type has the form
(CProg modname imports typedecls functions opdecls)
where modname: name of this module,
imports: list of modules names that are imported,
typedecls, opdecls, functions: see below
Constructors:
:: String -> [String] -> [CTypeDecl] -> [CFuncDecl] -> [COpDecl] -> CProg
Constructors:
:: CVisibility
:: CVisibility
Data type for representing definitions of algebraic data types and type synonyms.
A data type definition of the form
data t x1...xn = ...| c t1....tkc |...
is represented by the Curry term
(CType t v [i1,...,in] [...(CCons c kc v [t1,...,tkc])...])
where each ij is the index of the type variable xj
Note: the type variable indices are unique inside each type declaration and are usually numbered from 0
Thus, a data type declaration consists of the name of the data type, a list of type parameters and a list of constructor declarations.
Constructors:
:: String -> CVisibility -> [Int] -> [CConsDecl] -> CTypeDecl
:: String -> CVisibility -> [Int] -> CTypeExpr -> CTypeDecl
A constructor declaration consists of the name and arity of the constructor and a list of the argument types of the constructor.
Constructors:
:: String -> Int -> CVisibility -> [CTypeExpr] -> CConsDecl
Data type for type expressions.
A type expression is either a type variable, a function type,
or a type constructor application.
Note: the names of the predefined type constructors are
"Int", "Float", "Bool", "Char", "IO", "Success",
"()" (unit type), "(,...,)" (tuple types), "[]" (list type)
Constructors:
:: Int -> CTypeExpr
:: CTypeExpr -> CTypeExpr -> CTypeExpr
:: String -> String -> [CTypeExpr] -> CTypeExpr
Data type for operator declarations. An operator declaration "fix p n" in Curry corresponds to the AbstractCurry term (COp n fix p).
Constructors:
:: String -> CFixity -> Int -> COpDecl
Constructors:
:: CFixity
:: CFixity
:: CFixity
Data type for representing function declarations.
A function declaration in FlatCurry is a term of the form
(CFunc name arity visibility type (CRules eval [CRule rule1,...,rulek]))
and represents the function "name" with definition
name :: type rule1 ... rulek
Note: the variable indices are unique inside each rule
External functions are represented as (CFunc name arity type (CExternal s)) where s is the external name associated to this function.
Thus, a function declaration consists of the name, arity, type, and a list of rules.
Constructors:
:: String -> Int -> CVisibility -> CTypeExpr -> CRules -> CFuncDecl
A rule is either a list of formal parameters together with an expression (i.e., a rule in flat form), a list of general program rules with an evaluation annotation, or it is externally defined
Constructors:
:: CEvalAnnot -> [CRule] -> CRules
:: String -> CRules
Data type for classifying evaluation annotations for functions. They can be either flexible (default), rigid, or choice.
Constructors:
:: CEvalAnnot
:: CEvalAnnot
:: CEvalAnnot
The most general form of a rule. It consists of a list of patterns (left-hand side), a list of guards ("success" if not present in the source text) with their corresponding right-hand sides, and a list of local declarations.
Constructors:
:: [CPattern] -> [(CExpr,CExpr)] -> [CLocalDecl] -> CRule
Data type for representing local (let/where) declarations
Constructors:
:: CFuncDecl -> CLocalDecl
:: CTypeExpr -> CPattern -> CExpr -> [CLocalDecl] -> CLocalDecl
:: CTypeExpr -> Int -> CLocalDecl
Data type for representing Curry expressions.
Constructors:
:: Int -> CExpr
:: CLiteral -> CExpr
:: String -> String -> CExpr
:: CExpr -> CExpr -> CExpr
:: [CPattern] -> CExpr -> CExpr
:: [CLocalDecl] -> CExpr -> CExpr
:: [CStatement] -> CExpr
:: CExpr -> [CStatement] -> CExpr
:: CExpr -> [CBranchExpr] -> CExpr
Data type for representing statements in do expressions and list comprehensions.
Constructors:
:: CExpr -> CStatement
:: CPattern -> CExpr -> CStatement
:: [CLocalDecl] -> CStatement
Data type for representing pattern expressions.
Constructors:
:: Int -> CPattern
:: CLiteral -> CPattern
:: String -> String -> [CPattern] -> CPattern
Data type for representing branches in case expressions.
Constructors:
:: CPattern -> CExpr -> CBranchExpr
Data type for representing literals occurring in an expression. It is either an integer, a float, or a character constant.
Constructors:
:: Int -> CLiteral
:: Float -> CLiteral
:: Char -> CLiteral
| Exported functions: |