Skip to content

Instantly share code, notes, and snippets.

@chunkybanana
Last active October 21, 2021 05:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chunkybanana/f3a5039b1b133e48261282e43bdab83e to your computer and use it in GitHub Desktop.
Save chunkybanana/f3a5039b1b133e48261282e43bdab83e to your computer and use it in GitHub Desktop.

Redwolf

Redwolf is a stack-based esoteric language where each command is the sequence of letters REDWOLF with some letters repeated. Each repeated letter has a different meaning, depending on how many there are.

It has two datatypes: Lists & Integers.

R - Control flow

  • 2 - Goto - pop a number from a stack and go to that (0-indexed) line
  • 3 - Conditional Goto - pop a value from the stack. If truthy, pop another number and go to that (0-indexed) line.

E - Arithmetic

All of these vectorise.

  • 2 - (2) Addition
  • 3 - (2) Subtraction
  • 4 - (2) Multiplication
  • 5 - (2) (Floor) Division
  • 6 - (2) Exponentiation
  • 7 - (2) Bitwise Or
  • 8 - (2) Bitwise And
  • 9 - (2) Bitwise Xor

D - Stack manipulation

  • 2 - Duplicate
  • 3 - Pop
  • 4 - Swap
  • 5 - Rotate stack left
  • 6 - Rotate stack right
  • 7 - Iterate - push all items onto stack
  • 8 - Wrap - push stack
  • 9 - Reverse stack

W - Input / Output

  • 2 - (0) Take one input
  • 3 - (0) Take the list of inputs
  • 4 - (1) Output plain
  • 5 - (1) Output as string / char with newline
  • 6 - (1) Output as string / char without newline

O - Miscellaneous

  • 2 - (1) Transpose a list / Factorial a number
  • 3 - (1) Sum a list / Create range 1...n
  • 4 - (1) Flatten a list / Turn a number into a list of digits
  • 5 - (1) Reverse a list / Wrap a number into a list

L - Mathematics

All vectorise

  • 2 - (1) Cosine
  • 3 - (1) Sine
  • 4 - (1) Natural logarithm
  • 5 - (1) Base 10 logarithm
  • 6 - (0) Pi
  • 7 - (0) E

F - Miscellaneous part 2

  • 2 - Sort (overloaded to digits)

Numbers are pushed by appending the number encoded in binary with ! and 1 to a command - this will be pushed before the command is executed, so REEEEEEDWOLF1! squares a number.

A command may contain multiple instructions, for example REEEDDDWOOLF. This executes all instructions sequentiially i.e. EEE, then DDD, and finally OO.

Appending . to a command halts the program once that instruction is complete. Halting is unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment