Babylang

From Esolang
Jump to: navigation, search

The Babylang is a Trivial Brainfuck Substitution created by dodococo. It is just a funny variant of COW inspired by two words the baby says in the movie Babyboss. Babylang has nine instructions and is Turing-complete. Most instructions are variants of gugu and gagas. Other words will result in an error.

Commands

Instruction Description
gugu Moves current memory position back one block.
gaga Moves current memory position forward one block.
unga Resets the current memory block. It replaces any value with 0.
uuug Decrement current memory block value by 1.
aaag Increment current memory block value by 1.
gaaa Take user input and store it in the current memory block
guuu Print the current memory blocks content to the stdout
gagu Marks the beginning of the loop. It considers the current memory block's value as the flag to loop through the code. It keeps looping until that value is zero.
guga Marks the end of the loop. Absence of it after gagu will result in an error.

Sample code

Hello, World!:

  aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gugu gugu gugu gugu gugu gugu gugu gugu gugu gugu guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga guuu gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag guuu


Here is the code required to calculate the sum of two numbers:

 gaaa gaga gaaa gugu gagu uuug gaga aaag gugu guga gaga guuu 

Interpreter

#!/usr/bin/ruby
eval 'm=Hash.new(p=0);'+ARGF.read.downcase.gsub(
       /[a-z][a-z0-9]*|./,
       'gaga' => 'p+=1;',
       'gugu' => 'p-=1;',
       'aaag' => 'm[p]+=1;',
       'uuug' => 'm[p]-=1;',
       'unga' => 'm[p]=0;',
       'guuu' => 'putc m[p];',
       'gaaa' => 'm[p]=STDIN.getbyte if !STDIN.eof;',
       'gagu' => '(',
       'guga' => ')while((m[p]&=255)!=0);')

External resources

[1] contains the basic interpreter in C++.