Writing obfuscated code is fun.
I created other page .
Polyglot Quine in C and Ruby and Python and Perl and Brainfuck .
In other words, this program is runnable with 5 language implementations and it produces its source code without file I/O.
You can use this source code like following:
> gcc -xc <(./BFI <(python <(ruby <(perl poly_quine5.txt)))) > diff poly_quine5.txt <(./a.out) >
See also readable polyglot hello .
> perl poly_hello.txt Hello, Perl world! > ruby poly_hello.txt Hello, Ruby world! > python poly_hello.txt Hello, Python world! > gcc -xc poly_hello.txt && ./a.out Hello, C++ world! > ./befunge.rb poly_hello.txt Hello, Befunge world! > ./BFI poly_hello.txt Hello, Brainfuck world!
Symbolic (the program should not use [a-zA-Z0-9] and binaries. I didn't use whitespace characters as well for this case) Polyglot Quine in Ruby and Perl and JavaScript .
Note that you can use SpiderMonkey , Firefox , Chrome , and Safari as the engine of JavaScript (IE is not supported). For browsers, it should output the code via alert(). Run the polyglot in this browser .
Linux binary , produced by the code using NASM.
You can run Hello, world! in 4 ways.
It has 5 meanings:
103Byte symbolic quine in Perl. I defined "symbol" as [\n !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~].
($;=<<'' #&-!!*!%>{(\$;=<<'' $; )=~(' _ ^-^,'^'"`[;[?@(\$;^\$^)})')+ )=~(' _ ^-^,'^'"`[;[?@($;^$^)})')
See also: symbolic quine in Ruby .
bfx.sed .
It compiles brainfuck code into linux ELF binary.
This code runs on x86.
char main[]="`j X$@P[PYPPPPX4.4 PZUX, P^XH,=)F(P_X3F()8)8@)8@@)8)8@PYX@@@@CQBaGHello, world!\n";
The following code may be also interestring.
main=195;
Here is my description in Japanese .
int main(){ char a[4]; char b[0x3fffffff]; char c[0x3fffffff]; char d[0x3fffffff]; char e[0x3fffffff]; int f = 0; printf("%x %x %x %x\n", a[0],a[1],a[2],a[3]); f = 0x12345678; printf("%x %x %x %x\n", a[0],a[1],a[2],a[3]); return &f; }
''=~('(?{'.('[[).[|`%,,/`[/[@$'^'+)@@/^(@@@@@,@),@').'! "})')
> echo 2007 12 | ./BFI ~/cal.bf 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
It compiles brainfuck code into intermediate format and executes it.
768Byte Hello, world! in Whirl . This code is smaller than the previous record .
The record was beaten by yowa .