School

From Esolang
Jump to navigation Jump to search

School is an esoteric programming language developed by User:AceKiron, it started development on June 15th 2021. It's designed to be hard to understand why, just like school.

The interpreter is written in Python and still in development, you can download the interpreter from my github repository[1] though.

Functionality (legacy)

Both newlines and "&" characters are considered command separators. It'll run until it finds an exit command.

Syntax

Command Description
$: Reverses the stack, important for tasks like printing.
$~ Pops the last item on the stack.
$$ Clone the last item on the stack, and push it onto the stack.
$? If statement that checks if the stack is empty, if it's not empty it'll skip the next command.
$?[any number] If statement that checks if the last item on the stack equals to the specified number, if it's not it'll skip the next command.
$+ Takes the last two items on the stack and adds the sum to the top of the stack, but the two original values are removed.
$* Takes the last two items on the stack and adds the multiple to the top of the stack, but the two original values are removed.
$% Takes the last two values on the stack and adds the the modulo (top value % second top value) to the top of the stack, but the two original values are removed.
$%r Takes the last two values on the stack and adds the the modulo (second top value % top value) to the top of the stack, but the two original values are removed.
$i Requests the user to input a single character, its ASCII value will then be added on top of the stack.
$I Requests the user to input a string, can be as many characters as they prefer, its ASCII values and the length of the string will then be added on top of the stack.
$R[max] Adds a random integer to the stack, ranging from 0 to specified maximum.
$f Floors the last item on the stack.
$c Ceils the last item on the stack.
>[0-2] Defines a function.
pc$ Prints the last value on the stack as a character.
pc[any number] Prints the specified ASCII code as a character.
p$ Prints the last value on the stack as an integer.
p[any number] Prints the specified integer.
/[any number] Sleeps for the specified amount of time, it's specified in milliseconds.
<[0-2] Moves to a defined function.
- Exits the program.

Syntax to be added

Command Description
ph$ Prints the last value on the stack as a hexadecimal excluding the 0x prefix. Gets ignored if the value is negative.
ph[any number] Prints the specified integer as a hexadecimal excluding the 0x prefix. Gets ignored if the value is negative.
pb$ Prints the last value on the stack as a binary number excluding the 0b prefix. Gets ignored if the value is negative.
pb[any number] Prints the specified integer as a binary number excluding the 0b prefix. Gets ignored if the value is negative.

Examples (legacy)

Example: Hello, world!

This program prints the text "Hello World" to the screen, in School this is written as the following:

$72&$101&$108&$108&$111&$32&$87&$111&$114&$108&$100&$:
>0&pc$&$~&$?&<0
-

Or as deobfuscated code:

$72
$101
$108
$108
$111
$32
$87
$111
$114
$108
$100
$:
>0
pc$
$~
$?
<0
-

Example: Truth-machine

This program requests an character input from the user, if the input is 0 it will print "0" to the screen, otherwise it will print "1" over and over again.

$i&$?48&pc$&$?48&-
>0&pc$&<0

Or as deobfuscated code:

$i
$?48
pc48
$?48
-
>0
pc49
<0

Example: FizzBuzz

Largest program to have ever been made with School. It's essentially a counting program, but all multiples of 3 are replaced with Fizz, and all multiples of 5 are replaced with Buzz. Hence the name FizzBuzz. Multiples of 15 display both Fizz and Buzz.

$0&$$
>1&$~
>0&$$&$1&$+
$$&$3&$%r&$?0&pc70&$?0&pc105&$?0&pc122&$?0&pc122&$~
$$&$5&$%r&$?0&pc66&$?0&pc117&$?0&pc122&$?0&pc122&$~
$$&$3&$%r&$?0&pc10&$?0&/250&$?0&<1&$~
$$&$5&$%r&$?0&pc10&$?0&/250&$?0&<1&$~
p$&pc10&/250&<0

Or as deobfuscated code:

$0
$$
>1
$~
>0
$$
$1
$+
$$
$3
$%r
$?0
pc70
$?0
pc105
$?0
pc122
$?0
pc122
$~
$$
$5
$%r
$?0
pc66
$?0
pc117
$?0
pc122
$?0
pc122
$~
$$
$3
$%r
$?0
pc10
$?0
/250
$?0
<1
$~
$$
$5
$%r
$?0
pc10
$?0
/250
$?0
<1
$~
p$
pc10
/250
<0

Example: Cat program

This program prints to the screen whatever your input is, can be multiple characters.

$I
$~&$:
>0
pc$&$~
$?&<0&pc10&-

Or as deobfuscated code:

$I
$~
$:
>0
pc$
$~
$?
<0
pc10
-

Example: Factorial

This program prints the factorials of numbers, starting from 1.

$0&$1
>0
$:&$1&$+&$$&p$&pc32&$:
$*
p$&pc10
/500
<0

Or as deobfuscated code:

$0
$1
>0
$:
$1
$+
$$
p$
pc32
$:
$*
p$
pc10
/500
<0

Example: 99 bottles of beer

This is the first program written in School that's larger than even just 1kb. It "sings" the "99 Bottles of Beer" song.

$0
>0
>2&$?2&pc50&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc115&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc119&$?2&pc97&$?2&pc108&$?2&pc108&$?2&pc46&$?2&pc10&$?2&pc50&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc115&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc46&$?2&pc10&$?2&pc84&$?2&pc97&$?2&pc107&$?2&pc101&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc101&$?2&pc32&$?2&pc100&$?2&pc111&$?2&pc119&$?2&pc110&$?2&pc44&$?2&pc32&$?2&pc112&$?2&pc97&$?2&pc115&$?2&pc115&$?2&pc32&$?2&pc105&$?2&pc116&$?2&pc32&$?2&pc97&$?2&pc114&$?2&pc111&$?2&pc117&$?2&pc110&$?2&pc100&$?2&pc44&$?2&pc10&$?2&pc49&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc119&$?2&pc97&$?2&pc108&$?2&pc108&$?2&pc46&$?2&pc10&$?2&pc10
/50
$?2&pc49&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc119&$?2&pc97&$?2&pc108&$?2&pc108&$?2&pc44&$?2&pc10&$?2&pc49&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc46&$?2&pc10&$?2&pc84&$?2&pc97&$?2&pc107&$?2&pc101&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc101&$?2&pc32&$?2&pc100&$?2&pc111&$?2&pc119&$?2&pc110&$?2&pc44&$?2&pc32&$?2&pc112&$?2&pc97&$?2&pc115&$?2&pc115&$?2&pc32&$?2&pc105&$?2&pc116&$?2&pc32&$?2&pc97&$?2&pc114&$?2&pc111&$?2&pc117&$?2&pc110&$?2&pc100&$?2&pc44&$?2&pc10&$?2&pc78&$?2&pc111&$?2&pc32&$?2&pc109&$?2&pc111&$?2&pc114&$?2&pc101&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc115&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc119&$?2&pc97&$?2&pc108&$?2&pc108&$?2&pc46&$?2&pc10&$?2&pc10
/50
$?2&pc78&$?2&pc111&$?2&pc32&$?2&pc109&$?2&pc111&$?2&pc114&$?2&pc101&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc115&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc119&$?2&pc97&$?2&pc108&$?2&pc108&$?2&pc44&$?2&pc10&$?2&pc78&$?2&pc111&$?2&pc32&$?2&pc109&$?2&pc111&$?2&pc114&$?2&pc101&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc115&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc46&$?2&pc10&$?2&pc71&$?2&pc111&$?2&pc32&$?2&pc116&$?2&pc111&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc115&$?2&pc116&$?2&pc111&$?2&pc114&$?2&pc101&$?2&pc44&$?2&pc32&$?2&pc98&$?2&pc117&$?2&pc121&$?2&pc32&$?2&pc115&$?2&pc111&$?2&pc109&$?2&pc101&$?2&pc32&$?2&pc109&$?2&pc111&$?2&pc114&$?2&pc101&$?2&pc44&$?2&pc10&$?2&pc57&$?2&pc57&$?2&pc32&$?2&pc98&$?2&pc111&$?2&pc116&$?2&pc116&$?2&pc108&$?2&pc101&$?2&pc115&$?2&pc32&$?2&pc111&$?2&pc102&$?2&pc32&$?2&pc98&$?2&pc101&$?2&pc101&$?2&pc114&$?2&pc32&$?2&pc111&$?2&pc110&$?2&pc32&$?2&pc116&$?2&pc104&$?2&pc101&$?2&pc32&$?2&pc119&$?2&pc97&$?2&pc108&$?2&pc108&$?2&pc46&$?2&pc10&$?2&pc10
/50
$~
$99
>1
p$
pc32&pc98&pc111&pc116&pc116&pc108&pc101&pc115&pc32&pc111&pc102&pc32&pc98&pc101&pc101&pc114&pc32&pc111&pc110&pc32&pc116&pc104&pc101&pc32&pc119&pc97&pc108&pc108&pc44&pc10
p$
pc32&pc98&pc111&pc116&pc116&pc108&pc101&pc115&pc32&pc111&pc102&pc32&pc98&pc101&pc101&pc114&pc46&pc10&pc84&pc97&pc107&pc101&pc32&pc111&pc110&pc101&pc32&pc100&pc111&pc119&pc110&pc44&pc32&pc112&pc97&pc115&pc115&pc32&pc105&pc116&pc32&pc97&pc114&pc111&pc117&pc110&pc100&pc44&pc10
$-1&$+&p$ pc32&pc98&pc111&pc116&pc116&pc108&pc101&pc115&pc32&pc111&pc102&pc32&pc98&pc101&pc101&pc114&pc32&pc111&pc110&pc32&pc116&pc104&pc101&pc32&pc119&pc97&pc108&pc108&pc46&pc10
pc10
/50
$?2&<2&<1
<0

The deobfuscated code is so long, that I'll instead send the link to the code on Github[2].