Iag

From Esolang

Jump to: navigation, search

iag is an esoteric programming language with only three commands. It was invented by Panu Kalliokoski.

Contents

[edit] Memory

iag supplies an unbounded number of memory cells initialized to zero. Each cell holds a 32-bit signed integer. There is also an accelerator register, which holds a 32-bit signed integer as well.

[edit] Commands

< Move memory pointer to the left
= Subtract contents of this memory cell from accelerator,
  storing the result in both this memory cell and the accelerator,
  then move memory pointer to the right
| If accelerator is
    5, quit
    4, call time() and save the result in active memory cell
    3, read a character from stdin to active memory cell (EOF = 0)
    2, print a character to stdout from active memory cell
    1, do nothing
    0, jump past the next | and set accelerator to 1
   -n, return to the instruction after the | you were at n jumps ago

Panu's interpreter also offers the following, presumably not part of the language proper:

d Dump memory cells for debugging
s Dump stack
x End the program

[edit] Examples

|| === =<=< <<<=== =<=< <=
==== |<|<|<|<|<|<|<|
ds

Reads eight characters of input, storing them in reverse order in the first eight memory cells.

= || ==<<==== =<=< <= =<=< <<<<<=<==== |
<= <<= <<== <<= <<== <<= |

Prints all characters 0 to 256 (starting with 1) endlessly.

[edit] External resources

Personal tools