

Poly.html - check the source - tlrobinson
http://mauke.ath.cx/stuff/poly.html

======
siong1987
Python, Ruby, Bash, HTML, Javascript tested. Worked.

~~~
zepolen
There is even brainfuck and whitespace in there...

~~~
unalone
Huh! Somehow I missed whitespace in the source...

------
axod
This is older than the sun. But still clever.

------
tlrobinson
I had never heard of trigraphs before seeing this.

<http://en.wikipedia.org/wiki/C_trigraph>

I think I'll stay away from them.

~~~
dfox
Reasoning behind trigraphs (partially explained in footnote in standard,
section 5.2.1.1) is that there is something like "Invariant Code Set" which is
subset of ASCII and some characters used by C does not fall into this set
(which is obvious since C uses all ASCII characters except @ and $, with $
being valid character for identifiers on some compilers). Real usefulness of
this feature is exactly zero, but it provides some insight into process of
standardization. Uselessness of this is even more pronounced by fact that
there is no trigraph sequence for _, which also does not exist in some
encodings (althought for slightly different reasons).

Because almost all encodings that are not somehow compatible with ASCII are
obsolete now, trigraphs are obsolete too. But it is certainly interesting
thing to know about. And by the way "incompatible with ASCII" means that the
characters are there, but look different (¤ vs. $, ¥ vs \, and so on...)

~~~
kqr2
Actually, this was useful on an the Apple II series where you didn't have {}
characters on the keyboard and wanted to program in C.

~~~
tjr
I used some IBM mainframe keyboards that didn't have [] keys (but the computer
did have a C compiler installed).

------
callahad
<http://ideology.com.au/polyglot/> is a nice eight-language (Cobol, Pascal,
Fortran, C, PostScript, Shell, x86, Perl) polyglot program.

Conveniently, it has a source viewer which will highlight relevant parts of
the program's structure for a given language. For instance, the C compiler
sees this: <http://ideology.com.au/polyglot/c/>

~~~
shiro
Check out this.

<http://shinh.skr.jp/dat_dir/fizzbuzz7.gif>

It is a valid GIF image file, but also a valid Fizz Buzz program in Ruby,
Perl, Befunge, Z80 machine code, and x86 machine code.

~~~
khafra
Befunge makes it epic, but it could be polycode for the ages if the picture
itself compiled to a FizzBuzz program in Piet
(<http://www.dangermouse.net/esoteric/piet.html>)

------
zepolen
Now make it valid Malbolge and you win.

------
paraschopra
Genius!

------
zack
Can someone please explain why this is clever?

~~~
eli
It's a single source file that works in a dozen languages.

