Git Product home page Git Product logo

hbrainfuck's Introduction

This is a toy interpreter for brainfuck (in its very early stage)

How to run the program

Run

stack run -- example.bf

or

nix run . -- example.bf

to see a "hello world" !

Implementation

The "endless tape" is implemented with the zipper data structure in mind. Modifing the nth element of a linked list is expensive. In order to mitigate this, we can use a zipper implementation of a list, which facilitates traversal of near elements by expressing the list at a given point. The Tape type is a variant of a zipper list tailored for the brainfuck interpreter, since it is intentionally made to be not bounded to match the memory model of the brainfuck language.

Sources

https://en.wikipedia.org/wiki/Zipper_(data_structure) https://learnyouahaskell.com/zippers https://en.wikipedia.org/wiki/Brainfuck

Credits

Thanks to all those people who helped me along the way, without you this fun project wouldn't be possible :)

Have fun

As said, have fun!

hbrainfuck's People

Stargazers

Eric Chang avatar victor avatar Yu-Ren avatar

Watchers

Léana 江 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.