HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Yhc/API/Bytecode

< Yhc | API

Part of Yhc

(Download)

On the step towards a full API for the whole compiler, an API for just the bytecode first will probably be desirable.

There are two entirely separate lumps in this, the raw bytecode, and the wrappers that make a module file.

1 Module

data Module = Module {objects :: [Object]}
data PackageVer = PackageVer {version :: [Int], name :: String}
data ModuleName = ModuleName PackageVer {name :: String}
data Import = Import ModuleName {name :: String, arity :: Int}
data Export = Export {name :: String, obj :: Object, arity :: Int}
data Object = Function Arity ConstTable HufByteCode
            | Constructor Arity TagNo
type ConstTable = [Const]
type HufByteCode = [HufBC]

2 Bytecode

There are tree types of bytecode representation:

data GraphNode = ...
data LabeledJumps = ...

Then there are the api's

instance Show GraphNode
instance Show ByteCode
instance Show ByteCodeHuf
instance Show ...

graphToByteCode :: GraphNode -> ByteCode
byteCodeToGraph :: ByteCode -> GraphNode
byteCodeCompress :: ByteCode -> ByteCodeHuf
byteCodeInflate :: ByteCodeHuf -> ByteCode
writeModule :: Module -> FilePath -> IO ()
readModule :: FilePath -> IO Module
-- do memory and zapping analysis
memAnalysis :: a -> a
-- peep hole optimisations
peephole :: a -> a

Retrieved from "http://www.haskell.org/haskellwiki/Yhc/API/Bytecode"

This page has been accessed 1,865 times. This page was last modified 23:36, 15 January 2006. Recent content is available under a simple permissive license.