Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Christmas poem since 1988

by blazar (Canon)
on Dec 27, 2005 at 13:31 UTC ( #519318=note: print w/ replies, xml ) Need Help??


in reply to Christmas poem since 1988

Oh! impressive: not just as impressive as "the Best Ever", but I like the concept of code that is syntactically valid in more than one language. Now, a real challenge would be to write code that is valid C (and/or C++), Perl and Postscript, and does something interesting. As far as I'm concerned... quite about the only multi-language program I could write would probably be... an empty file! It would have the advantage of being a multi-language quine too!!
;-)


Comment on Re: Christmas poem since 1988
Replies are listed 'Best First'.
Re^2: Christmas poem since 1988
by Anonymous Monk on Dec 29, 2005 at 23:14 UTC
    I've added plain TeX, and updated the original download link target so it is now C, C++, Perl and plain TeX. I'm quite sure that it is not possible to add PostScript, because there is no way to find a common starting for C, C++, Perl, plain TeX and PostScript. However, if we remove plain TeX, it is quite easy to add TCL and Bourne Shell (hint: TCL treats a backslash at the end of the comment line as an indicator that the comment continues in the next line). The starting line should be: #define eval char *eval=

      I'm quite sure that it is not possible to add PostScript, because there is no way to find a common starting for C, C++, Perl, plain TeX and PostScript.

      I took that as a challenge :D

      %:/*:if 0;false +s&&(#*/include<stdio.h>/* { Just another \TeX\ hacker, { \bye } &g;print substr q q Just another Perl hacker, q, 1 and exit; q q %};};);echo -ne "\e[A\e[K\ Just another bash hacker, " && exit; */ int main() { printf("\ Just another C%s hacker,\n\ ", "++"+2*(1%sizeof'2')); } /* } /Times-Roman findfont 20 scalefont setfont newpath 72 72 moveto (Just another PostScript hacker,) show showpage % q # */
        The starting %: is just brilliant. Congratulations! In the meantime I added LaTeX, zsh and original Bourne Shell (tested on SunOS 5.7) support. Here it is:
        %:/*:if 0;false +s &&(#*/include<stdio.h>/* { \egroup\expandafter\ifx\csname documentclass\endcsname\relax \else \documentclass{article}\begin{document} Just another \LaTeX\ hacker, \csname fi\endcsname \end{document} \fi Just another \TeX\ hacker, { \egroup\end } &g;print substr q q Just another Perl hacker, q, 1 and exit; q q " (";}) awk 'BEGIN{printf"%c[A%c[K",27,27 }';sh=sh;test $BASH_VERSION&&sh=bash test $ZSH_VERSION&&sh=zsh echo Just another $sh hacker, && exit; */ int main() { return 0*printf("\ Just another C%s hacker,\n\ ", "++"+2*(1%sizeof'2')); } /* } /Times-Roman findfont 20 scalefont setfont newpath 72 72 moveto (Just another PostScript hacker,) show showpage % q # */

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://519318]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2015-07-31 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls