Git Product home page Git Product logo

brainfuck-interpreter's Introduction

Brainfuck Interpreter

This is a brainfuck interpreter that is built with a lexer, a parser and a debugger protocol.

Currently there isn't a debugger client. If you run your program with a debugger attached, the program will wait for a client to connect and do nothing else.

Running a script

To run a brainfuck script, import the engine and create an engine options struct and pass it to a new engine.

package main

import (
  "github.com/CanPacis/brainfuck-interpreter/engine"
)

func main() {
  options := engine.EngineOptions{
    FilePath: "./bf/add.bf",
  }

  e := engine.NewEngine(options)
  // then simply run it
  e.Run()
}

Superset

This is actually intended to be a superset of brainfuck so there are extended capabilities of the runtime.

Clearing (* operator)

You can clear your tape with a * opearator.

+
>+
>+

tape is [1, 1, 1, 0, 0 ...] right now

*

tape is cleared and [0, 0, 0, 0, 0 ...] now

Escaping

You need to escape the operator keywords if you are using them in your comments. The parser cannot ignore them without proper escaping.

Bad:
Calculate 7 * 8

Good:
Calculate 7 \* 8

IO

The plan is to make brainfuck be able to read and write to more than one io target that is std. It should be able to read and write to disk, tcp or http connections or any other byte writable stream. This part is still an ongoing process.

brainfuck-interpreter's People

Contributors

canpacis avatar

Stargazers

Elif avatar

Watchers

 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.