Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5698236
  • 博文数量: 675
  • 博客积分: 20301
  • 博客等级: 上将
  • 技术积分: 7671
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-31 16:15
文章分类

全部博文(675)

文章存档

2012年(1)

2011年(20)

2010年(14)

2009年(63)

2008年(118)

2007年(141)

2006年(318)

分类:

2006-08-28 20:02:23


$ bf poly.sh.pl.php.tcl.cpp.bf.py.c.lhs.txt
I’m a brainfuck program.

Rename file to compile in C/C++:

hallvar@apuk:~$ gcc p.c -o c;./c
I’m a C program (C89 with // comments, trigraphs disabled).
hallvar@apuk:~$ g++ p.c -o cp;./cp
I’m a C++ program, trigraphs disabled.

程序如下

#/*
#*/
 # /*[*/ include /* \
`"""echo" eval "exec echo I\'m a sh script."`
 # \
if 0; print "I'm a Perl program.\n"; __END__
puts "I'm a tcl script."; exit
*/
enum {a, b};
static int c99(void) {
 #ifndef __cplusplus /*bah*/
        if ((enum {b, a})0)
        ;
 #endif
        return a;
}

static int trigraphs(void) {
        return sizeof "??!" == 2;
}

char X;
int main(void) {
        struct X {
                char a[2];
        };
        if (sizeof(X) != 1) {
                printf("I'm a C++ program, trigraphs %sabled.\n",
                           trigraphs() ? "en" : "dis");
        } else {
                printf("I'm a C program (C%s, trigraphs %sabled).\n", c99() ? 1/
/**/2
                           ? "89 with // comments" : "89" : "99",
                           trigraphs() ? "en" : "dis");
        }
        return 0;
}

/*

> main :: IO ()
> main = putStr "I'm a Literate Haskell program.\n"

]>++++++++[<+++++++++>-]<+.>>++++[<++++++++++>-]<-.[-]>++++++++++
[<+++++++++++>-]<-.>>++++[<++++++++>-]<.>>++++++++++[<++++++++++>
-]<---.<.>+.->>++++++++++[<+++++++++++>-]<++++.<.>>>++++++++++[<+
+++++++++>-]<+++++.<<<<+.->>>>---.<+++.---<++.-->>>>>++++++++++[<
+++++++++++>-]<---.<<<<<.<+++.>>>.<<<-.-->>>>+.<.<.<<.>++++++++++
+ +++.[-]++++++++++"""`
print "I'm a Python program." # */

阅读(1153) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~