Module "AbsCurry.curry"

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:

Prelude

 Exported datatypes:

CTVarIndex

The data type for representing type variables. They are represented by (CTVar i) where i is a type variable index.

Type synonym: CTVarIndex = Int


CVarIndex

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


CProg

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:

CProg :: String -> [String] -> [CTypeDecl] -> [CFuncDecl] -> [COpDecl] -> CProg


CVisibility

Constructors:

CExported :: CVisibility
CPrivate :: CVisibility


CTypeDecl

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:

CType :: String -> CVisibility -> [Int] -> [CConsDecl] -> CTypeDecl
CTypeSyn :: String -> CVisibility -> [Int] -> CTypeExpr -> CTypeDecl


CConsDecl

A constructor declaration consists of the name and arity of the constructor and a list of the argument types of the constructor.

Constructors:

CCons :: String -> Int -> CVisibility -> [CTypeExpr] -> CConsDecl


CTypeExpr

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:

CTVar :: Int -> CTypeExpr
CFuncType :: CTypeExpr -> CTypeExpr -> CTypeExpr
CTCons :: String -> String -> [CTypeExpr] -> CTypeExpr


COpDecl

Data type for operator declarations. An operator declaration "fix p n" in Curry corresponds to the AbstractCurry term (COp n fix p).

Constructors:

COp :: String -> CFixity -> Int -> COpDecl


CFixity

Constructors:

CInfixOp :: CFixity
CInfixlOp :: CFixity
CInfixrOp :: CFixity


CFuncDecl

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:

CFunc :: String -> Int -> CVisibility -> CTypeExpr -> CRules -> CFuncDecl


CRules

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:

CRules :: CEvalAnnot -> [CRule] -> CRules
CExternal :: String -> CRules


CEvalAnnot

Data type for classifying evaluation annotations for functions. They can be either flexible (default), rigid, or choice.

Constructors:

CFlex :: CEvalAnnot
CRigid :: CEvalAnnot
CChoice :: CEvalAnnot


CRule

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:

CRule :: [CPattern] -> [(CExpr,CExpr)] -> [CLocalDecl] -> CRule


CLocalDecl

Data type for representing local (let/where) declarations

Constructors:

CLocalFunc :: CFuncDecl -> CLocalDecl
CLocalPat :: CTypeExpr -> CPattern -> CExpr -> [CLocalDecl] -> CLocalDecl
CLocalVar :: CTypeExpr -> Int -> CLocalDecl


CExpr

Data type for representing Curry expressions.

Constructors:

CVar :: Int -> CExpr
CLit :: CLiteral -> CExpr
CSymbol :: String -> String -> CExpr
CApply :: CExpr -> CExpr -> CExpr
CLambda :: [CPattern] -> CExpr -> CExpr
CLetDecl :: [CLocalDecl] -> CExpr -> CExpr
CDoExpr :: [CStatement] -> CExpr
CListComp :: CExpr -> [CStatement] -> CExpr
CCase :: CExpr -> [CBranchExpr] -> CExpr


CStatement

Data type for representing statements in do expressions and list comprehensions.

Constructors:

CSExpr :: CExpr -> CStatement
CSPat :: CPattern -> CExpr -> CStatement
CSLet :: [CLocalDecl] -> CStatement


CPattern

Data type for representing pattern expressions.

Constructors:

CPVar :: Int -> CPattern
CPLit :: CLiteral -> CPattern
CPComb :: String -> String -> [CPattern] -> CPattern


CBranchExpr

Data type for representing branches in case expressions.

Constructors:

CBranch :: CPattern -> CExpr -> CBranchExpr


CLiteral

Data type for representing literals occurring in an expression. It is either an integer, a float, or a character constant.

Constructors:

CIntc :: Int -> CLiteral
CFloatc :: Float -> CLiteral
CCharc :: Char -> CLiteral



 Exported functions:


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Jun 16 17:26:25 2009