Microscript
Microscript is a new expiremental golfing language I've been working on recently. For my Death By Shock Probe challenge, I was able to write a program that would have beaten out the leading Pyth entry by one byte, except for the fact that the language is too new to be eligible to actually compete in that challenge.
It uses a pair of stacks to manipulate data, and currently has just over 30 distinct commands
The esolangs wiki article can be found here
Length 0 snippet:
The empty program prints 0, followed by a newline. This is because the main register is initially 0, and printing is implicit unless otherwise specified.
Length 1 snippet: p
Prints the contents of the register to the output, followed by a newline. On end of execution, this will be done automatically, unless execution was halted by the h
command.
Length 2 snippet: 99
Any positive integer literal not part of another command will increment the main register by that value. Thus, unless part of another command, this will add 99 to the value in said register.
Length 3 snippet: is*
Currently the shortest example program on the esolangs wiki article. Takes in an input and squares it. i
takes a number from the input and writes it to the register, s
pushes it to the stack (unlike in HSPAL, this does not zero the register), and *
pops it off the stack again and multiplies it by the value in the register, writing the result to the register. Then, as mentioned above, the new value is printed implicitly.
Length 4 snippet: isi+
Another example program from the esolangs wiki article. Takes two inputs and outputs their sum.
Length 5 snippet: '~Pph
'<any character>
is the language's equivalent of a character literal. P
prints as a character while p
prints as an integer. Finally, h
halts immediately without the implicit printing. Therefore, the output from this is ~126
. This is technically equivalent to the shorter (3 byte) '~P
.
Length 6 Snippet: i{z1p}
This is a truth machine. The closing bracket is optional in this case, but I already had a length 5 snippet. {}
is the equivelent of BrainF***'s []
; Microscript uses square brackets for other purposes.
Length 7 Snippet: 20ec1r4
Simulates the rolling of 1,048,576 four-sided dice. This is what would have been the winning entry for my afformentioned Death By Shock Probe challenge had Microscript come out a short time earlier. The c
command was the language's first form of iteration- essentially "zero the register, then repeat the following a number of times equalling the value that was in the register before it was zeroed". 1
increments by 1, and r4
increments by a random integer on [0,4). Lastly, e
is a base-2 exponential function while E
is the base-10 equivalent. Thus, 10Ec1r4
(or, equivalently, 1EEc1r4
) would simulate the rolling of ten billion four-sided dice. Eventually.
Length 9 snippet: 1{I[h]fan
A cat
program that terminates on the first empty line (as the language currently lacks EOF detection)