Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

dduan/BrainAss

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainfuck to WebAssembly compiler

This is a Brainfuck to WebAssembly compiler.

To use it, you'll need a recent GHC and wat2wasm installed in your environment.

Run make compile-compiler (or ghc brainass.hs) to compile the compiler.

Run ./brainass (or whatever you compiled brainass.hs to) to read how to use the compiler. It should print the following.

Usage: compile IMPORTED_INPUT IMPORTED_OUTPUT EXPORT
where
  IMPORTED_INPUT  is imported Javascript function for Brainfuck's ,
  IMPORTED_OUTPUT is imported Javascript function for Brainfuck's .
  EXPORT is the exported Javascript function from the WASM module

Brainfuck source is read fro STDIN and text wasm is written to STDOUT
(similar to `cat`)

Example:
  cat source.bf > compile bf.getchar bf.putchar bf > main.wat
  makes wasm module import bf.getchar as "," and bf.putchar as "."
  and the wasm module exports a function named bf.

Running make build-and-run-helloworld will:

  1. build the compiler in local directory as ./compile.
  2. compile a hello world program in Brainfuck to main.wasm
  3. launch a server at http://localhost:8000/play.html which runs the wasm program

You can read this make command, as well as play.{js,html} to learn how to use the compiler as well.

About

A Brainfuck to WebAssembly compiler written in Haskell

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.