Skip to content
A edited this page Aug 21, 2019 · 1 revision

This is a glossary of Keg commands.

Command Glossary

If the ^ or : commands tried to operate on an empty stack, an input will be taken (for shorter programs).

Command Description Usage Notes
! Pushes the length of the stack onto the stack !
: Duplicates the last item on the stack :
_ Removes the last item on the stack _
, Prints the last item on the stack as a character ,
. Prints the last item on the stack as an integer .
? Gets input from the user ?
' Left shifts the stack '
" Right shifts the stack "
~ Pushes a random number onto the stack ~ The number will be between 0 and 32767
^ Reverses the stack ^
$ Swaps the top two items on the stack $
# Starts a comment #
| Branches to the next section of a structure B...|...B B is any one bracket type
\ Escapes the next command, and pushes it as a string \<command>
& Gets/sets the register value &
@ Define/call a function @ name ∆n∆ | ...@
+ Pops x and y and pushes y + x <value><value>+
- Pops x and y and pushes y - x <value><value>-
* Pops x and y and pushes y * x <value><value>*
/ Pops x and y and pushes y / x <value><value>/ Divison by zero gives an error
% Pops x and y and pushes y % x <value><value>% Divison by zero gives an error
< Pops x and y and pushes y < x <value><value><
> Pops x and y and pushes y > x <value><value>>
= Pops x and y and pushes y == x <value><value>=
0-9 Pushes the given integer onto the stack <value>
a-z, A-Z Pushes the ascii value of the given character onto the stack <value>

Extended command glossary

These commands are added to Keg in order to make Keg programs shorter. These instructions can be implemented in Keg quite easily. These are NOT part of the official Keg. (From A__)

Command Description Usage Notes&Implementation
ï Replaces the top of stack with all items from top to 0 ï this is under EASCII, of course;
(:|:1-)
; Decrement the top of the stack ; 1-
É Exponentation # Unknown
Š Sine function Š # Unknown
¿ Friendly input ¿ # Unknown