Skip to content

Commit

Permalink
* add a script to generate lazyk boot code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Nov 2, 2015
1 parent 48f8bdb commit ab3a26b
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 153 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/tmp
!QR.rb
gst.im
/src/lazyk-boot.dat
*.sw*
40 changes: 20 additions & 20 deletions QR.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@
.K(?' ){"'^''"}}'"].K(/[:"]/,":^0"),/[~Y`t;"(){}`[`]]/]}"~PR~"`x4bT`x48`x58B`x59E~B`x5 9E )).size+1} x~i8 ]c"#{s.K(/[^"]/){" ^%`x58
"%$&. ord}}^00"declare~i32@puts(i8*)def!e~i32@mX{%1=call~i32@puts(i8*getelementptr([# { i}x~i8]*@s,i3 2~0,i32~0)) ret~i32~0});s.s ize/99}
]{s=su bstr(#{E[s]},i*99,99);g=[Global()];replace("YY","YY",s,g);replace("^"","Y^"", s ,g);t+="^""+s+ "^".Z;^n";}put Str(" k"+b);for~c~ !~array
(t+"); "){d=rep(b+b+"s",8)+"i";for~j~![0..6]d+=b+substr("kki",c>>(6-j)&1,2);putSt r( d);}for~c~!~array("AG-`x48-`x48 Fy.IlD==;=jd lAy=;=jld ltldltll
dlAyFy= ?==;=?-A=j@?zlAlldClldGFy.lAuGFyFy=;=jtlAyFy=?==;=?-{==nAGy==-1AFy>=?yll dCzl ldltldlAut11"){for~i~![0..2]putS tr(substr("ski"+ b,c%83 -10>>i*2&
3,1));}} )]]]};typeof~Z=='function'?Z(s):console.log('%s',s)").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;fo r(;++n<126;)c[n]=""+(char)n;for(;i<#{a.size};){q=q*78+(s.charAt(i) -13)%84;if (i++%2>0){y=q<n?c[q]:y;c[n++]=z+y.charAt(0);System.o u t.Z(z=c[q])
;q=0;}}}} )]}"`n!vokevirtual~#$T/Zln(L#{S}J;)V`nreturn`n.end~method)+N]}; H("DO,1<-#"||* s);s?while~t:=ord(move(1))do{i+:=1;u:=-i;every~0t o~7do{u:=u*2
+t%2;t/:=2 };H("PLEASE")^(i%4/3);H("DO,1SUB#"||i||"<-#"||((c-u)%256));c :=u;};H("PLEASEREA DOUT,1^nPLEASEGIVEUP");end)]};}}"].tr(B,?&),5 1){%(show~"Z'#
{e[$s].K~B+? ",%("~"^q"~")}'.tr('&','YY');"`n)}]]}^`");fim")})],62){ "Zn#$S`n"}]});CloseSt ream(s);QUIT;"]}")]}"~DUP~FOR~S"~&A,&"~ C~NE`x58T~S^"~&
A)^",&"~C~0~D O~B~."~&char("~COUNT~.~."~),&'"~CR~LOOP~S^"~&^"^""~ C~S"~end~#$D"~C~A~."~STO P"~CR~A~."~END"~CR~B`x59E~;~D~) .K(?"){'"34,"'}+?
"]],?%]]}."]}") ),15){"Pr!t#$S;"}}}}"}]pq"]};}"]}"))],'#{f(', ')}']})"]}"))["~~~~^"~^".""S TOP~RUN."])](Zln(s tr"#{g*8}"s)))).rev
erse]}))]};}}"]}; }"]}/****//****/";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].map{|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]} ;"d=#{Q[E[L]]};s='';while~0<len(d):`n~x~as~!t,y~as ~!t=d;i=3;if(n=(x-5)%92+(y-5)
%92*87)>3999:`n~~for~_~!~ra nge(((d[2]cast~!t-5)%92+6)):s+=s[len(s)+4000-n]`n~else:s+ =d[2:i=n+2]`n~d=d[i:]`na=0;for~i~
!~range(len(s)):b~as~!t=s[i];a-= b;Z(('+'*-a~if~0>a~else'-'*a)+'.');a=b").tr~B,?`x21]};K(/`x21/,"Y ",s);for(Z"def!e~void~f(n){^"00g,^";f
or(m=128;m;m/=2){^"00g,4,:^";if(n/m%2< 1)^"4+^";^",^";};^"4,:,^"}^"389**6+44*6+00p29*,^";";++j<=length(s);Z"f("n");")f or(n=9;substr(s,j,1)`x21=sZf("%c",++n););Z"^
"4,:,@^"^nquit"})]],?']}');"]}";FORiTO`~UPBtDO`~INTn:=ABSt[i];Z(~(50+n%64)+c+~(50+n%8MOD8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"]}")]}");end;)]+"`nsys.exit~0",/[^{}]/]}}",35){y<<",`n"+$S;"%s"}}")+y}]]></#{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),3){%($H("%s",#$S);)+N}}end~endmodule)],?%]+R}}".reverse],/[
`[`]$]/],"[f~",?]]}"~^x60.&]k^n::=^na)]};Z"0~0~-1";)]]};",?']}';cr"]]]}"|sed~-E~-e~'s/([`x5eY]|Y.){1,120}/Zf("%s","^0");^n/g'],7){%(Zf("%s","#{d[d[$s],?']}")`n)}}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_future_bug_fixes_#_buffer_for_fu
(t+"); "){d=rep(b+b+"s",8)+"i";for~j~![0..6]d+=b+substr("kki",c>>(6-j)&1,2);putSt r( d);}for~c~!~array("AG-`x48-`x48 Fy.IlD==;=jd lAy=;=jld ltldltl{
lAulAy= jtlldlAyFy=?=jdlAyGFyFyG2AFy>zlAFFBCjldGyGFy>GFy.AGy=G==n`x48==nlldC=j@= jtll dltldlAut11"){for~i~![0..2]putSt r(substr("ski"+b ,c%83- 10>>i*2&3
,1));}}) ]]]};typeof~Z=='function'?Z(s):console.log('%s',s)").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<126;)c[n]=""+(char)n;for(;i<#{a.size};){q=q*78+(s.charAt(i)- 13)%84;if( i++%2>0){y=q<n?c[q]:y;c[n++]=z+y.charAt(0);System.ou t .Z(z=c[q]);
q=0;}}}}) ]}"`n!vokevirtual~#$T/Zln(L#{S}J;)V`nreturn`n.end~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,1SUB#"||i||"<-#"||((c-u)%256));c: =u;};H("PLEASEREAD OUT,1^nPLEASEGIVEUP");end)]};}}"].tr(B,?&),51 ){%(show~"Z'#{
e[$s].K~B+?" ,%("~"^q"~")}'.tr('&','YY');"`n)}]]}^`");fim")})],62){" Zn#$S`n"}]});CloseStr eam(s);QUIT;"]}")]}"~DUP~FOR~S"~&A,&"~C ~NE`x58T~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~). K(?"){'"34,"'}+?"
]],?%]]}."]}")) ,15){"Pr!t#$S;"}}}}"}]pq"]};}"]}"))],'#{f(',' )}']})"]}"))["~~~~^"~^".""ST OP~RUN."])](Zln(st r"#{g*8}"s)))).reve
rse]}))]};}}"]};} "]}/****//****/";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].map{|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%8 7][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]}; "d=#{Q[E[L]]};s='';while~0<len(d):`n~x~as~!t,y~as~ !t=d;i=3;if(n=(x-5)%92+(y-5)%
92*87)>3999:`n~~for~_~!~ran ge(((d[2]cast~!t-5)%92+6)):s+=s[len(s)+4000-n]`n~else:s+= d[2:i=n+2]`n~d=d[i:]`na=0;for~i~!
~range(len(s)):b~as~!t=s[i];a-=b ;Z(('+'*-a~if~0>a~else'-'*a)+'.');a=b").tr~B,?`x21]};K(/`x21/,"Y" ,s);for(Z"def!e~void~f(n){^"00g,^";fo
r(m=128;m;m/=2){^"00g,4,:^";if(n/m%2<1 )^"4+^";^",^";};^"4,:,^"}^"389**6+44*6+00p29*,^";";++j<=length(s);Z"f("n");")fo r(n=9;substr(s,j,1)`x21=sZf("%c",++n););Z"^"
4,:,@^"^nquit"})]],?']}');"]}";FORiTO`~UPBtDO`~INTn:=ABSt[i];Z(~(50+n%64)+c+~(50+n%8MOD8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"]}")]}");end;)]+"`nsys.exit~0",/[^{}]/]}}",35){y<<",`n"+$S;"%s"}}")+y}]]></#{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),3){%($H("%s",#$S);)+N}}end~endmodule)],?%]+R}}".reverse],/[`
[`]$]/],"[f~",?]]}"~^x60.&]k^n::=^na)]};Z"0~0~-1";)]]};",?']}';cr"]]]}"|sed~-E~-e~'s/([`x5eY]|Y.){1,120}/Zf("%s","^0");^n/g'],7){%(Zf("%s","#{d[d[$s],?']}")`n)}}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_future_bug_fixes_#_buffer_for_fut
################################################################## Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke #################################################################)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ I used the following Ubuntu deb packages to test this program.
| |iconx |9.4.3-4.2ubuntu1
65 |INTERCAL |intercal |29:0.29-3
66 |Jasmin |jasmin-sable |2.4.0-5
67 |Java |openjdk-6-jdk |6b36-1.13.8-0ubuntu1~15.04.1
67 |Java |openjdk-6-jdk |6b35-1.13.7-1ubuntu1
68 |JavaScript |rhino |1.7R4-3
69 |Julia |julia |0.3.2-1ubuntu1
70 |Kaya |kaya |0.4.4-6.2
Expand All @@ -271,10 +271,10 @@ I used the following Ubuntu deb packages to test this program.
88 |Parrot asm |parrot |6.6.0-1
89 |Pascal |fp-compiler |2.6.4+dfsg-4
90 |Perl |perl |5.20.2-2
91 |PHP |php5-cli |5.6.4+dfsg-4ubuntu6.3
91 |PHP |php5-cli |5.6.4+dfsg-4ubuntu6
92 |Piet |*N/A* |-
93 |Pike |pike7.8 |7.8.866-3
94 |PostScript |ghostscript |9.15+dfsg-0ubuntu2.1
94 |PostScript |ghostscript |9.15+dfsg-0ubuntu2
95 |PPT (Punched tape) |bsdgames |2.17-22
96 |Prolog |swi-prolog |6.6.6-5
97 |Python |python |2.7.9-1
Expand Down
Loading

0 comments on commit ab3a26b

Please sign in to comment.