It looks like you're new here. If you want to get involved, click one of these buttons!
Title: 128 Language Uroboros Quine
Author/s: Yusuke Endoh (mame)
Language/s: Ruby + 127 other languages
Year/s of development: 2013-ongoing
Software/hardware requirements: Check here. for necessary dependencies to be installed prior to running it.
"A quine is a computer program which takes no input and produces a copy of its own source code as its only output" (Wikipedia) and this particular quine is a "Ruby program that generates Rust program that generates Scala program that generates ...(through 128 languages in total)... REXX program that generates the original Ruby code again."
Yusuke Endoh is a member of the Ruby language's core-team. Ruby is a language known for having a beginner-friendly syntax and a welcoming community. It is, supposedly, a language "optimized for programmer happiness" and not for compiler happiness. In other words, Ruby leverages techniques such as syntactic sugaring to create its approachable syntax.
Nothing, in this program, seems approachable to me. How can I even begin analysing it?
eval$s=%q(eval(%w(B=92.chr;g=32.chr;puts(eval(%q(N=10.chr;n=0;e=->s{Q[Q[s,B],?"].K(N,B+?n)};E=->s{'("'+e[s]+'")'};d=->s,t=?"{s.K(t){t+t}};def~f(s,n)s.K(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;Q=->s,t=?${s.K(t){B+$&}};R=";return~0;";V=->s,a,z{s.K(/(
#{B*4})+/){a+"#{$&.size/2}"+z}};C=%w(System.Console~Write);$C=C*?.;$D="program~QR";$G="~contents~of"+$F="~the~mix!g~bowl";$L="public~static";rp=->s,r{v="";[r.!ject(s){|s,j|o={};m=n=0;s.size.times{|i|o[f=s[i,2]]||=0;c=o[f]+=1;m<c&&(m=c;n=f)};v=n+v;
s.K(n,(j%256).chr)},v]};%(fn~mX{Z`x21("{}",#{E["object~QR~extends~App{#{f(%((display~"#{e[%(Zf("1d;s/.//;s/1/~the~sum~of~a~son~and0/g;s/0/~twice/g;s/2/`x59ou~are~as~bad~as/g;s/3/~a~son`x21Speak~your~m!d`x21/g^n#The~Relay~of~Qu!e.^n#Ajax,~a~man.^n#
Ford,~a~man.^n#Act~i:~Qu!e.^n#Scene~i:~Relay.^n#[Enter~Ajax~and~Ford]^n#Ajax:^n#");function[]=f(s);for~i=1:2:length(s),Zf("2%s3",part(dec2b!(hex2dec(part(s,i:i+1))),$:-1:2)),end;endfunction`n#{s,v=rp["Transcript~show:~'#{d["Z"+E[%(fun~p~n=Z(Int.to
SJ~n`x5e"~");fun~mX=(p~0;p~0;p~130;List.tabulate(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[~~~~~~%(object"Application"{state"ma!"{foreach(s~![#{f(%(puts~"#{Q[e[%(echo~'a::=`x7e#{Q[Q["let~s=#{E[%(void~p(!t[]c){foreach(!t~v~!~c)stdout.Zf("%c%c
",v/256,v%256);}void~mX{!t[]a;p({19796,26724,0,6,0,1,480,19796,29291,#{s=%(module~QR;!itial~beg!~#{f("let~s=#{E[%(Module~QR:Sub~MX:Dim~s,n,i,c~As~Object:n=Chr(10):For~Each~c~!"#{d["<?xml#{O="~version='1.0'"}?><?xml-#{I="stylesheet"}~type='text/xsl
'href='QR.xslt'?><xsl:#{I+O}~xmlns:xsl='http://www.w3.org/1999/`x58SL/Transform'><xsl:output~method='text'/><#{U="xsl:template"}~match='/'><`x21[CDATA[#{%(sub~f(s$,n)Z(s$);:for~i=1to~n~Z("Y");:next:end~sub:f("#{V[e[%(H,format="#{y="";f("^H{-}{txt}
{#{Q["echo~-E~$'#{Q[Q[E[%(with~Ada.Text_Io;procedure~qr~is~beg!~Ada.Text_Io.Put("#{d[%(trans~B(Buffer)`ntrans~O(n){`nB:add(Byte(+~128~n))}`ntrans~f(v~n){`nO(+(/~n~64)107)`nO(n:mod~64)`nO~v}`ntrans~D(n){if(<~n~4){f(+(*~6~n)9)48}{if(n:odd-p){D(-~n~3
)`nf~27~48`nf~36~11}{D(/~n~2)`nf~21~48`nf~48~20}}}`ntrans~S(Buffer"#{e[%W[STRINGz:=~226+~153,a:=z+~166,b:=a+"2"+z+~160,c:=b+"8"+z+~165,t:="#{d[%(class~QR{#$L~void~ma!(SJ[]a){a=#{E["H('#{Q[e["implement~ma!0()=Z"+E["BEGIN{Z#{E[%(echo~'#{%(f(s){Syste
m.out.Z(s);}s="389**6+44*6+00p45*,";for(c:#{E[(s="#!clude<iost ream>`n!t ~mX{std::cout<<#{E[%(class~Program{#$L~void~MX{#$C("Qu!e~Relay~Coffee.^n^nIngredients.^n");for(!t~i=9;i++<126;)#$C($"{i}~g~caffe!e~{i}^n");#$C("^nMethod.^n");foreach(char~c~
!#{E[%((doseq[s(lazy-cat["IDENTIFICATION~DIVISION." "PROGR AM-I D.~QR."" PROCEDURE~DIVISION."'DISPLA`x59](map~#(str"~~~~^""(.replace~%1"^"""^"^"")"^"")(re-seq~#".{1,45}""#{e["(f=(n)->Array(n+1).jo!~'Y');console.log('%s',#{V[E[%((H-l!e"
#{e["import~std.stdio;void~mX{H(`x60#{%(method~MX {Z( @ "#{d["['']p[#{"IO.puts"+E[%((pr!c~"#{e["`nma!(_)->`nio:fH#{d[E['Zfn("""'+d[?"+"%opti on~noyywrap`n%%`n%%`n!t~mX{puts#{E["echo~'#{Q[Q[%(~:~A~."#{g*9}
"~;~:~B~A~."~WRITE(*,*)'"~A~;~:~C~B~T`x59PE~."~ '" ~CR~;~:~D~S"~#$D"~C~S^"~Z~^"(&"~C~S^"~#{e[%(Z"#{e["s:=OutputTex tUser();WriteAll(s,#{E[%(Zf"#{e[d[f(".template~1`n#{d['
set~Z"-";Z'+E[%(package~ma!;import"fmt";func~ mX{fmt.Pr!t#{E[%(236:j;{119:i;{206i-:i;.48<{71+}{[i]^48-*}if }%}:t;"algoritmo~QR;!"[195][173]++'cio~imprima("'"
013141"t"/12131"t~6*"/1:1918151:??6271413/4= 3626612/2/353251215/`x5a0`x5a0R"t"#{e[%(z=new~jav a.util.zip.G`x5aIPOutputStream(System.out);z.H
('#{"ma!=putStr"+E["class~QR{#$L~function~m X{neko.Lib.Z#{E[%(procedure~mX;i:=c:=0;s:= #{E[%(.class~public~QR`n.super~#{$T="java/i
o/Pr!tStream"}`n.method~#$L~ma!([L#{S="ja va/lang/S"}J;)V~;]`n.limit~stack~2`ngetst atic~#{S}ystem/out~L#$T;`nldc~"#{e[%(cla
ss~QR{#$L~void~ma!(SJ[]v){SJ~c[]=new~SJ [999 99],y="",z=y,s="#{z=t=(0..r=q=126) .map{|n|[n,[]] };a="";b=->n{a<<(n%78+55)%84+42};(%(P
={0:'[+[]]',m:'((+[])'+(C="['construct or']" )+"+[])['11']"};for(R~!~B=(' `x21[]@`x21`x21[]@[][[]]@'+( A="[]['fill']")+"@([]+[])['fontcolor
']([])@(+('11e20')+[])['split']([])@" +A+C +"('return~escape')()("+A+' )').split('@'))for(E~!~D=eval(G='('+B[ R]+'+[])'))P[T=D[E]]=P[T]||G+"['"+
E+"']";for(G='[',B=0;++B<36;)P[D=B.to SJ(36)]=B<10?(G+='+`x2 1+[]')+']':P[D]||"(+(' "+B+"'))['to'+([]+[])"+C+"['name']]('36')";A +=C+"('console.log(unescape(^"";
for(E~!~G=#{E[%(Z("""#{Q[e[%(s=();a() {~s+ =($(echo~-n~$1|od~-An~-tu1~-v)~$2) ;};a~"Section`x48 eader+name:=QR;SectionPublic-ma!<-("~10;t='#{"cons ole.log"+Q[E[%(@s=global[#{i=(s
=%(`x48AI~1.2`nVISIBLE~"#{"x=sJ.K(#{V[E ["changequote(<@,@>)`ndef!e(p,<@#{"all:`n`t@echo~ '#{d["l!el:99 999;Z#{E["solve~satisfy;output~[#{E[%(.assembly~t{}.me thod~#$L~void~MX{.entrypo!t~l
dstr"#{e["m{{`x21:~x`nqr:~|-`n~:db`x 60#{e[s="$Z#{E["Zf#{E["echo"+E["#import<stdio.h>#{N }!t~mX{puts# {E["Z_sJ"+E["s=double#{E["Z#{E["$console:l!e[#{"#$D(output );beg!~H(#{f((p="eval";%($_=
"#{s,v=rp["$_='#{Q[%(<?php~$z=3+$ w=strlen($s=#{Q[E["!t~mX{H#{E["(#{?_*11})dup~=/s(|~~~~~. ~~~|)def (#{Q["qr:-H('#{Q[e["!it{#{f(%(Z('cat("')`nfor~c~!"".jo!(["ech o~'say~''%s'''^n"%l~for~l~!
#{E[d[d["eval$s=%q(#$s)",?'],?'] ]}.split("^n")]):Z('r=fput(char(%d))'%ord(c))`nZ('end^n")')# ),6) {"Zf#{d[$S,?%]};"}}}"],?']}').",B]}){9~7{exch~dup~1~and~79~mul~32 ~add~exch~2~idiv~3~1~roll~
s~exch~2~!dex~exch~put~1~sub~d up~6~eq{1~sub}if}repeat~s~=~pop~pop}forall~=~quit"]+R}}"]]})*3; ec ho"^x89PNG^r^n^x1a^n";$m="";$t="^xc0^0^xff";for($i=-1;++$i<128*$z;$m.=$c--?($w- $c||$i>$z)&&$i/$z<($c<$w?o
rd($s[(!t)($c/3)]):$c--%3+2) ?$t[2].$t[$c%3%2].$t[$c%3]:"^0^0^0":"^0")$c=$i%$z;foreach(array("I` x48DR" .pack("NNCV",$w+2,128,8,2),"IDAT".gzcompress($m),"IEND")as$d)ec ho~pack("NA*N",strlen($d)
-4,$d,crc32($d));).K(B,"`x7 f"),?']}';s:g/^x7f/Y/;Z~$_",128..287];s="$_='#{Q[s,c=/['Y]/]}';$n=32;$ s='#{Q[v,c]}';$s=`x7es{..}{$a=$&;$b=chr(--$n&255);` x7es/$b/$a/g;}eg;Z";(s+N
*(-s.size%6)).unpack("B*") [0].K(/.{6}/){n=$&.to_i~2;((n+14)/26*6+n+47).chr}}";s|.|$n=ord$&;substr~ unpack(B8,chr$n-!t($n/32)*6-41),2|eg;eval~pack 'B*',$_).scan(/[~,-:A-z]
+|(.)/){p="s++#{$1?"chr~# {$1.ord}+e":$&+?+};"+p};p),1){"'#$s',"}}'')end.".K(/[:;()]/){?`x5e+$&}}]"]} ;quit"]};t=num2cell(b=11-ceil(s/13));for~ n=1:9m={};for~i=1:141f=@
(x,y,n)repmat(['Ook'~char (x)~'~Ook'~char(y)~'~'],[1~abs(n)]);m(i)=[f(z=46,63,n)~f(q=z-(i<13)*13,q,i-1 3)~f(33,z,1)~f(63,z,n)];end;t(x=b==n) =m(diff([0~s(x)])+13);en
d;Zf('%%s',t{:})"]]+R}}" ]]}`n"]};"]}`x60`n~global~_start`n~_start:mov~edx,#{s.size}`n~mov~ecx,m`n~mov~e bx,1`n~mov~eax,4`n~!t~128`n~mov~eb x,0`n~mov~eax,1`n~!t~12
8`nx:~|`n~}}{{{qr}}}"]}" call~void~[mscorlib]#{C*"::"}(sJ)ret})]}];"]};quit();",?$].K(?'){"'^''"}}'"}@>)` np"],?&,?&]},'&(%d+)&',function (s)return~sJ.rep('Y',to
number(s))end);Z(x)".K( /[:"]/,":^0")}"`n`x4bT`x48`x58B`x59E~B`x59E)).size+1}x~i8]c"#{s.K(/[^"`n`t]/){"^%0 2`x58"%$&.ord}}^00"declare~ i32@puts(i8*)def!e~i32@
mX{%1=call~i32@puts(i8* getelementptr([#{i}x~i8],[#{i}x~i8]*@s,i32~0,i32~0))ret~i32~0})],?#].K(?',%('"'"')) }';for((i=0;i<${#t};i+=9 9));do;x=${t:$i:99};a~"^
"${x//[Y^`"]/Y^0}^".Z;" ~10;done;a~");";p(){~echo~-n~$1;};f(){~for~x~!~${s[*]};do;p~$3;for((j=$2;j--;));do ; h~$1~$x~$j;done;done; };p~k^`x60;h(){~p~^`x60$
{1:$(($2>>$3&1)):2};};f ~kki~7~'`x60`x60s`x60`x60s`x60`x60s`x60`x60s`x60`x60s`x60`x60s`x60`x60s`x60`x60s i' ;s=();a~'A G-`x 48-`x48Fy.IlD==;=j dlAy=;=jldltldltl{lAulAy
=jtlldlAyFy=?=jdlAyGFyF yG2AFy>zlAFFBCjldGyGFy>GFy.AGy=G==n`x48==nlldC=j@=jtlldltldlAut11';h(){~p~${1:$ ( ((($2%83-10)> >((2-$3)*2) )%4)):1};};f~sk i^`x60~3)]]}"""))]})A+="'
+`x21[]+'"+G.charCodeAt( E).toSJ(16);for(A+="^".replace(/'+`x21[]+'/g,^"%^")))')()",R=0;R<9;R++)A=A.re p lace(/'.*?'/g, function(B){T= [];fo r(E=1;B[E+1] ;)T.push(P[B[E++]]);retur
n~T.jo!('+')});console.l og('"'+A+'"'))).bytes{|n|r,z=z[n]||(b[r/78];b[r];q<6083&&z[n]=[q+=1,[]];t[ n] )};b[r/78];b[r]}";!t~i=0,n=0,q= 0;for(;++n<1 26;)c[n]= ""+(char)n;for(;i<#{a.size
};){q=q*78+(s.charAt(i)-1 3)%84;if(i++%2>0){y=q<n?c[q]:y;c[n++]=z+y.charAt(0);System.out.Z(z=c[q]) ;q=0 ;}}}})]}"`n!vokevirtual~#$T/Zln( L#{S}J;)V`nretur n`n.en d~method)+N]};H("DO,1<-#"||
*s);s?while~t:=ord(move(1) )do{i+:=1;u:=-i;every~0to~7do{u:=u*2+t%2;t/:=2};H("PLEASE")^(i%4/3);H ("DO,1SU B#"||i||"<-#"||((c-u)%256));c:=u ;};H("PLEASEREADOUT ,1^ nPLEASEGIVEUP");end)]};}}"].
tr(?"+B,"`x21`x7e")}'.tr(' `x7e`x21','Y`u0022')as~byte[]);z.close())]}"{"W""w"@j~1+:j^-~118%1 +*}%"/3551 2416612G61913@921/17A331513"t'");fim')]};})],B]}`n.e n dtemplate",61){"Zn#$S`n"},?%]
]}"`nquit)]});CloseStream(s );QUIT;"]}")]}"~DUP~A~."~DO~10~I=1,"~.~CR~S"~&A,&"~C~."~10~~~~~ ~CONTINUE"~CR~ S^"~&A)^",&"~C~0~DO~B~."~&char("~COUNT~.~."~),&'" ~CR~LOOP~S^"~&^"^""~C~S"~end~#
$D"~C~A~."~STOP"~CR~A~."~END "~CR~B`x59E~;~D~),B],?`x21].K(?',%('"'"'))}'"]};}".K(?"){'"3 4,"'}.K(N){'"10,"' }+?",?%]+'~""")'],?`x7e]}."]}"))]}]p['']pq"]} ");})}`x60);}"]}"))].K(?`x60,"Yx
60"),'#{f(',')}']})"]}"))["~~~ ~^"~^".""STOP~RUN."])](Zln(str"message(STATUS~^"~~~~~"( .replace(.replace(str ~s)"Y""YY")"^"""Y^"")"^")")))).reverse] })#$C($"Put~caffe!e~{(!t)c}~!to#$
F.^n");#$C("Liquify#$G.^nPour#$ G~!to~the~bak!g~dish.^n^nServes~1.^n");}})]};}/**** //****/";t={};b="";L=""; n=i=0;D=->n{L<<(n+62)%92+35;D}; s.bytes{|c|n>0?n-=1:(t[c]=(t[c]||[]
).reject{|j|j<i-3560};x=[];t[c].m ap{|j|k=(0..90).f!d{|k|not~s[i+1+k]==s[j+k]}| |91;k>4&&x<<[k,j]};x=x.max)? (n,j=x;x=b.size;(u =[x,3999].m!;D[u%87][u/87];L<<b[0,u];
b[0,u]="";x-=u)while~x>0;x=4001+i-j ;D[x%87][x/87][n-5]):b<<c;t[c]+=[i+=1]} ;"#!clude<stdio.h>`nchar*p=#{E[L]} ,s[999999],*q=s;!t~mX{!t~n,m;for(;*p;){
n=(*p-5)%92+(p[1]-5)%92*87;p+=2;if(n> 3999)for(m=(*p++-5)%92+6;m--;q ++)*q=q[4000-n];else~for(;n--;)*q++=*p ++;}puts(s)#{R}}")]}){s+="00g,";for(m=1;m
<256;m*=2)s+="00g,4,:"+(c/m%2>0?"4+":"" )+",";f(s);s="4 ,:,";}f(s+s);for(c:Base64.getDecoder().decod e("kaARERE`x58/I0ALn3n5ef6l/Pz8+fnz58/BOf5/7
/hE`x58/O`x5azM5mC`x58/Oczm`x5azBPn5+`x58/ OczMznBL/nM5m`x5azBPu++fPPOc5zngnnO`x5azO`x5agnBMG AW7A==")){c=c<0?256+c:c;for(i=0;i++<3;c/=8)f(c%
8);f("8*+8*+,");}f("@");).K(?',%('"'"'))}'|se d~-e's/Y/YY/g'~-e's/"/Yq/g'~-e's/.*/Z~"&"^nquit/')]}}"]], ?']}');".K(/^+/){"`x5e#{$&.size}`x5e"}]}.split("Y`x
5e");for(!t~i=1;i<a.length;a[0]+=a[i+1],i+=2){a[0] +="Y".repeat(Integer.parseInt(a[i]));}System.out.Z(a[0]);}})]}";F ORiTO`~UPBtDO`~INTn:=ABSt[i];Z(~(50+n%64)+c+~(50+n%8MOD
8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"]}")`nwhile(`x21=( S:length)0){`ntrans~c(S:read)`nD(c:to-!teger)`nf~35~39}`nf~24~149`n!terp:librar y"afnix-sio"`ntrans~o(afnix:sio:OutputTerm)`no:H~B)].K(N,'"&Ch
aracter'+?'+'Val(10)&"')}");end;)]+"`nsys.exit~0",B],?']}'",/[^{}]/]}}",35){y<<",`n"+$S;"%s"}}")+y],'",','):f("']}",0))}]]></#{U}></xsl:#{I}>"].K~N,'"&~VbLf~&"'}":s="~~~":For~i=0To~7:s~&=Chr(32-(Asc(c)>>7-i~And~1)*23):Next:#$C(s~&n~&Chr(9)&n~&"~~"
):Next:#$C(n~&n~&n):End~Sub:End~Module)]}`nput=s`nZ`nqa`x21",3){%($H("%s",#$S);)+N}}end~endmodule);W=s.size*72+4;"%d,%d"%[W/65536,W%65536]}});foreach(!t~c~!#{E[s]}.data)foreach(!t~v~!~a={0,9,7,4,5,c/100*7/6+1,c%100/10*7/6+1,c%10*7/6+1,7})p({144,v=
15450+v*256,384,v});p({255,12032});})]},i=0,t='k';while(s[i])t='^x60.'+s[i++]+t;console.log(t)",B],?`x21].K(?',%('"'"'))}'"^n::=^na")],/[`[`]$]/]}"),4){$S+?,}}])Console.H(s);Application.exit();}})]};Z"0~0~-1");)],?']}';cr",127..255];f(%(variable~s
=`x60#{s.K(/.{1,234}/){$&.K("`x60",%(`x60+"`x60"+`x60))+"`x60+`n`x60"}}`x60,i;for(i=0;i<129;i++)s=strreplace(s,pack("C",255-i),substrbytes(`x60#{v[0,99]}`x60+`n`x60#{v[99..-1]}`x60,i*2+1,2));Zf("%s",s)),7){"f('%s')`n"%$s.unpack("`x48*")}}Zf("^n#[E
xeunt]");quit)]}")),196){%(Z#$S;)}}}"]});})).gsub(/[!HJKXYZ^`~]/){[B*2,:write,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_futu
#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffe
#################################################################################### Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke ###################################################################################)
Comments
I think the fact that it is so obtuse is a really good starting point! I read this code the same way I read something written in an esoteric language (which is to say I take a glance, say "no thanks", and stop trying to put together what it's doing). That looks like an aesthetic choice, given the context of paradoxes it evokes the aesthetics of paradox as well.
A quine in programming is named for the mathematician WV Quine, who wrote some philosophy on paradoxes. He proposed three types of logical paradox: veridical, falsidical, and antinomy. A veridical paradox follows internally consistent logic that doesn't at first make sense (the canonical example is the monty hall problem), a falsidical paradox features a flaw in logic to arrive at an unexpected conclusion (such as zeno's paradoxes), and an antinomy is one that features an internal contradiction (this statement is false).
Antinomies are what's going to be interesting to us here. The thing that distinguishes them from general contradictory statements is that they're self-referential. The term quine, as it refers to computing, was coined by Douglass Hofstadter in Gödel, Escher, Bach, where the through-line is making connections between computing, self-referential logic, and cognition. One of the big ideas proposed in the book is the strange loop, which is where something moves between levels through a hierarchical system to eventually arrive back at the starting place (such as shepard tones or penrose stairs).
The reason quines are relevant in his discussion of strange loops is because they are a form of programmatic strange loop, moving between levels of code processing (which deserves to be unpacked further, but I lack the time right now). This program also features the outline of an ouroboros, evoking imagery of a strange loop, in the negative space between written code. That in itself calls to a chapter of Hofstadter's on figure/ground relationships, maybe there's more on how this program calls attention to figure and ground upon further examination.
There's a fundamental trick to quines which is to produce the entire program text as an output; typically, that requires reconstructing the whole program text as a string (including any code that constructs that string, plus the output of the string). That's tough enough in itself - the basic idea is expanding a template that has a placeholder for itself within it. (There are a handful of reasonable "how to write a quine" articles knocking around.)
I've not looked closely but I suspect the rest comes down to repeated functions on that target string.
Suppose you have a program in a language, R, that can output its own source code (whatever that source code is). That means that your program will construct a string containing its own code.
In R, you can write a function which, given a string, outputs a program in language S that outputs that string.
Then instead of your one-language quine reading like this:
it becomes something like this:
if you run this, you'll get a program in S as output that'll produce the program text in R.
Once you've done this once, the construction becomes:
The most impressive part of this is fitting the definition of all those intermediate functions into such a small space.
Run this, you'll get a program in S thats basically a large print statement; run that, you get somewhat smaller output in T that prints out a program in U, and so on.
(This would be my guess what's going on here.)
Incidentally, no mention of quines is complete without a reference to Kernighan's "Reflections on Trusting Trust" which is arguably the supreme exposition on this theme.
This is an absolutely astonishing work. Endoh is committed to keeping the languages in alphabetical order (beginning and ending with Ruby), which means he can't group languages by similarity. According to Endoh, the hardest transitions were Befunge to BLC8 to brainfuck, as they are all esoteric. And at this point the new languages added are mostly esoteric. But even apart from that, as it builds in sheer number of languages, each new addition is more challenging than the last, as it could potentially affect any of the other languages previously added. You can see this by looking at individual git commits for the language additions and see how it scatters throughout the program. For example, in this commit he replaces Flex with Fish, and it involves changes on every line of code (you'll need to "load diff" on QR.rb to see it). How he keeps this all straight is a mystery to me.
The "every line diff" is largely an artifact of rescaling the program. (Eg, cf. the first line and start of second in the "before" with the longer first line in the "after".)
The other thing that's going on here is that the program's authored in a more maintainable fashion, then post-processed to produce the final script. That's why there's such diff churn. The diff in code-gen-pool makes more apparent the fact that that change is relatively localised.
(It also demonstrates the trick I suggested above: the
fish
converter is a singleecho
and a transformation on the input string - in this case, applying a special case transformation to any single-quote characters in it, atop some "standard" quoting of metacharacters.)I should add: demystifying what's going on shouldn't be seen as taking anything away from the achievement here*. The use of metaprogramming to convert a more maintainable codebase into the final artistic artifact is in itself a pretty cute trick.
(* That being said, I think the "radiation-hardened" quine is technically a more impressive achievement.)
I appreciate that clarification, @jang; and yes, some demysification is necessary to really appreciate the work.