-
Notifications
You must be signed in to change notification settings - Fork 5
/
poly.poly
137 lines (129 loc) · 4.85 KB
/
poly.poly
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# /* [ <!-- */ include <stdio.h> /* \
#`{{coding=utf-8\
"true" if 0 != 0 and q != """0" ; ` \
\
if [ -n "$ZSH_VERSION" ]; then \
\
echo exec echo I\'m a zsh script.; \
\
elif [ -n "$BASH_VERSION" ]; then \
\
echo exec echo I\'m a bash script.; \
else \
echo exec echo I\'m a sh script.; \
fi`; #!;#\
BEGIN{print"I'm a ", 0 ? "Ruby" :"Perl", " program.\n"; exit; }
#\
%q~
set =dummy 0; puts [list "I'm" "a" "tcl" "script."]; exit
all: ; @echo "I'm a Makefile." \
#*/
/*: */ enum {a, b}; \
\
static int c99(void) {
#ifndef __cplusplus /* bah */
unused1: if ((enum {b, a})0) \
(void)0;
#endif
unused2: 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 if (1//**/2
)unused3 : { ; \
printf("I'm a C program (C%s, trigraphs %sabled).\n", \
c99() ? "89 with // comments" : "99", \
trigraphs() ? "en" : "dis"); \
} else { \
printf("I'm a C program (C89, trigraphs %sabled).\n", \
trigraphs() ? "en" : "dis"); \
} \
return 0; \
} /*
# \
\begin{code}
import Prelude hiding ((:)); import Data.List (intercalate); import Language.Haskell.TH; import Data.String; default (S, String, Integer, Double); data S = S; instance Eq S where { _ == _ = False }; instance IsString S where { fromString = const S }; ifThenElse c t e = case c of True -> t; False -> e
cPP = False; {-
#define cPP True
-} main :: IO ()
main = putStr ("I'm a Literate Haskell program" ++ bonus ++ ".\n") where
_ = (); bonus | null details = "" | otherwise = " (" ++ details ++ ")"
details = intercalate ", " [ name | (True, name) <- extensions ] :: String
extensions =
(bangPatterns, "BangPatterns" ) :
(templateHaskell, "TemplateHaskell" ) :
(rebindableSyntax, "RebindableSyntax" ) :
(magicHash, "MagicHash" ) :
(overloadedStrings, "OverloadedStrings" ) :
(noMonomorphismRestriction, "NoMonomorphismRestriction") :
(scopedTypeVariables, "ScopedTypeVariables" ) :
(cPP, "CPP" ) :
(unicodeSyntax, "UnicodeSyntax" ) :
(negativeLiterals, "NegativeLiterals" ) :
(binaryLiterals, "BinaryLiterals" ) :
(numDecimals, "NumDecimals" ) : []
(!) = (!!)
bangPatterns = [True] ! 0 where foo !bar = False
templateHaskell = thc $(return (TupE []) :: ExpQ)
rebindableSyntax = null (do { [()]; [()] })
where _ >> _ = [] :: [()]
magicHash = foo# () where
foo = ['.']; "." # _ = False; foo# _ = True
overloadedStrings = "" /= ""
noMonomorphismRestriction = show foo == "0" where
foo = 0
bar = foo :: Double
unicodeSyntax = let (★) = True in (*) where
(*) = False
negativeLiterals = -1 == NNa
binaryLiterals = let b1 = 1 in 0b1 == 1
numDecimals = show 0e0 == "0"
scopedTypeVariables = stv (0 :: Double) == "0.0"
data{- = -} NN = NNa | NNb deriving Eq; instance Num NN where { fromInteger _ = NNa; negate _ = NNb; _ + _ = NNa; _ * _ = NNa; abs _ = NNa; signum _ = NNa }
instance{- = -} (Num a) => Num (e -> a) where { fromInteger = const . fromInteger; negate = (.) negate; abs = (.) abs; signum = (.) signum; x + y = \e -> x e + y e; x * y = \e -> x e * y e }
class THC a where { thc :: a -> Bool }; instance THC () where { thc _ = True }; instance THC (Q a) where { thc _ = False }; class (Show a, Num a) => STV a where
stv :: a -> String
stv = const $ show (f 0) where
f = id :: a -> a
instance STV Double -- : \
\end{code}
# \
]>++++++++[<+++++++++>-]<+.>>++++[<++++++++++>-]<-.[-]>++++++++++ \
[<+++++++++++>-]<-.>>++++[<++++++++>-]<.>>++++++++++[<++++++++++> \
-]<- - -.<.>+.->>++++++++++[<+++++++++++>-]<++++.<.>>>++++++++++[ \
<++++++++++>-]<+++++.<<<<+.->>>>- - -.<+++.- - -<++.- ->>>>>+++++ \
+++++[<+++++++++++>-]<- - -.<<<<<.<+++.>>>.<<<-.- ->>>>+.<.<.<<.> \
++++++++++++++.[-]++++++++++""" else 0
# \
from platform import * # \
print("I'm a Python program (%s %s)." % # [-][ \
(python_implementation(), python_version())); """--><html><head>
<!--:--><title>I'm a HTML page</title></head><body>
<!--:--><h1>I'm a <marquee><blink>horrible HTML</blink></marquee> page</h1>
<!--:--><script language="JavaScript">
<!--: # \
setTimeout( // \
function () { // \
document.body.innerHTML = "<h1>I'm a javascript-generated HTML page</h1>"; // \
}, 10000); // \
//-->
</script><!--: \
</body></html><!-- }} # \
say "I'm a Perl6 program."; # """ # */
#define FOO ]-->~