haskell-brainfuck-0.1.0.0: BrainFuck interpreter

Copyright(c) Sebastian Galkin, 2014
LicenseMIT
Maintainerparaseba@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010
ExtensionsTupleSections

HaskBF.Parser

Description

 

Synopsis

Documentation

type Program = [Op] Source

A program is a list of Ops. One possible Op is a Loop of other Ops

data Op Source

Brainfuck operations

Constructors

IncP

Increment the byte pointer: ">"

DecP

Decrement the byte pointer: "<"

Inc

Increment the byte pointed by the pointer: "+"

Dec

Decrement the byte pointed by the pointer: "-"

PutByte

Write the byte pointed by the pointer (side-effect): "."

GetByte

Read a byte, write at the current location (side-effect): ","

Loop [Op]

Loop over Ops untill current == 0 : "[...]"

Instances

parseProgram :: ByteString -> Either ParseError Program Source

Parse program stream. Returns an error or the parsed Program