Najtingalo (esperanto: nightingale) is a Brainfuck to JavaScript optimising transcompiler.
Converts bf_code
string to function with signature: function bf_code(heap=[] : array, print : (n: number) => any), getInput : () => int) : void
Checks if string is valid Brainfuck code.
Optimises tokensList
with given optimisation level
.
Parses string as Brainfuck Program. No optimisations are done.
>><<+-
compiles to:
pointer += 1;
pointer += 1;
pointer += -1;
pointer += -1;
heap[pointer] = heap[pointer] + 1;
heap[pointer] = heap[pointer] - 1;
return;
>><<+-
compiles to:
return; // No ops
[-]
compiles to:
while(heap[pointer]|0) {
heap[pointer] = (heap[pointer]|0) + -1;
}
[-]
compiles to:
heap[pointer|0] = 0;