bfSource codeContentsIndex
Language.Brainfuck
Synopsis
data Command
= IncPtr
| IncPtrBy !Int
| DecPtr
| IncByte
| IncByteBy !Int
| DecByte
| OutputByte
| JmpForward !Int
| JmpBackward !Int
| SetIpTo !Int
| Halt
| Ignored
type Core = IOUArray Int Word8
type InstPtr = Int
type CorePtr = Int
data BF = BF !Core !CorePtr !InstPtr
core :: IO Core
decode :: Char -> State Int Command
debug :: Bool
incIP :: InstPtr -> InstPtr
incCP :: CorePtr -> CorePtr
decCP :: CorePtr -> CorePtr
doCommand :: Array Int Command -> BF -> IO BF
nextJmp :: Array Int Command -> InstPtr -> (InstPtr -> InstPtr) -> Command -> InstPtr
chrToWord8 :: Char -> Word8
word8ToChr :: Word8 -> Char
loadProgram :: String -> Array Int Command
optimize :: [Command] -> Array Int Command
execute :: Array Int Command -> Int -> BF -> IO ()
Documentation
data Command Source

The complete BF language:

  • > Increment the pointer. * < Decrement the pointer. * + Increment the byte at the pointer. * - Decrement the byte at the pointer. * . Output the byte at the pointer. * , Input a byte and store it in the byte at the pointer. * [ Jump forward past the matching ] if the byte at the pointer is zero. * ] Jump backward to the matching [ unless the byte at the pointer is zero.
Constructors
IncPtr
IncPtrBy !IntIncrement pointer by set amount
DecPtr
IncByte
IncByteBy !IntIncrement by a set amount
DecByte
OutputByte
JmpForward !Intnesting level
JmpBackward !Intnesting level
SetIpTo !IntSets the instruction ptr to a specific value
Halt
Ignored
show/hide Instances
type Core = IOUArray Int Word8Source
type InstPtr = IntSource
type CorePtr = IntSource
data BF Source
Constructors
BF !Core !CorePtr !InstPtr
show/hide Instances
core :: IO CoreSource
decode :: Char -> State Int CommandSource
debug :: BoolSource
incIP :: InstPtr -> InstPtrSource
incCP :: CorePtr -> CorePtrSource
decCP :: CorePtr -> CorePtrSource
doCommand :: Array Int Command -> BF -> IO BFSource
nextJmp :: Array Int Command -> InstPtr -> (InstPtr -> InstPtr) -> Command -> InstPtrSource
chrToWord8 :: Char -> Word8Source
word8ToChr :: Word8 -> CharSource
loadProgram :: String -> Array Int CommandSource
optimize :: [Command] -> Array Int CommandSource
execute :: Array Int Command -> Int -> BF -> IO ()Source
Produced by Haddock version 2.4.2