Code Monkey home page Code Monkey logo

bf-interpreter-in-c's Introduction

bf-interpreter-in-c

CodeFactor

A simple brainfxxk interpreter, implemented in pure C.

say "Hello, World!"

make hello-world

Compile

gcc ./src/bf.c -Wall -o ./bf.out

Run

./bf.out hello-world.bf

Examples / Test cases

99 Bottles of Beer

from http://www.99-bottles-of-beer.net/language-brainfuck-101.html

./bf.out 99-bottles-of-beer.bf

Sierpinski triangle

./bf.out sierpinski-triangles.bf

Print square numbers from 1 to 10000

./bf.out squares.bf

Mandelbrot (what's this?)

./bf.out mandelbrot.bf

Christmas Tree (Happy X'mas!)

from https://codegolf.stackexchange.com/questions/15860/make-a-scalable-christmas-tree

I made this for a challenge on /r/dailyprogrammer, (not sure if reusing code is against the spirit/rules of this) but:

Brainfuck. Takes as input a number (length of bottom row of leaves) and two characters. One space between each.

Example input: 13 = +

Example output:

      +
     +++
    +++++
   +++++++
  +++++++++
 +++++++++++
+++++++++++++
     ===
./bf.out ./christmas_tree.bf

Input:

1
3
 
=
 
+

The Brainfuck to C interpretor

from https://gist.github.com/roachhd/dce54bec8ba55fb17d3a

[/* bf2c.b
* The Brainfuck to C interpretor
* Katie ball
*
* NOTE: This was rushed and currently
* it does not take well to any characters of input besides
* the 8 standard brainfuck operators and newline and EOF.
* So consequently, it will only interpret un-commented code.
* Check my web site for a later release
* that will probably have support for commented code.
*/]
./bf.out ./bf2c.bf > bf2c.bfout.c

Input:

Your bf code, with an EOF in the end.

The sample output (using the bf source as input) is here for you to check.

bf-interpreter-in-c's People

Contributors

xiongnemo avatar

Stargazers

 avatar  avatar

Watchers

 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.