PEWWWWW

From Esolang
Jump to navigation Jump to search

Note: This is a work in progress. Some things may not be fully finished. You can find the original spec here.

PEWWWWW is an esolang created by User:Emerald. This specification was written by User:Monochromeninja. The language uses a single stack that only contains integers.

Instructions

An instruction of PEWWWWW is written like so:

/== (statement>
|condition

Statements

Statements can be one of the following:

  • load n

Pushes n to the stack.

  • shoot

Prints the top of stack.

  • search n

Moves the n'th item from the top of the stack to the top. (1-based)

  • reload n

Jump to the n'th instruction from the top of the program. (1-based)

  • add

Pops a then b, then pushes a+b.

  • sub

Pops a then b, then pushes a-b.

  • mul

Pops a then b, then pushes a*b.

  • div

Pops a then b, then pushes a//b. (Floor division -- divide and round down)

  • mod

Pops a then b, then pushes a%b.

Statements can be separated using )s.

Conditions

Conditions can use the following operators:

== (equal to)
>> (greater than)
<< (less than)
>= (greater or equal to)
<= (less or equal to)
! (logical NOT)

Literals

Valid literals are:

  • Integers (themselves)
  • tru (Boolean TRUE)
  • fal (Boolean FALSE)
  • Strings (use double-quotes)
  • Escape character: \
  • Newline: \p
  • top (Top of stack)
  • get (Returns a single ASCII code from STDIN)
  • toint s (Returns s converted to an integer)
  • tostr i (Returns i converted to a string)

Compressed mode

This allows you to write smaller (albeit less readable) programs. Simply separate your statements with ;s and use this instead of the standard ASCII art gun:

condition/==statement

These can be interspersed with noncompressed statements as well.

"Extras"

These are extra stacks that can be used as variables. Declare them using the following syntax:

extra var
|value|
|value|
<etc.>

To evaluate a statement inside a stack value, simply surround it with angle brackets like so: |<get>|. Loading an extra will

Other notes

% marks a single line comment
All errors have the same message: "No ammo".