npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-brainfuck-interpreter

v1.0.0

Published

File based brainfuck interpreter

Downloads

3

Readme

References

Promise-File-Based Brainfuck Interpreter/Compiler!

Easily compile brainfuck code right inside your machine This compiler was written in Javascript to fit Node Standards MIT License in effect

Setting up

Install

For now, we're only available on NPM

npm install node-bfi

Usage

Let's write a simple brainfuck program to print "Hi"
Brainfuck manipulates memory directly, and so, uses ASCII to display letters.
Capital H: 72
Lowercase i: 105
Now we are tasked with figuring out how to get numbers this high without having a long string of pluses, and also

Accepted Characters and Their Operations

In brainfuck, you use pointers to select which memory slot to manipulate. These are:

>

For moving forward

<

For moving backward

.

To Log

,

To accept input

+

For adding 1 to the current memory slot

-

For removing 1 from the current memory slot

[

To initialise a loop
And finally

]

To close a loop.

Doesn't seem too complicated, right?

Wrong.
Anyway, back to writing 'Hi'
Here, We can use the brainfuck code:

Brainfuck Code

* = When pasting this, do not include these. When pasting this, remove this comment too.
You can paste everything except for this comment, the one before, and everything with a star

>++++++++++ Ok. So here we are adding 10 to the first memory slot 

Now anything between those to greater than and less than signs is what we 

will be multiplying 10 by

[-><] * 

Lets add 7 

for 70

[->*******<]> *

Wait, but now we only have 70 and we need 72! No biggie

lets add another 2

[->*******<]>++ *

Nice now we have 72

But wait; we arent logging this stuff!

No biggie again all we need to do is add a period to the end of that

[->*******<]>**.

Great! Now he have a capital H

Now for the lowercase i

remember that i was 105

lets multiply by 15

>+++++++++++++++

Great now for the loop

We can multiple by 7

[->+++++++<]>.

Thats it! Really. *

Awesome, now we have the brainfuck code. Let's put it in a file named 'hi.bf'It also must be in a directory called 'bf'Now Let's write this simple javascript program

Javascript code

const bfi = require('node-bfi')
bfi('hi.bf').then(console.log) //Output: Hi

Remember, this is promise based.