From Esolang
Jump to navigation Jump to search

WARP is an object and stack based language, created by User:Aldous zodiac (talk) in May 2013. All numerics are signed, integral and expressed in hexatridecimal (base 36) notation, unless the radix system is changed within an executing program. WARP is a (weak) recursive acronym, WARP And Run Program - so called because it is expected that interpreters randomize the source program after each command is executed.

Objects and expressions

Basic pseudo grammatical terms:

  • <object> ::= [a-z]{2}
  • <sobject> ::= <object> | !
  • <base-expr> ::= -{0,1}[0-9,A-Z]+ | <object> | "...." | ~ | `
  • <expr> ::= <base-expr> | ! | _
  • <label> ::= [a-z]+ | .


A few general purpose operators exist.

Command Description
=<object><expr> assign <expr> to <object>
><sobject><expr> increment <sobject> by <expr> and update <sobject>. If <expr> is non numeric, convert if possible, otherwise treat as

0. If <sobject> is the pop command, use the stack as the source object and push the result onto the stack

<<sobject><expr> Decrement <sobject> by <expr> and update <sobject>. If <expr> is non numeric, convert if possible, otherwise treat as


$<sobject><expr> Divide <sobject> by <expr> and update <sobject>. If <expr> is non numeric, convert if possible, or if 0, treat it as


&<sobject><expr> Multiply <sobject> by <expr> and update <sobject>. If <expr> is non numeric, convert if possible, otherwise treat as


# <sobject><expr> Calculate <sobject> mod <expr> and update <sobject>.
:<expr>:<expr> Compare the first <expr> with the second <expr>. Push the result of the comparison onto the stack.

0 means equal, -1 is less than, 1 greater than

?<expr>?<command> Pop from the stack, and if that object equals <expr>, execute <command>.
+<number> Change the radix of numbers to <number> from now on

Stack manipulation

There are several commands for stack manipulation.

Command Description
%<object> treat <object> as the stack; takes string of content and push each atomic object onto the stack - pushed so that repeated popping and

sending to output is the same object as 'treated'

| untreat the current stack
! pop
*<base-expr> push <base-expr>
]<base-expr> Pop and push <base-expr>
\ Turn off auto stacking mode
; Duplicate the top of stack
' Rotate the top two stacks in the stack of stacks
{<base-expr> Retrieve the object at index <base-expr> from the random access stack and push onto the current stack
}<base-expr> Place an object popped from the current stack at index <base-expr> in the random access stack

Labels and movement

WARP supports a simple label/jump set of commands.

Command Description
@<label> Declare a named label
^<expr><<label>< If <expr> == ., move to label unconditionally. If <expr> is zero or false, or represents an empty object, fall through

Input and output

WARP can interact with any existing input and output mechanisms.

Command Description
(<expr> Output <expr> as a character
)<expr> Output <expr> in its native form
,l Accept a line of user input and place onto the stack
,c Accept a character of user input and place onto the stack
_ a symbolic reference to the current stack

Source access

Access to the source is provided as well as the current traversal map.

Command Description
~ The current randomized source
` The current traversal map of the randomized source

Environment and execution

First, the run time environment.


WARP has initially one, unbound or system, stack. Using the % operator, a bound object can usurp the unbound stack, until the | operator removes it. Think of it is as being similar to a stack of stacks. Issuing a | operator against the unbound stack will mean that the environment enters 'stackless' mode. All further stack based operations will not operate as expected, nor generate an error. There is no formal limit to the size and number of stacks and similarly in relation to source code.

In addition, the WARP environment has a single random access stack, manipulated with the { and } operators.

Note that all WARP objects are shared across the stack of stacks; if an assignment to an object xx occurs, and then a new stack is created, the value of xx will be available in the new stack context.

Compliant interpreters will auto create objects on demand, initialized to zero.


Each source advance generates a random rewrite of the source, along with an attendant 'unscramble' map. Could be used for amusing output effects.


Hello World

)"Hello World!"

Hello World #2

=aa"Hello World!"%aa@x(!^_x| 



99 bottles of beer

*"No more bottles of beer on the wall"+A=nb99@f=pl" ":nb:1?1?=pl"s" )nb)" bottle")pl)" of beer on the wall, ")nb)" bottle")pl
)" of beer")", Take one down, and pass it around"(13(10<nb1^nbf)!


*1=na1=li1Z@z;)!)" ">!na;<!na=na!<li1^liz

Collatz conjecture #1 (objects)

=se24E0)"Hailstone sequence for ")se@a)se=rese$re2=inre&in2:in:se?-1?^.o=sere^.r@o&se3>se1@r:se:1?1?^.a

Collatz conjecture #2 (stack and objects)

=se24E0)"Hailstone sequence for ")se@a)se*se$!2;&!2:!:se?-1?^.o=se!^.r@o!&se3>se1@r:se:1?1?^.a

Primes less than some user entered value

+A)"Enter start: ",l=cu!)"Primes <= ")cu)"\n":cu:2?-1?^.e@o*cu$!2=ca!@i*cu#!ca?0?^.n<ca1:ca:1?1?^.i)cu)" "@n<cu1*cu<!1^!o@e

Simple calculator (in decimal)

+A)"WARP simple calculator: Enter q (as operator) to quit, c (as operator) to clear "(13(10
=ac0@l)"Enter operator: ",l=op!:op:"q"?0?^.e:op:"c"?0?^.c
)"Enter operand: ",l=nu!:op:"+"?0?>acnu:op:"-"?0?<acnu:op:"*"?0?&acnu:op:"/"?0?$acnu

Reverse a user entered string

)"Enter a string to reverse: ",l=st!%st@r=ch!'*ch'^_r'@p)!^_p|

Brainfuck interpreter


External resources