- Not to be confused with Kava.
Kawa (pronounced kah-wah) (川) is a symbolic language created by User:Aadenboy inspired by Japanese radicals.
Data
The only data type is the number.
Data can be held on a stack (the "stream") and on a deque (the "boat"). The stream is used for temporary data and calculations like math, while the boat is used for more persistent values.
The stream exists parallel to the instruction pointer, and is fed into whatever command it runs into, as if it were a river.
Bases
Bases are the commands used in the program. There are only nineteen bases (nine when excluding the numerals). On their own, they are basic in functionality and can't do much of anything useful.
Name
|
Glyph
|
Description
|
Radicals
|
Zero - Nine
|
|
Pushes the corresponding digit to the stream.
|
No
|
Nop
|
|
Does nothing.
|
Yes
|
Input
|
|
Takes input from the user, pushing each character's UTF-8 code onto the stream in reverse order.
|
Yes
|
Output
|
|
Pops a value from the stack, writing it as a numeral.
|
Yes
|
If / Else / End
|
|
If - Check if the top value of the stack is equal to zero. If it is, continue as normal; otherwise, jump to the Else command. Else - Jump to the End block. End - No behavior.
|
Yes only for If
|
Jump Back / Forward / End
|
|
Back - Jump execution to the previous command with a flag (or the start if none exists). Forward - Jump execution to the next command with a flag (or the end if none exists). End - Halt execution.
|
No
|
Modifiers
Modifiers are common diacritics used on certain commands to modify their behavior.
Diacritic
|
Meaning
|
|
"With two"
|
|
"Limit"
|
|
"As one"
|
|
"Negate"
|
|
"Sequentially"
|
With Nop
As Nop does nothing on its own, it serves as a "container", with the modifiers acting directly on the values on the stream instead.
If Sequentially is used on an operation that takes one argument, it will do the action for every individual value on the stream.
If Sequentially is used on an operation that takes multiple arguments, it will do the action repeatedly until only one value remains on the stream.
Name
|
Glyph
|
Description
|
Concatenate
|
Nop + With two
|
Pop two values a and b, then push the result of concatenating b to a.
|
Absolute value
|
Nop + Limit
|
Pop one value a, then push the absolute value of a.
|
Boolean-ify
|
Nop + As one
|
Pop one value a, then push the result of clamping it to the range [0, 1].
|
Negate
|
Nop + Negate
|
Pop one value a, then push the result of multiplying a with -1.
|
Modulo
|
Nop + With two + Limit
|
Pop two values a and b, then push the result of a mod b.
|
Add
|
Nop + With two + As one
|
Pop two values a and b, then push the result of a plus b.
|
Split
|
Nop + With two + Negate
|
Pop two values a and b, then push the first or last b digits of a (first if b > 0, otherwise last).
|
First digit
|
Nop + Limit + As one
|
Pop one value a, then push the first digit of a.
|
Round
|
Nop + Limit + Negate
|
Pop one value a, then push the result of rounding a.
|
Sign
|
Nop + As one + Negate
|
Pop one value a, then push the sign of a. The sign of zero is zero.
|
Maximum
|
Nop + With two + Limit + As one
|
Pop two values a and b, then push the bigger of the two.
|
Divide
|
Nop + With two + Limit + Negate
|
Pop two values a and b, then push the result of dividing a by b.
|
Subtract
|
Nop + With two + As one + Negate
|
Pop two values a and b, then push the result of subtracting b from a.
|
Last digit
|
Nop + Limit + As one + Negate
|
Pop one value a, then push the last digit of a.
|
Minimum
|
Nop + With two + Limit + As one + Negate
|
Pop two values a and b, then push the smaller of the two.
|
With Input
Unlike Nop, modifiers are used as parameters for the command. This is true for the rest of the commands.
Parameter
|
Glyph
|
Description
|
With two (No Sequentially)
|
|
If used with Limit, peek an additional value b and enforce the input into the range [a, b].
|
Limit (No Sequentially)
|
|
Peek a single value a, and enforce the input to be no longer (or bigger) than a.
|
Limit + Sequentially
|
|
Peek through the entire stream, and enforce the input to only use the values found in the stream.
|
As one
|
|
Interpret the input as a number instead.
|
Limit + Negate
|
|
Negate the restrictions to allow input that doesn't fit.
|
With Output
Parameter
|
Glyph
|
Description
|
With two (No Sequentially, no As one)
|
|
Pop an additional value b, and use b as the base to output a as.
|
Limit + As one
|
|
Modulo a with 256 before converting to a character (limits within ASCII range).
|
As one
|
|
Output a as its UTF-8 character.
|
Negate
|
|
Does nothing. What would it do, anyways...?
|
Sequentially
|
|
Pop and output every character on the stream.
|
With If
Note: If there aren't enough values in the stream (i.e trying to compare two numbers when there's only one), it will skip directly to the end, even if there is an Else command.
Parameter
|
Glyph
|
Description
|
With two
|
|
Check if the top two values of the stream are equal to each other.
|
Limit
|
|
Compare to be less than instead.
|
Negate
|
|
Reverse the condition.
|
Sequentially (No As one, no With two)
|
|
Check every value in the stream to see if any match the condition (OR).
|
Sequentially + As One (No With two)
|
|
Check every value in the stream to see if they all match the condition (AND).
|
Sequentially + With two ± (and or) As one
|
|
Compare every value below the topmost one against the topmost value.
|
Diacritics
Diacritics are placed either below or above the command. Instead of modifying the command itself, they are ran in sequence, in order of bottom diacritics, command, top diacritics. While not mentioned before, the Sequentially modifier is also a diacritic, and can be placed below other diacritics to make them sequential.
Name
|
Glyph
|
Description
|
Sequentially
|
Sequentially
|
|
Make the next diacritic sequential.
|
No difference.
|
Push top
|
|
Pop a single value from the stream, then push it to the top of the boat.
|
Pop all values from the stream, pushing them to the top of the boat.
|
Push bottom
|
|
Pop a single value from the stream, then push it to the bottom of the boat.
|
Pop all values from the stream, pushing them to the bottom of the boat.
|
Pop top
|
|
Pop a single value from the top of the boat, then push it to the stream.
|
Pop all values from the boat (starting at the top), pushing them to the stream.
|
Pop bottom
|
|
Pop a single value from the bottom of the boat, then push it to the stream.
|
Pop all values from the boat (starting at the bottom), pushing them to the stream.
|
As two/Duplicate
|
|
Duplicate the topmost value.
|
Duplicate the entire stream.
|
Discard
|
|
Pop the topmost value and do nothing with it.
|
Pop the entire stream.
|
Swap
|
|
Pop two values a and b, then push b, then a.
|
Reverse the entire stream.
|
Flag
|
|
Placed at the bottom below all diacritics, used as a reference point for Jump Back and Jump Forward.
|
None; cannot place underneath
|
Example Programs
Interpreter