Witeal

From Esolang
Jump to navigation Jump to search

Witeal (pronounced Whittle), is an esoteric programming language similar to brainfuck, in the way of its oversimplicity. It stands for Why is This Eaven a Language. There are 9 identifiers in Witeal.

"<" - decrement cell by one
">" - increment cell by one (max 1000 cells, 0-999)
"+" - adds one to the cell
"-" - subtracts one from the cell
"[" - declares start of loop
"]" - declares end of loop
"&" - return boolean/integer on condition
"/" - use cell
"." - indicate skip in case of error

That's it! All the commands in the entire language right there. Here's a hello world program:

@                        start program
[                        initialize loop
[                        initialize second loop
-                        subtract one from cell
&/].                     loop if cell has anything in it
>].                      increment cell by one, then loop (if cell cannot be incremented, skip past loop)
[                        initialize loop
<].                      decrement cell by one, then loop (if cell cannot be decremented, skip past loop)
++++++++>                add 'H' to cell 0
+++++>                   add 'E' to cell 1
++++++++++++>            add 'L' to cell 2
++++++++++++>            add 'L' to cell 3
+++++++++++++++>         add 'O' to cell 4
[+].                     add ' ' to cell 5
+++++++++++++++++++++++> add 'W' to cell 6
+++++++++++++++>         add 'O' to cell 7
++++++++++++++++++>      add 'R' to cell 8
++++++++++++>            add 'L' to cell 9
++++>                    add 'D' to cell 10
-                        add new line to cell 11
[                        initialize loop
/                        print cell
>                        increment cell
&++++++++++++<].         loop if cell is 0-10 (less than 11)
[                        initialize infinite loop
]                        close infinite loop
_                        declare end of program

but this was written for readability. When writing code, it would be better to write it like this:

@[[-&/].>].[<].++++++++>+++++>++++++++++++>++++++++++++>++++++++++++++>[+].+++++++++++++++++++++++>+++++++++++++++>++++++++++++++++++>++
++++++++++>++++>-[/>&+++++++++++<].[]|

The output:

HELLO WORLD

This is a simple Cat program (accepts input, then repeats as output):

@                        introduce program
[                        initialize loop
[                        initialize second loop
-                        subtract one from cell
&/].                     loop if cell has anything in it
>].                      increment cell by one, then loop (if cell cannot be incremented, skip past loop)
[                        initialize loop
<].                      decrement cell by one, then loop (if cell cannot be decremented, skip past loop)
[                        initialize loop
/                        print empty cell, activating input
&->>].                   if the user did not press enter, increase cell and loop again
+                        if the user did press enter, clear cell
[                        initialize loop
/                        print cell
>                        increment cell
&+<].                    loop again (skip loop if cell is empty)
[                        initialize infinite loop
]                        close infinite loop
_                        declare end of program

or simply (or not so simply):

@[[-&/].>].[<].[/&->>].+[/>&+<].[]_

Here's a program that compares two strings:

@[[-&/].>].[<].++++++++++++++>+>+++++++++++++>+++++>->[/>&+++++<].[/&->>].+[/>&+<].[<].>>>>>&++++++++++++++++_>&++++++++_>&+++++++++_
>&++++++++++++_>+++++++++++++++++++>+>+++++++++++++>+++++>++++++++++++++++++++++++++++++>++++++++>+++++>++++++++++++++++++>+++++<<<<<
<<</>/>/>/>/>/>/>/>/.>++++++++>+++++++++</>/[]_

Its C# equivalent:

using system;
class Program
{
   public static void Main(String[] args)
   {
      Console.Write("NAME\n");
      string name = Console.ReadLine();
      if (name == "PHIL")
         Console.Write("SAME HERE\n");
      Console.Write("HI");
      while(true)
      {
      }
   }
}