The haskell-brainfuck package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Warnings:

BrainFuck language interpreter. Provides a library for evaluation and an executable to evaluate brainfuck files. Evaluation happens under an arbitrary monad so programn can be evaluated doing IO to stdinstdout or in memory using the State monad.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.1, 0.1.0.1
Change logNone available
Dependenciesbase (==4.7.*), bytestring (==0.10.4.0), haskell-brainfuck, mtl (==2.1.3.1), parsec (==3.1.5) [details]
LicenseMIT
Copyright(c) 2014 Sebastian Galkin
AuthorSebastian Galkin <paraseba@gmail.com>
MaintainerSebastian Galkin <paraseba@gmail.com>
CategoryLanguage
Source repositoryhead: git clone https://github.com/paraseba/haskell-brainfuck
Executablesbrainfuck
UploadedFri Aug 8 07:12:15 UTC 2014 by paraseba

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for haskell-brainfuck-0.1.0.1

[back to package description]

haskell-brainfuck

Interpreter for the brainfuck programming language

Build Status

haskel-brainfuck is distributed as a library, but it also includes an executable to run brainfuck programs. You can find haskell-brainfuck in Hackage

Usage

Library

import HaskBF.Eval
import qualified Data.ByteString.Lazy as BS
import Control.Monad.State

main = do
  -- The following will evaluate the file using stdin and stdout for I/O.
  -- Evaluation results in an EvalResult

  file <- BS.readFile "/path/to/file.bf"
  (EvalSuccess _) <- evalBS defaultIOMachine file
  print "ok"


  -- The following will evaluate the file using the State monad and input
  -- provided by input

  let input  = []
      output = []
      result = execState (evalStr simulatorMachine "+.>-.") (SimState input output)
  print $ simStateOutput result == [1, -1]

Executable

brainfuck fib.bf

Tests

You can run the test suite with

cabal test

Documentation

http://paraseba.github.io/haskell-brainfuck/