Safe Haskell | None |
---|---|
Language | Haskell98 |
CoreRun Public API
Intended for constructing basic CoreRun Programs.
CoreRun is a simplified Core intended to be used for direct interpretation/execution. For semantics, see TBD
- data Mod
- data Exp
- type MbExp = Maybe Exp
- data SExp
- data Alt
- type Bind = Exp
- data RRef
- data Import
- data Meta
- data DataCon
- type CRArray x = Vector x
- mkLocLevRef :: Int -> Int -> RRef
- mkLocDifRef :: Int -> Int -> RRef
- mkGlobRef :: Int -> Int -> RRef
- mkImpRef :: Int -> Int -> RRef
- mkModRef :: Int -> RRef
- mkExp :: SExp -> Exp
- mkVar :: RRef -> Exp
- mkVar' :: RRef -> SExp
- mkInt :: Int -> Exp
- mkInt' :: Int -> SExp
- mkChar :: Char -> Exp
- mkChar' :: Char -> SExp
- mkInteger :: Integer -> Exp
- mkInteger' :: Integer -> SExp
- mkString :: String -> Exp
- mkString' :: String -> SExp
- mkDbg :: String -> Exp
- mkDbg' :: String -> SExp
- mkApp :: Exp -> [SExp] -> Exp
- mkApp' :: Exp -> CRArray SExp -> Exp
- mkTup :: Int -> [SExp] -> Exp
- mkTup' :: Int -> CRArray SExp -> Exp
- mkEval :: Exp -> Exp
- mkTail :: Exp -> Exp
- mkCase :: SExp -> [Exp] -> Exp
- mkLam :: Int -> Int -> Exp -> Exp
- mkLam' :: Maybe HsName -> Int -> Int -> Exp -> Exp
- mkLet :: Int -> [Exp] -> Exp -> Exp
- mkLet' :: Int -> CRArray Exp -> Exp -> Exp
- mkFFI :: String -> [SExp] -> Exp
- mkFFI' :: String -> CRArray SExp -> Exp
- mkMetaDataCon :: HsName -> Int -> DataCon
- mkMetaDataType :: HsName -> [DataCon] -> Meta
- mkMod :: HsName -> Int -> Int -> [Bind] -> Exp -> Mod
- mkMod' :: HsName -> Int -> Int -> CRArray Bind -> Exp -> Mod
- mkModWithMetas :: HsName -> Int -> Int -> [Meta] -> CRArray Bind -> Exp -> Mod
- mkModWithImportsMetas :: HsName -> Int -> Int -> [Import] -> [Meta] -> CRArray Bind -> Maybe Exp -> Mod
- mkImport :: HsName -> Import
- rrefToDif :: Int -> RRef -> RRef
- parseModFromString :: String -> Either [String] Mod
- runCoreRunIO :: EHCOpts -> Mod -> IO (Either Err RVal)
- printModule :: EHCOpts -> Mod -> PP_Doc
CoreRun AST
The datatypes making up a CoreRun program.
Identifier references for use during running CoreRun
Utilities
Construction functions
References
mkLocLevRef :: Int -> Int -> RRef Source
RRef
to local or outside scoped, using absolute level and offset (this is to be converted to a level difference + offset encoding for running, see mkLocDifRef
)
mkLocDifRef :: Int -> Int -> RRef Source
RRef
to local or outside scoped, using level difference (to a current) and offset
mkGlobRef :: Int -> Int -> RRef Source
RRef
to global from module, using module nr and offset (will become obsolete, replaced by either Imp or Mod Ref
Expressions
mkInteger' :: Integer -> SExp Source
Integer constant as SExp
mkDbg' :: String -> SExp Source
Debug info as SExp
, will make an interpreter stop with displaying the message
:: Int | nr of arguments, 0 encodes a thunk/CAF |
-> Int | total stack size, including arguments, locals, expression calculation |
-> Exp | body |
-> Exp |
Lambda
:: Maybe HsName | a name for this lambda, to be used for pretty printing |
-> Int | nr of arguments, 0 encodes a thunk/CAF |
-> Int | total stack size, including arguments, locals, expression calculation |
-> Exp | body |
-> Exp |
Lambda
FFI
FFI
Meta
:: HsName | constructor name (without module qualifier, name must be globally unique) |
-> Int | constructor tag |
-> DataCon |
Meta: datatype constructor info
Meta: datatype constructor info
Modules
:: HsName | module name |
-> Int | module number |
-> Int | total stack size, including globals of module, their setup (see semantics), and the main startup part kicking of evaluation |
-> [Bind] | bound expressions |
-> Exp | body of main |
-> Mod |
Module
:: HsName | module name |
-> Int | module number |
-> Int | total stack size, including globals of module, their setup (see semantics), and the main startup part kicking of evaluation |
-> CRArray Bind | bound expressions |
-> Exp | body of main |
-> Mod |
Module
:: HsName | module name |
-> Int | module number |
-> Int | total stack size, including globals of module, their setup (see semantics), and the main startup part kicking of evaluation |
-> [Meta] | meta info |
-> CRArray Bind | bound expressions |
-> Exp | body of main |
-> Mod |
Module, with meta info
:: HsName | module name |
-> Int | module number |
-> Int | total stack size, including globals of module, their setup (see semantics), and the main startup part kicking of evaluation |
-> [Import] | imports |
-> [Meta] | meta info |
-> CRArray Bind | bound expressions |
-> Maybe Exp | body of main, absence of main indicated by Nothing |
-> Mod |
Module, with imports, with meta info
Conversion
rrefToDif :: Int -> RRef -> RRef Source
Convert to RRef_Loc to RRef_LDf, i.e. absolute level to relative (to current) level
Parsing
parseModFromString :: String -> Either [String] Mod Source
Parses a module. TBD: integration with other parser utils from EHC driver...
Running
:: EHCOpts | options, e.g. for turning on tracing (if supported by runner) |
-> Mod | the module to run |
-> IO (Either Err RVal) |
Run CoreRun in IO TBD: fix dependence on whole program linked