Coder Social home page Coder Social logo

bignumfuck's Introduction

BigNumFuck

BigNumFuck is a dialect of the brainfuck programming language(1) that uses the same 8 simple commands (+-<>[],.) but works with numbers instead of ASCII characters. This simplifies the input/output of many programs without changing the basic language idioms that characterize brainfuck.

I provide an unoptimized interpreter of BigNumFuck implemented as a lazy generator function writen in Python 2/3 compatible code. It is able to deal with non-negative integers of arbitrary size and it will dinamically adapt the length of the tape as soon as the right end is reached.

Implementation Details:

Syntax: BigNumFuck(PROGRAM, INPUT, DEBUG = False)

  • The PROGRAM is parsed in advance to remove all non valid tokens and to check for matching brackets integrity.
  • The INPUT and the OUTPUT are formated as a stream of non-negative integers that are lazily consumed/produced using the Python's iterator protocol. Reading from an exhausted INPUT buffer does nothing in the current cell.
  • Each cell is initialized with a '0' and may contain any positive integer (of arbitrary size). A '-' does nothing in a cell already containing a '0'.
  • The TAPE grows dinamically each time a '>' reaches the right end. A '<' does nothing if the TAPE_PTR is in the origin (TAPE[0]).
  • Set DEBUG = True to get a really verbose output.

(1) https://en.wikipedia.org/wiki/Brainfuck

bignumfuck's People

Contributors

carloslunamota avatar carlos-luna avatar

Watchers

James Cloos avatar  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.