wrench-0.0.6.3
Safe HaskellSafe-Inferred
LanguageHaskell2010

Wrench.Translator.Types

Synopsis

Documentation

data Section isa w l Source #

Constructors

Code 

Fields

Data 

Fields

Instances

Instances details
(Show l, Show isa, Show w) => Show (Section isa w l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

showsPrec :: Int -> Section isa w l -> ShowS #

show :: Section isa w l -> String #

showList :: [Section isa w l] -> ShowS #

(ByteSize isa, ByteSizeT w) => ByteSize (Section isa w l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: Section isa w l -> Int Source #

data CodeToken isa l Source #

Constructors

Label l 
Mnemonic isa 

Instances

Instances details
(Show l, Show isa) => Show (CodeToken isa l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

showsPrec :: Int -> CodeToken isa l -> ShowS #

show :: CodeToken isa l -> String #

showList :: [CodeToken isa l] -> ShowS #

ByteSize isa => ByteSize (CodeToken isa l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: CodeToken isa l -> Int Source #

data DataToken w l Source #

Constructors

DataToken 

Fields

Instances

Instances details
(Show l, Show w) => Show (DataToken w l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

showsPrec :: Int -> DataToken w l -> ShowS #

show :: DataToken w l -> String #

showList :: [DataToken w l] -> ShowS #

ByteSizeT w => ByteSize (DataToken w l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: DataToken w l -> Int Source #

data DataValue w Source #

Constructors

DByte [Word8] 
DWord [w] 

Instances

Instances details
Show w => Show (DataValue w) Source # 
Instance details

Defined in Wrench.Translator.Types

ByteSizeT w => ByteSize (DataValue w) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: DataValue w -> Int Source #

class ByteSize t where Source #

Methods

byteSize :: t -> Int Source #

Instances

Instances details
ByteSize Int32 Source # 
Instance details

Defined in Wrench.Machine.Types

Methods

byteSize :: Int32 -> Int Source #

ByteSize Int8 Source # 
Instance details

Defined in Wrench.Machine.Types

Methods

byteSize :: Int8 -> Int Source #

ByteSize Word32 Source # 
Instance details

Defined in Wrench.Machine.Types

Methods

byteSize :: Word32 -> Int Source #

ByteSizeT w => ByteSize (DataValue w) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: DataValue w -> Int Source #

ByteSize (Acc32Isa w l) Source # 
Instance details

Defined in Wrench.Isa.Acc32

Methods

byteSize :: Acc32Isa w l -> Int Source #

ByteSize (F32aIsa w l) Source # 
Instance details

Defined in Wrench.Isa.F32a

Methods

byteSize :: F32aIsa w l -> Int Source #

ByteSizeT w => ByteSize (Argument w l) Source # 
Instance details

Defined in Wrench.Isa.M68k

Methods

byteSize :: Argument w l -> Int Source #

ByteSizeT w => ByteSize (M68kIsa w l) Source # 
Instance details

Defined in Wrench.Isa.M68k

Methods

byteSize :: M68kIsa w l -> Int Source #

ByteSize (RiscIvIsa w l) Source # 
Instance details

Defined in Wrench.Isa.RiscIv

Methods

byteSize :: RiscIvIsa w l -> Int Source #

ByteSize (VliwIvIsa w l) Source # 
Instance details

Defined in Wrench.Isa.VliwIv

Methods

byteSize :: VliwIvIsa w l -> Int Source #

ByteSize (Wasm32Isa w l) Source # 
Instance details

Defined in Wrench.Isa.Wasm32.Instruction

Methods

byteSize :: Wasm32Isa w l -> Int Source #

ByteSize isa => ByteSize (CodeToken isa l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: CodeToken isa l -> Int Source #

ByteSizeT w => ByteSize (DataToken w l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: DataToken w l -> Int Source #

(ByteSize isa, ByteSizeT w) => ByteSize (Section isa w l) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

byteSize :: Section isa w l -> Int Source #

type IsWord w = (Bits w, FiniteBits w, ByteSize w, ByteSizeT w, Default w, Enum w, FromSign w, Num (Unsign w), Hashable w, Num w, Ord (Unsign w), Ord w, Read w, Show w, WordParts w, Integral w, FromSign w, Bounded w, Bounded (Unsign w)) Source #

markupOffsets :: (ByteSize t, IsWord w) => w -> [t] -> [(w, t)] Source #

markupSectionOffsets :: (ByteSize isa, IsWord w) => w -> [Section isa w l] -> [(w, Section isa w l)] Source #

class DerefMnemonic (m :: Type -> Type) w where Source #

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> m (Ref w) -> m w Source #

Instances

Instances details
IsWord w => DerefMnemonic (Acc32Isa w) w Source # 
Instance details

Defined in Wrench.Isa.Acc32

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> Acc32Isa w (Ref w) -> Acc32Isa w w Source #

DerefMnemonic (F32aIsa w) w Source # 
Instance details

Defined in Wrench.Isa.F32a

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> F32aIsa w (Ref w) -> F32aIsa w w Source #

IsWord w => DerefMnemonic (M68kIsa w) w Source # 
Instance details

Defined in Wrench.Isa.M68k

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> M68kIsa w (Ref w) -> M68kIsa w w Source #

IsWord w => DerefMnemonic (RiscIvIsa w) w Source # 
Instance details

Defined in Wrench.Isa.RiscIv

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> RiscIvIsa w (Ref w) -> RiscIvIsa w w Source #

IsWord w => DerefMnemonic (VliwIvIsa w) w Source # 
Instance details

Defined in Wrench.Isa.VliwIv

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> VliwIvIsa w (Ref w) -> VliwIvIsa w w Source #

IsWord w => DerefMnemonic (Wasm32Isa w) w Source # 
Instance details

Defined in Wrench.Isa.Wasm32.Instruction

Methods

derefMnemonic :: (Text -> Maybe w) -> w -> Wasm32Isa w (Ref w) -> Wasm32Isa w w Source #

resolveRef :: (w -> Either Text w) -> (Text -> Maybe w) -> Ref w -> w Source #

Resolve a Ref against a label table and check the result against the instruction field it is going to be encoded into. Strict, so that an unresolved label aborts translation here rather than becoming a thunk that only blows up later if something happens to read it. Either failure is reported with the position the reference was written at.

data Ref w Source #

Constructors

Ref 

Fields

ValueR 

Fields

Instances

Instances details
Show w => Show (Ref w) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

showsPrec :: Int -> Ref w -> ShowS #

show :: Ref w -> String #

showList :: [Ref w] -> ShowS #

Eq w => Eq (Ref w) Source # 
Instance details

Defined in Wrench.Translator.Types

Methods

(==) :: Ref w -> Ref w -> Bool #

(/=) :: Ref w -> Ref w -> Bool #

IsWord w => MnemonicParser (Acc32Isa w (Ref w)) Source # 
Instance details

Defined in Wrench.Isa.Acc32

Methods

mnemonic :: Parser (Acc32Isa w (Ref w)) Source #

IsWord w => MnemonicParser (F32aIsa w (Ref w)) Source # 
Instance details

Defined in Wrench.Isa.F32a

Methods

mnemonic :: Parser (F32aIsa w (Ref w)) Source #

IsWord w => MnemonicParser (M68kIsa w (Ref w)) Source # 
Instance details

Defined in Wrench.Isa.M68k

Methods

mnemonic :: Parser (M68kIsa w (Ref w)) Source #

IsWord w => MnemonicParser (RiscIvIsa w (Ref w)) Source # 
Instance details

Defined in Wrench.Isa.RiscIv

Methods

mnemonic :: Parser (RiscIvIsa w (Ref w)) Source #

IsWord w => MnemonicParser (VliwIvIsa w (Ref w)) Source # 
Instance details

Defined in Wrench.Isa.VliwIv

Methods

mnemonic :: Parser (VliwIvIsa w (Ref w)) Source #

IsWord w => MnemonicParser (Wasm32Isa w (Ref w)) Source # 
Instance details

Defined in Wrench.Isa.Wasm32.Instruction

Methods

mnemonic :: Parser (Wasm32Isa w (Ref w)) Source #

derefSection :: (ByteSize (isa (Ref w)), DerefMnemonic isa w, IsWord w, Show (isa w)) => (Text -> Maybe w) -> w -> Section (isa (Ref w)) w Text -> Section (isa w) w w Source #

type Preprocessor = String -> Either (Int, Text) String Source #

Rewrites the source before it is parsed. It keeps every character at its offset, so that errors are shown against the original source, and fails with the offset of what it rejects.