| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Wrench.Translator.Types
Synopsis
- data Section isa w l
- data CodeToken isa l
- data DataToken w l = DataToken {}
- data DataValue w
- class ByteSize t where
- 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))
- markupOffsets :: (ByteSize t, IsWord w) => w -> [t] -> [(w, t)]
- markupSectionOffsets :: (ByteSize isa, IsWord w) => w -> [Section isa w l] -> [(w, Section isa w l)]
- class DerefMnemonic (m :: Type -> Type) w where
- derefMnemonic :: (Text -> Maybe w) -> w -> m (Ref w) -> m w
- resolveRef :: (w -> Either Text w) -> (Text -> Maybe w) -> Ref w -> w
- data Ref w
- = Ref {
- refPrepare :: w -> w
- refPos :: SourcePos
- refLabel :: Text
- | ValueR {
- refPrepare :: w -> w
- refPos :: SourcePos
- refValue :: w
- = Ref {
- 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
- type Preprocessor = String -> Either (Int, Text) String
- preprocess :: [Preprocessor] -> String -> Either (Int, Text) String
Documentation
Constructors
| Code | |
Fields
| |
| Data | |
Fields
| |
class ByteSize t where Source #
Instances
| ByteSize Int32 Source # | |
| ByteSize Int8 Source # | |
| ByteSize Word32 Source # | |
| ByteSizeT w => ByteSize (DataValue w) Source # | |
| ByteSize (Acc32Isa w l) Source # | |
| ByteSize (F32aIsa w l) Source # | |
| ByteSizeT w => ByteSize (Argument w l) Source # | |
| ByteSizeT w => ByteSize (M68kIsa w l) Source # | |
| ByteSize (RiscIvIsa w l) Source # | |
| ByteSize (VliwIvIsa w l) Source # | |
| ByteSize (Wasm32Isa w l) Source # | |
| ByteSize isa => ByteSize (CodeToken isa l) Source # | |
| ByteSizeT w => ByteSize (DataToken w l) Source # | |
| (ByteSize isa, ByteSizeT w) => ByteSize (Section isa w l) 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 #
Instances
| IsWord w => DerefMnemonic (Acc32Isa w) w Source # | |
Defined in Wrench.Isa.Acc32 | |
| DerefMnemonic (F32aIsa w) w Source # | |
Defined in Wrench.Isa.F32a | |
| IsWord w => DerefMnemonic (M68kIsa w) w Source # | |
Defined in Wrench.Isa.M68k | |
| IsWord w => DerefMnemonic (RiscIvIsa w) w Source # | |
Defined in Wrench.Isa.RiscIv | |
| IsWord w => DerefMnemonic (VliwIvIsa w) w Source # | |
Defined in Wrench.Isa.VliwIv | |
| IsWord w => DerefMnemonic (Wasm32Isa w) w Source # | |
Defined in Wrench.Isa.Wasm32.Instruction | |
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.
Constructors
| Ref | |
Fields
| |
| ValueR | |
Fields
| |
Instances
| Show w => Show (Ref w) Source # | |
| Eq w => Eq (Ref w) Source # | |
| IsWord w => MnemonicParser (Acc32Isa w (Ref w)) Source # | |
| IsWord w => MnemonicParser (F32aIsa w (Ref w)) Source # | |
| IsWord w => MnemonicParser (M68kIsa w (Ref w)) Source # | |
| IsWord w => MnemonicParser (RiscIvIsa w (Ref w)) Source # | |
| IsWord w => MnemonicParser (VliwIvIsa w (Ref w)) Source # | |
| IsWord w => MnemonicParser (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.
preprocess :: [Preprocessor] -> String -> Either (Int, Text) String Source #