Another Pi Language

This is an implementation of Another Pi Language by Lode Vandevenne.

The source code of the language exists out of two integers of any size. The first integer indicates the index of the bit of Pi from where we start reading bytes. A value of 0 indicates the program starts being read at the very first bit of Pi that is 1, the most significant one that makes up the "3" before the point. The second integer indicates the amount of bits read. When reading bytes, it should be a multiple of 8.

Starting at the bit of Pi indicated by the first integer of the source code, you start reading the bits in groups of 8 as bytes, or as bits if the chosen source type requires it. Every earlier bit is a more significant bit of bytes. The amount of bits read is the amount given by the second integer.

The bytes read out of Pi, are then interpreted as a single source file of any language (which can also be Another Pi Language). Including third party libraries is possible as long as the device that reads this source code knows where they are installed. Which language the source is in, can be given as extra information together with the two integers.

One question is: does the source code you want to use, appear somewhere in the bits of Pi?

Try it

This implementation is based on the BBP formula, which lets you extract any digit of pi without extracting the others. In this case, the formula have a precision of 48 bits, so it runs for every 48 bits extracted. Of course, the more groups of 48 bits you extract and the deeper you get into pi, the slower this program will get. To make things faster (but not shorter), this program allows for multiple (index, length) tuples, combines the list of bits together and pads the end of the program with 0's to make a full byte.

Download node.js script (takes input in stdin, outputs in stdout)

Input
Output