Re:A Ruby program that generates itself through a 128-langua...
by mmohtasim on Thursday October 06, 2022 @06:39AM
(#33106636)
Is there any 2 or 3 language version of this? Like ruby to python to java to ruby?
[ Parent
| on HN ]
Re:A Ruby program that generates itself through a 128-langua...
by lifthrasiir on Thursday October 06, 2022 @11:09AM
(#33109200)
Here it is:
a='print("""class q{public static void main(String[]a){System.out.println("a=#;a[35.chr]=39.chr+a.gsub(34.chr,92.chr*3+34.chr)+39.chr;puts a");}}""")';a[35.chr]=39.chr+a.gsub(34.chr,92.chr*3+34.chr)+39.chr;puts a
Run with `ruby q.rb | python - > q.java && javac q.java && java q`. Pretty sure that you can shorten this, I didn't take much time to do that.