Skip to content

spezifant/brainfuck-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

brainfuck-js

A simple Brainfuck implementation in JavaScript.

Example run

Using e.g. Node.js as interpreter you can run it with:

> node brainfuck.js "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."
Hello World!

Implementation details

In theory the memory used for Brainfuck programs are and infinite band of memory. This implementation has a fixed length of MEMORY_SIZE cells and has borders. Before the input code is interpreted a pre-caluclation step will look for matching brackets and store it inside a lookup table to speed up the runtime. At this point of time the code does not do any kind of error checks. Invalid code like ] will lead to undefined behaviour.

About

Brainfuck interpreter written in JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages