Secretary

From Esolang
Jump to navigation Jump to search

Secretary is an esoteric programing language created by user User:Wingpad in 2013. It was designed to be run by a secretary at their desk. Its premise is that a secretary is reading your program as an instruction book. In addition, it can conveniently be interpreted by a computer. It features multiple programming models including an array of memory cells, push-down automata and support for primitive function calls. It is Turing-complete since it can interpret Brainf**k.

Humor

If an instruction is given in ALL CAPS, there is a 50% chance the secretary will be offended and ignore it completely. It will not, however, ignore bookmarks given in all caps.

Sample Programs

A cat program which stops at 0

open book
take from incoming
bookmark loop
toss into outgoing
take from incoming
if nonzero then turn to loop
close book

A Hello, World! program that dumps the string onto the stack

open book
remark Toss the starting zero onto the pile
toss onto pile
remark Toss Hello, World! onto the stack
make 10
toss onto pile
make '!'
toss onto pile
make 'd'
toss onto pile
make 'l'
toss onto pile
make 'r'
toss onto pile
make 'o'
toss onto pile
make 'w'
toss onto pile
make ' '
toss onto pile
make ','
toss onto pile
make 'o'
toss onto pile
make 'l'
toss onto pile
make 'l'
toss onto pile
make 'e'
toss onto pile
make 'H'
toss onto pile
take off pile
remark Here is where the program starts
bookmark start
remark Toss whatever is in your hand onto the outgoing
toss onto outgoing
remark And take the next character off the string
take off pile
remark If the character is not zero, loop back to the start bookmark
if nonzero then turn to start
close book

A primitive function call example (will print 30\n)

open book
make 10
toss onto pile
make 20
toss onto pile
call add
take off pile
toss into outgoing as int
make 10
toss into outgoing
close book

remark Adds the two numbers on top of the pile (lpile)
remark Destroys Immed and cannot handle negatives
bookmark add
take off lpile
toss onto rpile
bookmark addLoop
take off lpile
subtract
toss onto lpile
take off rpile
add
toss onto rpile
copy from lpile
if nonzero then turn to addLoop
take off rpile
toss onto lpile
hang up

External resources