Another Pi Language

From Esolang
Jump to: navigation, search

Another Pi Language is an esoteric programming language that is based on the bits of Pi. It was designed by Lode Vandevenne in november 2006

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?

Example programs

(228482784, 16)
  • The following pair encodes the 24 bits 001 110 101 010 111 000 011 111, which represents the brainfunct cat program >,.<@/+@, assuming the eight symbols /><+-.,@ are numbered, in this order, from 000 to 111.
(1749860204, 24)