Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@dqn/bigbrain
Advanced tools
[![build status](https://github.com/dqn/bigbrain/workflows/build/badge.svg)](https://github.com/dqn/bigbrain/actions) [![npm version](https://img.shields.io/npm/v/@dqn/bigbrain.svg)](https://www.npmjs.com/package/@dqn/bigbrain)
Readme
High-level programming language that can be compiled to Brainfuck.
$ npm install @dqn/bigbrain
const bigbrain = require('@dqn/bigbrain');
const code = bigbrain.compile('x = input(); putchar(x);');
console.log(code); // >,<[-]>[<+>>+<-]>[-]<<[>>+<+<-]>[<+>-]>.[-]
$ npm install -g @dqn/bigbrain
and
$ bigbrain <source-file-path>
# or
$ bigbrain -c "<source-code>"
x = input() * 2;
for (i = 1; i <= x; ++i) {
if (i % 3 == 0 && i % 5 == 0) {
putchar(102);
putchar(105);
putchar(122);
putchar(122);
putchar(98);
putchar(117);
putchar(122);
putchar(122);
// => fizzbuzz
} else if (i % 3 == 0) {
putchar(102);
putchar(105);
putchar(122);
putchar(122);
// => fizz
} else if (i % 5 == 0) {
putchar(98);
putchar(117);
putchar(122);
putchar(122);
// => buzz
} else {
print(i);
// => (raw number)
}
putchar(10);
// => \n
}
Output:
>>,>++<[>[>+>+<<-]>>[<<+>>-]<<<-]>[-]>[<<+>>-]<<<<[-]>>[<<+>>>+<-]>...
// initialize variable
foo = 10;
bar = 20;
// input returns integer
x = input();
// print value as decimal
print(10); // => 10
// print value as character
putchar(65); // => A
// block is an expression
x = { 12 };
y = {
print(10);
putchar(65);
// if there is no semicolon, the value is returned
20 + 15 + 7
};
print(y); // => 42
The body must be a block.
x = 20;
// if only
if (x > 10) {
print(65);
}
// if-else
if (x > 10) {
print(65);
} else {
print(66);
}
// if-else, if...
if (x > 10) {
print(65);
} else if (x < 10) {
print(66);
} else {
print(67);
}
// if-else is an expression
y = if (x > 10) {
1
} else {
2
};
print(y); // => 1
The body must be a block.
for (i = 0; i < 10; i++) {
print(i % 3);
}
Support for basic operators.
print(1 + +1); // => 2
print(1 + -1); // => 0
print(1 + 2); // => 3
print(4 - 1); // => 3
print(2 * 4); // => 8
print(2 ** 3); // => 8
print(13 / 3); // => 4
print(13 % 3); // => 1
print(2 * (3 + 4)); // => 14
print(!0); // => 1
print(1 == 2); // => 0
print(1 != 2); // => 1
print(1 < 2); // => 1
print(1 > 2); // => 0
print(1 <= 1); // => 1
print(1 >= 1); // => 1
print(1 && 0); // => 0
print(1 || 0); // => 1
x = 5;
print(++x); // => 6
print(x++); // => 6
print(x--); // => 7
print(--x); // => 5
MIT
FAQs
[![build status](https://github.com/dqn/bigbrain/workflows/build/badge.svg)](https://github.com/dqn/bigbrain/actions) [![npm version](https://img.shields.io/npm/v/@dqn/bigbrain.svg)](https://www.npmjs.com/package/@dqn/bigbrain)
We found that @dqn/bigbrain demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).