Giter Site home page Giter Site logo

brainfuck-interpreter's Introduction

brainfuck-interpreter

Overview

A fast, powerful and configurable interpreter written in Rust, which allows various options to meet different demends, including memory (tape) length configuration, EOF handling configuration and so on.

Usage

Quick Start

$ git clone https://github.com/ctj12461/brainfuck-interpreter.git
$ cd brainfuck-interpreter
$ cargo install --path ./crates/bf-exec # The program will be installed to ~/.cargo/bin
$ bf-exec ./examples/helloworld.bf
Hello World!

Verbose Version

Usage: bf-exec [OPTIONS] <SOURCE>

Arguments:
  <SOURCE>
          the path of the brainfuck program source code file.

Options:
      --len <LEN>
          the memory (tape) length the program will use.

          [default: 32768]

      --addr <ADDR>
          the address range of the memory (tape).

           - unsigned: [0, len - 1]
           - signed: [-ceil(len / 2), ceil(len / 2) - 1]

          [default: unsigned]
          [possible values: unsigned, signed]

      --cell <CELL>
          the data type of one cell in the memory (tape).

          [default: int8]
          [possible values: int8, int32]

      --overflow <OVERFLOW>
          the operation the interpreter should do when an overflow error occurs.

           - wrap: automatically wrap the value in cell (e.g.: `127 + 1` => `-127`)
           - error: throw an error and abort

          [default: wrap]
          [possible values: wrap, error]

      --eof <EOF>
          the operation the interpreter should do when an `EOF` is read.

           - zero: turn `EOF` to `0`
           - keep: keep what the `EOF` is and return it (`EOF == -1`)
           - ignore: ignore this input and leave the cell unchanged

          [default: ignore]
          [possible values: zero, keep, ignore]

      --input <INPUT>
          the input stream type.

          [default: std]
          [possible values: null, std]

      --output <OUTPUT>
          the output stream type.

          [default: char-std]
          [possible values: char-std, int-std]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

License

Licensed under MIT.

Copyright (C) 2023 Justin Chen (ctj12461)

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.