| Home > Listing Index > Games > Polyglot (computing) |
Games - Polyglot |
|
||
| In the context of computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independently of which of the chosen programming language in which it is compiled or interpreted. Intuition suggests that polyglot programs should be impossible or very difficult to write. Intuition, in this case, is wrong. Generally polyglots are written in a combination of C (which allows redefinition of tokens with a preprocessor) and a scripting programming language such as Lisp, Perl or sh. The two most commonly used techniques for constructing a polyglot program are to make liberal use of languages which use different characters for comments and to redefine various tokens as others in different languages. Often good use is made of quirks of syntax. These are demonstrated in this public domain polyglot written in ANSI C, PHP and GNU bash shell: #define a /* # /dev/null > /dev/null \ ; // 2> /dev/null; x=a; $x=5 // 2> /dev/null \ ; if (($x)) // 2> /dev/null; then return 0; // 2> /dev/null; fi #define e ?> #define b */ #include Note the following:
@rem = '--*-Perl-*-- @echo off perl "%~dpnx0" %* goto endofperl @rem '; #!perl print "Hello, world!\n"; :endofperl This allows the creation of Perl scripts that can be run on Microsoft systems with minimal effort. [ Visit the complete Wikipedia entry for Polyglot (computing) ] | Searches on eBayRelated searches on eBay |
| Some related entries: City 17 | Enhanced Chip Set | L'union fait la force | Sanford and Son | PhoneValet Message Center | The New Treasure Hunt | The Silence | Tianlong | Ilmater | Red | Adam Powell |
eBay Pulse | eBay Reviews | eBay Stores | Half.com | Kijiji | PayPal | Popular Searches | ProStores | Rent.com | Shopping.com Australia | Austria | Belgium | China | France | Germany | India | Italy | Spain | United Kingdom |
About eBay | Announcements | Security Center | Policies | Site Map | Help |
| Copyright © 1995-2005 eBay Inc. All Rights Reserved. Designated trademarks and brands are the property of their respective owners. Use of this Web site constitutes acceptance of the eBay User Agreement and Privacy Policy. |
eBay official time |