GithubHelp home page GithubHelp logo

melchor629 / brainfuck-in-rust Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 11 KB

Brainfuck interpreter and transpiler - for fun

License: MIT License

Rust 100.00%
brainfuck brainfuck-interpreter brainfuck-transpiler rust

brainfuck-in-rust's Introduction

brainfuck in rust

Welcome ๐Ÿ‘‹, welcome to this implementation of a Brainfuck interpreter and transpiler. It is a simple implementation that runs all the instructions of the language plus an extra ; for debugging purposes (behind with-debug feature).

This repo presents the interpreter and transpiler as a Rust library to be used in any project - why someone would want to use it anyway? why did I made this?? It also includes two binaries: one to run the interpreter over a file, the other to transpile to the supported languages.

Interpreter does not apply any optimizations, except the end to start loop jump. It could contain a fold optimization for +, -, > and <, but this would not be funny.

Transpiler can only transpile to C currently. The output can be then compiled with your favourite compiler, and the desired optimizations, and it will fly.

It also contains a parser (tokenizer) which converts known tokens into CodeTokens and discards the rest of tokens. Because the language is so simple, it does not contain an AST. But probably with one, loops/ifs would be easier to optimize in the interpreter.

There is another... Another feature that allows this library to run in no_std environments. The only dependencies are with core and alloc.

Have fun :)

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.