PostScriptum

From Esolang
Jump to navigation Jump to search

PostScriptum is an esolang invented by User:None1, it is an esolang which uses English abbrevations for tokens.

Syntax

In the Syntax column, \n represents line feeds.

Tokens are case insensitive.

Token Meaning in English (If you wonder) Syntax What it does
lol laughing out loud lol 1
lmao laughing my ass off lmao 10
P.S. post scriptum (after) P.S.: comment text Single line comment
e.g. exempli gratia (for example) (e.g.: x,y,z,...) Sum up all the values and return the sum
Q.E.D. quod erat demonstrandum (used at end of math proofs) Q.E.D or Q.E.D return value Return (halt if not in a function)
wtf what the fuck (swear word) wtf condition\nCODE\nthx or wtf condition\nCODE1\nbtw\nCODE2\nthx If
btw by the way wtf condition\nCODE1\nbtw\nCODE2\nthx Else
thx thanks thx End if statements or while loops or function definitions
ASAP as soon as possible ASAP x or ASAP "STRING" Print a value or a string followed by nothing, escape sequences \n and \t are allowed
i.e. id est (that is) a (i.e.: b) Variable assignment, make a's value the same as b's value
a.k.a also known as a, a.k.a. b Reference assignment, make a a reference to b
AFAIK as far as i know AFAIK, library name Import library, may be implementation dependent
OMG oh my god OMG condition\nCODE\nthx While loop
\w with \w function name arg1 arg2 ...)\nCODE\nthx Function definition (can't be nested, arguments are passed as references)
pls please pls variable name create a variable with initial value 0, variables cannot be assigned if not created

Note: PostScriptum has only one type, int (or two if reference counts), As such, conditions use integers as well, nonzero is truthy and vice versa.

Standard library

Libraries may be implementation dependent, but User:None1 plans to add these functions in the standard library in the coming implementation.

Math

opposite x: Opposite number
mul x y: Multipication
div x y: Floor division
mod x y: Division
pow x y: Power
powmod x y m: Power mod m
fact x: Factorial

Comp

eq x y: Return 1 if x==y, else 0
neq x y: Return 1 if x!=y, else 0
lt x y: Return 1 if x<y, else 0
ge x y: Return 1 if x>=y, else 0
le x y: Return 1 if x<=y, else 0
gt x y: Return 1 if x>y, else 0

Rand

rand: Return random number from 0 to 2147483647 inclusive

IO

read x: Read x as integer, returns nothing, EOF results in 0
readascii x: Read x as ASCII (or Unicode), returns nothing, EOF results in 0
printascii x: Print x as ASCII

Examples

Since this is unimplemented, these programs are untested.

Hello, World!

ASAP "Hello, World!"

Cat program but accepts numbers only

AFAIK, IO
pls x
read x
ASAP x

Cat program

AFAIK, IO
pls x
OMG x
 readascii x
 printascii x
thx

Truth Machine

AFAIK, IO
pls x
read x
wtf x
 OMG lol
  ASAP lol
 thx
btw
 ASAP (e.g.:) P.S.: Yes, e.g.'s argument list can be empty
thx

Fibonacci (recursion)

AFAIK, Comp
AFAIK, Math
\w fib x
 wtf eq x lol
  Q.E.D. lol
 wtf eq x (e.g.:lol,lol)
  Q.E.D. x
 Q.E.D. (e.g.: fib (e.g.:x,opposite lol), fib (e.g.:x,opposite (e.g.: lol lol)))
thx
ASAP fib (e.g.:lmao,lol) P.S.: prints 144 (F_11)

A+B

AFAIK, IO
pls a
pls b
read a
read b
ASAP (e.g.:a,b)

Reference example

pls x
pls y
pls z
y (i.e.: x)
z, a.k.a x
x (i.e.: lol)
ASAP y P.S. 0
ASAP z P.S. 1

This program creates a variable x, copies value of x to y, and then creates a reference z to x. Then, x becomes 1, since the value of variable x does not affect the value of variable y, y remains 0, but since z is a reference, z becomes 1 as well.