Quiler

From Esolang
Jump to navigation Jump to search

Quiler is a joke esoteric programming language created in 2013. User:Sgeo had an initial idea, User:ais523 worked out what would be the minimal possible programming language that implemented the idea and wrote the specification, and User:ehird named it.

The semantics of Quiler are simple: given any input program, a Quiler compiler ignores it and outputs a Quiler compiler that targets the same language that the original compiler did. As such, all possible input programs are Quiler compilers in Quiler; and all total programs in any language are Quiler compilers that target Quiler. Also, all quines are Quiler compilers written in, and targeting, the same language (although a Quiler compiler need not be a quine). As such, Quiler compilers are relatively easy to obtain.

Note that it is possible for a total program in a language other than Quiler to not be a Quiler compiler. Even if the infinite regress in the definition is interpreted in the most inclusive way, if a compiler A for language L written in language M that targets the same language M compiles a program B written in language L, which is a compiler for language M that targets a language N other than M, then as long as there is at least one legal program in N that could be output by B that is illegal in M, A is not a Quiler compiler. If the preceding sentence made your head hurt, we recommend trying to avoid cross-compiling cross-compilers. (And never looking at gcc's build system.)

A side effect of the above is that a Quiler interpreter is necessarily also a Quiler compiler. (And vice versa.)

Example

A Quiler compiler targeting Haskell:

#!/usr/bin/perl -w
use strict;
my $pref = <<'EOP'; my $haskell = <<'EOH'; my $core = <<'EOC';
#!/usr/bin/perl -w
use strict;
my $pref = <<'EOP'; my $haskell = <<'EOH'; my $core = <<'EOC';
EOP
main = putStr . program $ ("Haskell", program history) : history

program h = core ++ show core ++ "\n\nhistory = " ++ show h ++ "\n"

core = "main = putStr . program $ (\"Haskell\", program history) : history\n\nprogram h = core ++ show core ++ \"\\n\\nhistory = \" ++ show h ++ \"\\n\"\n\ncore = "

history = [("Perl","
EOH
chop $haskell; print $haskell;
my $perl = $pref x 2 . "EOP\n$haskell\nEOH\n${core}EOC\n$core";
$perl =~ s/(["\\])/\\$1/g;
$perl =~ s/\n/\\n/g;
print $perl . "\")]\n";
EOC
chop $haskell; print $haskell;
my $perl = $pref x 2 . "EOP\n$haskell\nEOH\n${core}EOC\n$core";
$perl =~ s/(["\\])/\\$1/g;
$perl =~ s/\n/\\n/g;
print $perl . "\")]\n";