ALAGUF

From Esolang
Jump to navigation Jump to search

ALAGUF is a language made by User:iconmaster.

It is an acronym for At Last, A Greatly Useful Funge.

It is a fungeoid that is designed to be easy to be powerful and yet amazinly twisty.

Syntax

The program starts at the last '0' it finds in the program, going Right. It uses stacks to save data. There is also a StackStack, which is used to contain multiple stacks (the StackStack is actually a list of stacks, btw). There are two data types: Numbers and Strings. It skips any spaces or letters. The possible commands are as follows:

<  Go Left.
>  Go Right.
^  Go Up.
v  Go Down.
'  Anything between two ' characters are pushed onto the stack as a number.
"  Anything between two " characters are pushed onto the stack as a string.
+  Basic Stack Commands:
  →  Increment the stack's top value.
  ←  Decrement the stack's top value.
  ↑  Pushes 0 onto the stack.
  ↓  Pops the top value off the stack.
-  Basic stack mods:
  →  Rotate the stack once to the left.
  ←  Rotate the stack once to the right.
  ↑  copy the top value on the stack.
  ↓  clear all values on the stack.
*  Math:
  →  Subtracts the two top values and pushes it onto the stack.
  ←  Adds the two top values and pushes it onto the stack.
  ↑  Multiplies the two top values and pushes it onto the stack.
  ↓  Divides the two top values and pushes it onto the stack.
(  starts a loop.
)  loops back if the top value is not 0.
!  ends the program.
=  Boolean commands:
  →  pops the two top values and pushes 1 if they are equal, or 0 if they are not.
  ←  pops the two top values and pushes 0 if they are equal, or 1 if they are not.
  ↑  pops the two top values and pushes 1 if the first is less than the second, or 0 if they are not.
  ↓  pops the two top values and pushes 1 if the first is greater than the second, or 0 if they are not.
&  StackStack Commands:
  →  Delete the current stack in the StackStack.
  ←  Insert a blank stack below the current stack in the StackStack.
  ↑  Move up one in the StackStack.
  ↓  Move down one in the StackStack.
@  Output Setup:
  →  Decrements the x display pointer.
  ←  Increments the x display pointer.
  ↑  Decrements the y display pointer.
  ↓  Increments the y display pointer.
#  I/0:
  →  Pushes the character pointed to by the display pointer on the screen.
  ←  Pops the top value off the stack and displays it at the place pointed to by the Display Pointer.
  ↑  Pushes the current key pressed. Returns 0 if no key is pressed.
  ↓  Asks the user for a string, and pushes the user's input.
$  Bridge.
%  Logic:
  →  Pops two values, performs boolean AND on them, and pushes the result.
  ←  Pops two values, performs boolean OR on them, and pushes the result.
  ↑  Pops two values, performs boolean XOR on them, and pushes the result.
  ↓  performs boolean NOT on the top value of the stack.
?  More Math:
  →  Pops two values, divides them, and pushes the remainder.
  ←  Substring.
  ↑  Pops two values, does an exponant on them, and pushes the result.
  ↓  Negates the top value on the stack.
/  rotates clockwise.
\  rotates counter-clockwise.
_  goes up if the top value is 0, goes down otherwise.
|  goes Left if the top value is 0, goes Right otherwise.
`  Files (well, mostly):
  →  Sets the top value to either a string or a number, depending on the var's type.
  ←  Saves a file. The top value is the file's name, the second is the value to be stored.
  ↑  Loads a file. The top value is the file's name.
  ↓  Pushes a 1 if the file specified by the top value exists, 0 otherwise.
1  Pushing:
  →  Changes the top value between an ASCII character and its number.
  ←  Pushes the size of the stack.
  ↑  Pushes the number of stacks in the StackStack.
  ↓  Push your currnet position.
2  Misc screen ops:
  →  Pushes the x display pointer.
  ←  Pushes the y diaplay pointer.
  ↑  Pops a value, and sets the x display pointer to it.
  ↓  Pops a value, and sets the y display pointer to it.
3  More StackStack Ops:
  →  Move the current stack down one in the stackstack.
  ←  Move the current stack up one in the stackstack.
  ↑  Pops the top value and pushes it onto the stack above it in the StackStack.
  ↓ Pops the top value and pushes it onto the stack below it in the StackStack.
4  Misc:
  →  Pops a value and pushes a 1 if the value is a string, 0 otherwise.
  ←  Pops a value and pushes a 0 if the value is a string, 1 otherwise.
  ↑  Pushes the StackStack pointer (what stack you are using in the StackStack.).
  ↓  Like Inserting a Stack (See & going left), but it copies it.
5  Clears the screen.
6  Waits for a key.
7  Newlines the display.

Note that the commands with four arrows next to them are direction-dependant commands; what they do depends on the direction they are going in.

Examples

99 bottles of beer

       >#" bottles"#v
       -        v'1'<
0'98'(+^        2
                @
   v"no reeb fo"<
   >#'1'v
        2
        @
        >"the wall,"#v
       v      '11' <
       5v> #" bottles"#v
      > v               
      22                
      ^<          v'1' <
         -              
        >^        2
                  @
       v" reeb fo"<
       >#'1'v      >v
            2      22
            >'11'^>5v
           v"ekat uoy"<
           >#'1'v
                2
                @
                >"pass it"#v
                       v'1'<
                       2
                       @
             v",dnuora"<
             >#'11'5v>v>v
                      22 - 
                      >^>^ 
                      v  +<
                      >#v
             v"selttob "<
             >#'1'v
                  2
                  @
                  >  v
       v"no reeb fo"+<
       >#'1'v
            2
            @
            >"the wall!"#'11'v
       v            <v         <
       >5v          22
       v+<          ^<
       >)!

Hello World

"Hello, world!"#!

Cat

 >v   
 +    
0^>#6v
  ^ 1<

Factorial calculator

v)+<0 v  
   -  #  
   ^(`<  
>(v>1 v  
  +*v+<  
  >^>)v  
      >#!

Fibonacci number generator (UNTESTED!)

         >v      
  >#7#7v -       
  -    >>^       
  -   v<^       <
  ^  < -         
0 '1'^ ^--<      
      >-+&v  >#7^
          3  -   
          >-v&   
            &3   
            >^   

Resources

The author has made an interpreter for the TI-89, but has not uploaded it yet.