SLOS
SLOS is created by User:A that stands for Scripting Language that's Outstandingly Simple; it tries to create a scripting language (not an interpreted language) that is very esoterically simple. It is designed to reach a high score at scriptometer.
Tools (45 points)
- Compilation & execution in 1 command(20 points)
- Shebang aware(15 points)
- program can be passed on command line (5 points)
- interactive interpreter (REPL) (5 points)
Program lengths by language (aka Example programs)
Smallest (0 bytes)
Hello, world! (16 bytes)
. is printing something to the console. Here, it takes a string. Parentheses for functions are optional.
. "Hello World"
argv (4 bytes)
$1 means the 1st parameter of the command-line.
. $1
env (4 bytes)
$h is the home environment variable.
. $h
Test file exists (11 bytes)
x tests whether a file exists.
x /etc/mtab
Test file readable (11 bytes)
r tests whether a file can be read. If so, then it reads the file.
r /etc/mtab
Formatting (25 bytes)
= sets a variable to a constant as it returns that value. + returns the sum of two values, and - returns the difference of two values.
. a=1," + ",b=2," = ",a+b
System (35 bytes)
c calls an external program. ? is the if statement; it checks the truth value of the right parameter, and if this is true, execute the rest of the line. A checking can contain :, which is the else part. :? can be combined into ;.
(c false)?. "false failed" . "done"
Sed in place (bytes)
w writes a string to a file, and it takes two parameters. e is the regex command; it replaces all occurances of the second parameter (in regex) in the first parameter to the third parameter.
w (e (r $1),"#*$",""),$1