mirror of
https://github.com/GaloisInc/macaw.git
synced 2024-11-29 11:02:13 +03:00
.. | ||
src/Data/Macaw/Symbolic | ||
test | ||
test-data | ||
LICENSE | ||
macaw-symbolic-syntax.cabal | ||
README.md |
macaw-symbolic-syntax
This package provides concrete syntax for macaw-symbolic types and operations.
Concretely, it implements a ParserHooks
for use with crucible-syntax
.
This ParserHooks
supports the following types and operations:
Types:
The main type addition is for representing pointers:
(Ptr n)
Unlike C/C++, these pointers are untyped and essentially correspond to uint8_t*
.
Operations:
The extra operations are:
bv-typed-literal :: Type -> Integer -> Bitvector w
where the first argument is aBitvector
type alias (see the Types section), the second argument is the value theBitvector
should contain, andw
is the number of bits in the returnedBitvector
(will match the width of theType
argument). This is useful because(bv <width> ...)
only works when you know the exact value of width as a numeral, and types likeSizeT
map to different widths depending on your architecture.pointer-make-null :: Pointer
returns a null pointer.pointer-add :: Pointer -> Bitvector w -> Pointer
wherew
is the number of bits in a pointer (usually 32 or 64).pointer-diff :: Pointer -> Pointer -> Bitvector w
wherew
is the number of bits in a pointer (usually 32 or 64).pointer-sub :: Pointer -> Bitvector w -> Pointer
wherew
is the number of bits in a pointer (usually 32 or 64).pointer-eq :: Pointer -> Pointer -> Bool
.pointer-read :: forall (t :: Type) -> Endianness -> Pointer -> t
where the first argument is the type of the value to read and the second argument isle
orbe
.Type
must either beBitvector (8 * w)
(for some positive numberw
) or one of the type aliases listed above.pointer-write :: forall (t :: Type) -> Endianness -> Pointer -> t -> Unit
where the first argument is the type of the value to read and the second argument isle
orbe
.Type
must either beBitvector (8 * w)
(for some positive numberw
) or one of the type aliases listed above.