Skip to content

Instantly share code, notes, and snippets.

@lyxal
Created August 21, 2019 01:10
Show Gist options
  • Save lyxal/5ace2edb98e2901d0bb1b6959d82bb2f to your computer and use it in GitHub Desktop.
Save lyxal/5ace2edb98e2901d0bb1b6959d82bb2f to your computer and use it in GitHub Desktop.
import sys
#import Parse, random
import math
#All built-in functions
LENGTH = "!"
DUPLICATE = ":"
POP = "_"
PRINT_CHR = ","
PRINT_INT = "."
INPUT = "?"
L_SHIFT = '"'
R_SHIFT = "'"
RANDOM = "~"
REVERSE = "^"
SWAP = "$"
DESCRIPTIONS = {
LENGTH: "Push the length of the stack",
DUPLICATE: "Duplicate the top of stack",
POP: "Pop the top of stack",
PRINT_CHR: "Print the top of stack, calling ord(top)",
PRINT_INT: "Print the top of stack, as is",
INPUT: "Get input from user",
L_SHIFT: "Left shift stack",
R_SHIFT: "Right shift stack",
RANDOM: "Push a random number between -inf and inf",
REVERSE: "Reverse the stack",
SWAP: "Swap the top two items on stack"
}
#Unofficial built-in functions
#Note: Most of these are from Btup/A__/User:A, so go check out their
#repos/esolang account/code golf userpage and upvote their answers
IOTA = "ï"
DECREMENT = ";"
SINE = "Š"
DESCRIPTIONS[IOTA] = "Replaces the top of stack with all items from [top->0]"
DESCRIPTIONS[DECREMENT] = "Decrement the top of stack"
DESCRIPTIONS[SINE] = "sin(top)"
#'Keywords'
COMMENT = "#"
BRANCH = "|"
ESCAPE = "\\"
REGISTER = "&"
ECOM_STRING = "`"
FUNCTION = "@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment