Skip to content

Instantly share code, notes, and snippets.

@rgrig

rgrig/Main.java Secret

Last active March 27, 2018 22:33
Show Gist options
  • Save rgrig/b4cdaed3ed9a70dbdb6f158f14b57263 to your computer and use it in GitHub Desktop.
Save rgrig/b4cdaed3ed9a70dbdb6f158f14b57263 to your computer and use it in GitHub Desktop.
// Encodes a Turing machine that counts in binary, and then halts.
// Gives stack overflow by default.
// If you increase the stack size (javac -J-Xss100M Main.java),
// then it type-checks, but it takes a lot of time.
interface Z {}
interface N<x> {}
interface ML<x> {}
interface MR<x> {}
interface L0<x> {}
interface L1<x> {}
interface LT<x> {}
interface Lhash<x> {}
interface QiwL<x> extends
ML<N<?super QiL<?super x>>>,
MR<N<?super QiwL<?super MR<?super N<?super x>>>>>,
E<QiLR<?super N<?super x>>>,
L0<N<?super QiwL<?super L0<?super N<?super x>>>>>,
L1<N<?super QiwL<?super L1<?super N<?super x>>>>>,
LT<N<?super QiwL<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QiwL<?super Lhash<?super N<?super x>>>>> {}
interface QfwL<x> extends
ML<N<?super QfL<?super x>>>,
MR<N<?super QfwL<?super MR<?super N<?super x>>>>>,
E<QfLR<?super N<?super x>>>,
L0<N<?super QfwL<?super L0<?super N<?super x>>>>>,
L1<N<?super QfwL<?super L1<?super N<?super x>>>>>,
LT<N<?super QfwL<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QfwL<?super Lhash<?super N<?super x>>>>> {}
interface QrwL<x> extends
ML<N<?super QrL<?super x>>>,
MR<N<?super QrwL<?super MR<?super N<?super x>>>>>,
E<QrLR<?super N<?super x>>>,
L0<N<?super QrwL<?super L0<?super N<?super x>>>>>,
L1<N<?super QrwL<?super L1<?super N<?super x>>>>>,
LT<N<?super QrwL<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QrwL<?super Lhash<?super N<?super x>>>>> {}
interface QhwL<x> extends
ML<N<?super QhL<?super x>>>,
MR<N<?super QhwL<?super MR<?super N<?super x>>>>>,
E<E<?super Z>>,
L0<N<?super QhwL<?super L0<?super N<?super x>>>>>,
L1<N<?super QhwL<?super L1<?super N<?super x>>>>>,
LT<N<?super QhwL<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QhwL<?super Lhash<?super N<?super x>>>>> {}
interface QiwR<x> extends
MR<N<?super QiR<?super x>>>,
ML<N<?super QiwR<?super ML<?super N<?super x>>>>>,
E<QiRL<?super N<?super x>>>,
L0<N<?super QiwR<?super L0<?super N<?super x>>>>>,
L1<N<?super QiwR<?super L1<?super N<?super x>>>>>,
LT<N<?super QiwR<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QiwR<?super Lhash<?super N<?super x>>>>> {}
interface QfwR<x> extends
MR<N<?super QfR<?super x>>>,
ML<N<?super QfwR<?super ML<?super N<?super x>>>>>,
E<QfRL<?super N<?super x>>>,
L0<N<?super QfwR<?super L0<?super N<?super x>>>>>,
L1<N<?super QfwR<?super L1<?super N<?super x>>>>>,
LT<N<?super QfwR<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QfwR<?super Lhash<?super N<?super x>>>>> {}
interface QrwR<x> extends
MR<N<?super QrR<?super x>>>,
ML<N<?super QrwR<?super ML<?super N<?super x>>>>>,
E<QrRL<?super N<?super x>>>,
L0<N<?super QrwR<?super L0<?super N<?super x>>>>>,
L1<N<?super QrwR<?super L1<?super N<?super x>>>>>,
LT<N<?super QrwR<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QrwR<?super Lhash<?super N<?super x>>>>> {}
interface QhwR<x> extends
MR<N<?super QhR<?super x>>>,
ML<N<?super QhwR<?super ML<?super N<?super x>>>>>,
E<E<?super Z>>,
L0<N<?super QhwR<?super L0<?super N<?super x>>>>>,
L1<N<?super QhwR<?super L1<?super N<?super x>>>>>,
LT<N<?super QhwR<?super LT<?super N<?super x>>>>>,
Lhash<N<?super QhwR<?super Lhash<?super N<?super x>>>>> {}
interface E<x> extends
QiLR<N<?super QiwR<?super E<?super E<?super x>>>>>,
QfLR<N<?super QfwR<?super E<?super E<?super x>>>>>,
QrLR<N<?super QrwR<?super E<?super E<?super x>>>>>,
QhLR<N<?super QhwR<?super E<?super E<?super x>>>>>,
QiRL<N<?super QiwL<?super E<?super E<?super x>>>>>,
QfRL<N<?super QfwL<?super E<?super E<?super x>>>>>,
QrRL<N<?super QrwL<?super E<?super E<?super x>>>>>,
QhRL<N<?super QhwL<?super E<?super E<?super x>>>>> {}
interface QiLR<x> {}
interface QfLR<x> {}
interface QrLR<x> {}
interface QhLR<x> {}
interface QiRL<x> {}
interface QfRL<x> {}
interface QrRL<x> {}
interface QhRL<x> {}
interface QiL<x> extends
LT<N<?super QfwL<?super LT<?super N<?super MR<?super N<?super x>>>>>>> {}
interface QfL<x> extends
L0<N<?super QrwL<?super ML<?super N<?super L1<?super N<?super x>>>>>>>,
L1<N<?super QfwL<?super L0<?super N<?super MR<?super N<?super x>>>>>>>,
LT<N<?super QhwL<?super MR<?super N<?super LT<?super N<?super x>>>>>>> {}
interface QrL<x> extends
L0<N<?super QrwL<?super ML<?super N<?super L0<?super N<?super x>>>>>>>,
L1<N<?super QrwL<?super ML<?super N<?super L1<?super N<?super x>>>>>>>,
LT<N<?super QfwL<?super LT<?super N<?super MR<?super N<?super x>>>>>>> {}
interface QhL<x> extends
LT<N<?super QhwL<?super MR<?super N<?super LT<?super N<?super x>>>>>>> {}
interface QiR<x> extends
LT<N<?super QfwR<?super MR<?super N<?super LT<?super N<?super x>>>>>>> {}
interface QfR<x> extends
L0<N<?super QrwR<?super L1<?super N<?super ML<?super N<?super x>>>>>>>,
L1<N<?super QfwR<?super MR<?super N<?super L0<?super N<?super x>>>>>>>,
LT<N<?super QhwR<?super ML<?super N<?super LT<?super N<?super x>>>>>>> {}
interface QrR<x> extends
L0<N<?super QrwR<?super L0<?super N<?super ML<?super N<?super x>>>>>>>,
L1<N<?super QrwR<?super L1<?super N<?super ML<?super N<?super x>>>>>>>,
LT<N<?super QfwR<?super MR<?super N<?super LT<?super N<?super x>>>>>>> {}
interface QhR<x> extends
LT<N<?super QhwR<?super ML<?super N<?super LT<?super N<?super x>>>>>>> {}
class Main {
Lhash<?super N<?super
MR<?super N<?super
LT<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
L0<?super N<?super
LT<?super N<?super
Lhash<?super N<?super
E<?super E<?super Z>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
doit(
QiwR<?super E<?super E<?super Z>>> v
) {
return v;
}
}
@njlr
Copy link

njlr commented Jun 15, 2016

I'd rather use Brainfuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment