Penguin

Differences between version 10 and predecessor to the previous major change of PolyGlot.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 10 Last edited on Friday, November 19, 2004 1:33:22 am by AristotlePagaltzis Revert
Older page: version 9 Last edited on Thursday, November 18, 2004 3:44:41 pm by JohnMcPherson Revert
@@ -1,55 +1,53 @@
 !!! PolyGlot #1 
-The following code is valid in at least 7 languages.  
  
+The [original polyglot | http://ideology.com.au/polyglot/] is valid code in 8 languages.  
  
 <verbatim> 
-(*O/*_/ 
+ (*O/*_/ 
 Cu #%* )pop mark/CuG 4 def/# 2 def%%%%@@P[TX---P\P_SXPY!Ex(mx2ex("SX!Ex4P)Ex= 
 CuG #%* *+Ex= 
 CuG #%*------------------------------------------------------------------*+Ex= 
-CuG #%* POLYGLOT - a program in seven languages 15 February 1991 *+Ex= 
+CuG #%* POLYGLOT - a program in eight languages 15 February 1991 *+Ex=  
+CuG #%* 10th Anniversary Edition 1 December 2001 *+Ex= 
 CuG #%* *+Ex= 
 CuG #%* Written by Kevin Bungard, Peter Lisle, and Chris Tham *+Ex= 
 CuG #%* *+Ex= 
-CuG #%* We have successfully run this program using the following: *+Ex=  
-CuG #%* ANSI COBOL: MicroFocus COBOL85 (not COBOL74 ) *+Ex=  
-CuG #%* ISO Pascal: Turbo Pascal (DOS & Mac ), Unix PC, *+Ex=  
-CuG #%* AIX VS Pascal *+Ex=  
-CuG #%* ANSI Fortran: Unix f77, AIX VS Fortran *+Ex=  
-CuG #%* ANSI C (lint free ): Microsoft C, Unix CC, GCC, Turbo C++, *+Ex=  
-CuG #%* Think C (Mac) *+Ex=  
-CuG #%* PostScript: GoScript, HP/Adobe cartridge, *+Ex=  
-CuG #%* Apple LaserWriter *+Ex=  
-CuG #%* Shell script: gnu bash, sh (SysV , BSD, MKS ), ksh *+Ex=  
-CuG #%* 8086 machine language: MS-DOS 2.00 , 3.03 , 4.01, 5.00 beta *+Ex=  
-CuG #%* VPix & DOS Merge (under unix ) *+Ex=  
-CuG #%* SoftPC (on a Mac ), MKS shell *+Ex= 
+CuG #%* Polyglot suports the following languages : *+Ex=  
+CuG #%* 1. COBOL (ANSI ) *+Ex=  
+CuG #%* 2. Pascal (ISO ) *+Ex=  
+CuG #%* 3. Fortran ( ANSI, f77) *+Ex=  
+CuG #%* 4. C (ANSI-ish ) *+Ex=  
+CuG #%* 5. PostScript *+Ex=  
+CuG #%* 6. Linux/Unix shell script ( bash, sh, csh ) *+Ex=  
+CuG #%* 7. x86 machine language ( MS-DOS, Win32 , Linux ) *+Ex=  
+CuG #%* 8. Perl (version 5 ) *+Ex= 
 CuG #%* *+Ex= 
 CuG #%* Usage: *+Ex= 
-CuG #%* 1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com] *+Ex=  
-CuG #%* 2. Compile and/or run with appropriate compiler and *+Ex=  
-CuG #%* operating system *+Ex= 
+CuG #%* 1. Rename this file to polyglot.[cob|pas|f77|c|ps|sh|com|pl ] *+Ex=  
+CuG #%* *+Ex=  
+CuG #%* 2. Compile and run with your favorite compiler and operating *+Ex=  
+CuG #%* system. *+Ex= 
 CuG #%* *+Ex= 
 CuG #%* Notes: *+Ex= 
 CuG #%* 1. We have attempted to use only standard language features. *+Ex= 
-CuG #%* Without the -traditional flag gcc will issue a warning. *+Ex=  
-CuG #%* *+Ex=  
-CuG #%* 2. This text is a comment block in all seven languages. *+Ex=  
 CuG #%* *+Ex= 
-CuG #%* 3 . When run as a .COM file with MS-DOS it makes certain *+Ex=  
-CuG #%* (not unreasonable) assumptions about the contents of *+Ex=  
-CuG #%* the registers. *+Ex= 
+CuG #%* 2 . Without the -traditional flag gcc will issue a warning . *+Ex= 
 CuG #%* *+Ex= 
-CuG #%* 4 . When transfering from Unix to DOS make sure that a LF *+Ex= 
+CuG #%* 3 . When transferring from Unix to DOS make sure that a LF *+Ex= 
 CuG #%* is correctly translated into a CR/LF. *+Ex= 
+CuG #%* *+Ex=  
+CuG #%* 4. Keep the black lines at the start of the program. They *+Ex=  
+CuG #%* are important. *+Ex=  
+CuG #%* *+Ex=  
+CuG #%* 5. This text is a comment block in all eight languages. *+Ex=  
 CuG #%* *+Ex= 
 CuG #%* Please mail any comments, corrections or additions to *+Ex= 
-CuG #%* peril @extro .ucc.su.oz .au *+Ex= 
+CuG #%* polyglot @ideology .com .au *+Ex= 
 CuG #%* *+Ex= 
 CuG #%*------------------------------------------------------------------*QuZ= 
 CuG #%* *+Ex= 
-CuG #%*!Mx)ExQX4ZPZ4SP5n# 5X!)Ex+ExPQXH,B+ExP[-9Z -9Z)GA (W@ 'UTTER_XYZZY'CPK *+ 
+CuG #%*!Mx)ExQX5ZZ5SSP5n* 5X!)Ex+ExPQXH,B+ExP[-9A -9B (g?(gA 'UTTER_XYZZXX!X *+ 
 CuG #(* *( 
 C # */); /*( 
 C # *) program polyglot (output); (*+ 
 C # identification division. 
@@ -63,9 +61,12 @@
 C # 
 C # * hello polyglots$ 
 C # main. 
 C # perform 
-C * ) 2>_$$; echo "hello polyglots"; rm _$$; exit 
+C /# * ) 2>_$$; echo "hello polyglots"; rm _$$; exit;  
+C # * (  
+C #  
+C *0 ) unless print "hello polyglots\n"; __END__  
  print 
 C stop run. 
  -*, 'hello polyglots' 
 
@@ -85,28 +86,38 @@
  end .(* ) 
 C)pop% program polyglot. *){*/} 
 </verbatim> 
  
+To compile (as [C] code) and run on [Linux]:  
  
-To compile (as C code) and run on linux:  
- $ gcc -xc polyglot.src -o polyglot && ./polyglot  
-(The -xc switch forces the language to be c).  
+<verbatim>  
+$ gcc -xc polyglot.src -o polyglot && ./polyglot  
+</verbatim>  
  
-Or you can view it as postscript:  
- $ gv polyglot .src  
+(The <tt>-xc</tt> switch forces the language to be [C])
  
-Run as a shell script:  
- $ sh < polyglot.src  
-or:  
- $ chmod +x polyglot.src ; ./polyglot.src 
+Or you can view it as PostScript:  
+  
+<verbatim>  
+$ gv polyglot.src  
+</verbatim>  
+  
+ Run as a [Shell] script:  
+  
+<verbatim>  
+ sh < polyglot.src  
+# or  
+chmod +x polyglot.src && ./polyglot.src  
+</verbatim>  
  
 I think you get the idea... 
  
 ---- 
 !!! PolyGlot #2 
-The following is a polyglotic quine. (A quine is a program that prints its own source code out when run, without cheating by using open(2) on itself)  
  
-polyglotC++PerlPythonC.c: 
+The following is a polyglotic quine. (A quine is a program that prints its own source code out when run, without cheating by using open(2) on itself.)  
+  
+[polyglotC++PerlPythonC.c | http://www.phong.org/bf/ polyglotC++PerlPythonC.c]
  
 <verbatim> 
 #include <stdio.h> 
 #define q(a,...) a