Skip to content

huonw/brainfuck_macros

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status

A simple procedural macro that turns a Brainfuck program into native code.

Example:

#![feature(phase)]

#[phase(plugin)] extern crate brainfuck_macros;

use std::io;

fn main() {
    let hello_world = brainfuck!{
        ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>
        ---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
    };

    hello_world(&mut io::stdin(), &mut io::stdout()).unwrap();
}

See tests/ and examples/ for some basic examples and the bf_bf_interpreter subpackage for brainfuck interpreter written in brainfuck.

This is Cargo enabled, and so can be used by adding a [dependencies.brainfuck_macros] section pointing to this git repository to your Cargo.toml. If you wish to also use bf_bf_interpreter, simply add [dependencies.bf_bf_interpreter] section also pointing to this repository.

Specs

Normal brainfuck, with:

  • a tape length of 30000,
  • cells storing unsigned bytes (with wrapping),
  • EOF indicated by returning -1, and
  • out-of-bounds index steps ignored (i.e. < when pointing at the first cell is just ignored, and similarly for > at the last).

About

A brainfuck procedural macro for Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages