curry-frontend-1.0.4: Compile the functional logic language Curry to several intermediate formats

Copyright(c) 1999 - 2003 Wolfgang Lux
Martin Engelke
2016 - 2017 Finn Teegen
LicenseBSD-3-clause
Maintainerbjp@informatik.uni-kiel.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

IL.Type

Contents

Description

The module IL defines the intermediate language which will be compiled into abstract machine code. The intermediate language removes a lot of syntactic sugar from the Curry source language. Top-level declarations are restricted to data type and function definitions. A newtype definition serves mainly as a hint to the backend that it must provide an auxiliary function for partial applications of the constructor (Newtype constructors must not occur in patterns and may be used in expressions only as partial applications.).

Type declarations use a de-Bruijn indexing scheme (starting at 0) for type variables. In the type of a function, all type variables are numbered in the order of their occurence from left to right, i.e., a type '(Int -> b) -> (a,b) -> c -> (a,c)' is translated into the type (using integer numbers to denote the type variables) '(Int -> 0) -> (1,0) -> 2 -> (1,2)'.

Pattern matching in an equation is handled via flexible and rigid Case expressions. Overlapping rules are translated with the help of Or expressions. The intermediate language has three kinds of binding expressions, Exist expressions introduce a new logical variable, Let expression support a single non-recursive variable binding, and Letrec expressions introduce multiple variables with recursive initializer expressions. The intermediate language explicitly distinguishes (local) variables and (global) functions in expressions.

Note: this modified version uses haskell type Integer instead of Literal for representing integer values. This provides an unlimited range of integer constants in Curry programs.

Synopsis

Data types

data Module Source #

Instances
Eq Module Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Module -> Module -> Bool #

(/=) :: Module -> Module -> Bool #

Show Module Source # 
Instance details

Defined in IL.Type

data Decl Source #

Instances
Eq Decl Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Decl -> Decl -> Bool #

(/=) :: Decl -> Decl -> Bool #

Show Decl Source # 
Instance details

Defined in IL.Type

Methods

showsPrec :: Int -> Decl -> ShowS #

show :: Decl -> String #

showList :: [Decl] -> ShowS #

data ConstrDecl Source #

Constructors

ConstrDecl QualIdent [Type] 
Instances
Eq ConstrDecl Source # 
Instance details

Defined in IL.Type

Show ConstrDecl Source # 
Instance details

Defined in IL.Type

data Type Source #

Instances
Eq Type Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Show Type Source # 
Instance details

Defined in IL.Type

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

data Literal Source #

Constructors

Char Char 
Int Integer 
Float Double 
Instances
Eq Literal Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Literal -> Literal -> Bool #

(/=) :: Literal -> Literal -> Bool #

Show Literal Source # 
Instance details

Defined in IL.Type

data ConstrTerm Source #

Constructors

LiteralPattern Type Literal

literal patterns

ConstructorPattern Type QualIdent [(Type, Ident)]

constructors

VariablePattern Type Ident

default

Instances
Eq ConstrTerm Source # 
Instance details

Defined in IL.Type

Show ConstrTerm Source # 
Instance details

Defined in IL.Type

Typeable ConstrTerm Source # 
Instance details

Defined in IL.Typing

data Expression Source #

Constructors

Literal Type Literal

literal constants

Variable Type Ident

variables

Function Type QualIdent Int

functions

Constructor Type QualIdent Int

constructors

Apply Expression Expression

applications

Case Eval Expression [Alt]

case expressions

Or Expression Expression

non-deterministic or

Exist Ident Type Expression

exist binding (introduction of a free variable)

Let Binding Expression

let binding

Letrec [Binding] Expression

letrec binding

Typed Expression Type

typed expression

Instances
Eq Expression Source # 
Instance details

Defined in IL.Type

Show Expression Source # 
Instance details

Defined in IL.Type

Expr Expression Source # 
Instance details

Defined in IL.Type

Methods

fv :: Expression -> [Ident] Source #

Typeable Expression Source # 
Instance details

Defined in IL.Typing

data Eval Source #

Constructors

Rigid 
Flex 
Instances
Eq Eval Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Eval -> Eval -> Bool #

(/=) :: Eval -> Eval -> Bool #

Show Eval Source # 
Instance details

Defined in IL.Type

Methods

showsPrec :: Int -> Eval -> ShowS #

show :: Eval -> String #

showList :: [Eval] -> ShowS #

data Alt Source #

Constructors

Alt ConstrTerm Expression 
Instances
Eq Alt Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Alt -> Alt -> Bool #

(/=) :: Alt -> Alt -> Bool #

Show Alt Source # 
Instance details

Defined in IL.Type

Methods

showsPrec :: Int -> Alt -> ShowS #

show :: Alt -> String #

showList :: [Alt] -> ShowS #

Expr Alt Source # 
Instance details

Defined in IL.Type

Methods

fv :: Alt -> [Ident] Source #

Typeable Alt Source # 
Instance details

Defined in IL.Typing

Methods

typeOf :: Alt -> Type Source #

data Binding Source #

Constructors

Binding Ident Expression 
Instances
Eq Binding Source # 
Instance details

Defined in IL.Type

Methods

(==) :: Binding -> Binding -> Bool #

(/=) :: Binding -> Binding -> Bool #

Show Binding Source # 
Instance details

Defined in IL.Type