Giter Club home page Giter Club logo

brainf-ck.rs's Introduction

Yet another Brainf*ck in Rust

Creative Commons License Logo

A toy x86 JIT compiler and interpreter for Brainf*ck written in Rust.

This project includes 3 implementations of Brainf*ck, complying the reference by Daniel B. Cristofani.

One is an interpreter (./src/interpreter.rs) in pure Rust. It is used as a reference implementation for more complex other two implementations.

The second one is an x86_64 JIT compiler written using dynasm-rs (a project to write JIT compiler using an assembly syntax). It can be found in (./src/jit/asm.rs).

The last (./src/jit/machine.rs) is also an x86_64 JIT compiler but written without dynasm-rs. That means the file directly contains a piece of machine code.

Memory Protection

One somewhat unique feature of this project is that all three implement memory protection by allocating more memory than a guest's address space to avoid bound checking. They allocate $2^{16} + 1$ bytes of memory for the guest (a Brainf*ck programme), and the pointer size is 16 bit. It doesn't use OS's memory protection facility since recovering from such signals are hard to get it right.

License

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

brainf-ck.rs's People

Contributors

rail-rain 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.