Pada
Pada is the Croatian word for falling, according to Google Translate. Pada was created by User:revcompgeek on July 27, 2009.
Overview
The main construct that Pada uses is a 3 level switch design something like this:
/ / / / / / / 0 0 0 0 0 0 0 0
Each of the "/" characters corresponds to a switch that can point either to the left or the right (and initially points to the left). Commands start at the top switch and fall down to the switch on the side of the one they land on until they are executed. Each of the "0" characters is a bit that corresponds to a bit stack.
Commands
Switch Manipulation
The "." command will flip the direction of the switch it lands on. In order to manipulate the lower levels of switches, the "O" and "o" commands are used. The "o" command moves in the direction of the switch it lands on and then becomes a ".". The "O" command does the same thing but become a "o" instead. "Q" and "q" are the same but they flip the switch they touch before falling down to the lower level. Example:
o / . / / / / / / \ / / / / / / / / / / / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
O - Become o o - Become . . - Flip switch landed on Q - Flip and become q q - Flip and become .
Bit Manipulation
All of these commands operate on the bit that they eventually fall on.
1 - Set the bit to 1 0 - Set the bit to 0 ~ - Flip the bit v - Push the bit onto its bit stack ^ - Pop the bit from its bit stack
IO
These read/write the byte starting from the bit it lands on, wrapping around
w - Sends the byte to stdout r - Reads one byte from stdin
Control flow
# - prevent bit from changing until it gets another # (popping throws away one bit from the top of the stack) ? - if bit is true skip the next command * - jump: read a signed byte like w and jump in that direction
Examples
Hello, World!
O~.~.OwoO~Q~.OwoO~.O~qwwo~O~owO~o~O~oOw.~O~.w~.~O~Q~OwQ~.~O~wQ~q~OwO~.O~qwQ~.wO~oOw~O~Qw
~.O~Ow~q~Owo~O~Oww~Q~qwo~q~O~wQ~q~w~q~q~Q~Ow~Q~Q~wo~q~w.~q~w.~.wO~qw
External resources
- Interpreter in Ruby by Martin Ender