Skip to content

Commands

Sumant Bhaskaruni edited this page Jul 1, 2017 · 11 revisions

The items popped are listed in the order they are popped.

  • x, y, z stand for any kind of value (unless the operation is not suitable for it).
  • num stands for any kind of number (integer or float).
  • int stands for an integer.
  • float stands for a float.
  • str stands for a string.
  • char stands for a string of length 1.
Command Items popped Description
+ num1, num2
str1, str2
push num1 + num2
push the concatenation of str1 and str2
- num1, num2 push num1 - num2
× num1, num2
str, int
push num1 * num2
push str repeated int times.
÷ num1, num2 push num1 / num2
% num1, num2
str, x
push num1 % num2
push str formatted with x (using Python's % formatting)
* num1, num2 push num1 ^ num2
num push the square root of num
x print x
x do nothing
¬ x push the negation of x (logical NOT)
x, y push x and y (logical AND)
x, y push x or y (logical OR)
i x convert x to an integer and push it
f x convert x to a float and push it
s x convert x to a string and push it
c int convert int to its ASCII character and push it
o char convert char to its ASCII number and push it
str, int push str[int:]
str, int push str[:int]
str, int push str[::int]
& int1, int2 push int & int (bitwise AND)
| int1, int2 push int | int (bitwise OR)
^ int1, int2 push int ^ int (bitwise XOR)
~ int push ~ int (bitwise NOT)
« int1, int2 push int1 << int2 (bit left shift)
» int1, int2 push int1 >> int2 (bit right shift)
: x push x twice
< x, y push x < y
> x, y push x > y
= x, y push x == y
x, y push x <= y
x, y push x >= y
x, y push x and push y
reverse the stack
# whole stack sums the elements of the stacl
Clone this wiki locally