Skip to content

Commit

Permalink
* the 58th language: Ook!
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Nov 12, 2014
1 parent bbb858b commit 308d144
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 142 deletions.
40 changes: 24 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -415,34 +415,42 @@ QR.octave: QR.ml
@echo
ocaml QR.ml > QR.octave

QR.gp: QR.octave
QR.ook: QR.octave
@echo
@echo "#############################"
@echo "## 46: Octave -> PARI/GP ##"
@echo "#############################"
@echo "##########################"
@echo "## 46: Octave -> Ook! ##"
@echo "##########################"
@echo
octave -qf QR.octave > QR.ook

QR.gp: QR.ook
@echo
@echo "###########################"
@echo "## 47: Ook! -> PARI/GP ##"
@echo "###########################"
@echo
octave -qf QR.octave > QR.gp
ruby vendor/ook.rb QR.ook > QR.gp

QR.pasm: QR.gp
@echo
@echo "#################################"
@echo "## 47: PARI/GP -> Parrot asm ##"
@echo "## 48: PARI/GP -> Parrot asm ##"
@echo "#################################"
@echo
gp -f -q QR.gp > QR.pasm

QR.pas: QR.pasm
@echo
@echo "################################"
@echo "## 48: Parrot asm -> Pascal ##"
@echo "## 49: Parrot asm -> Pascal ##"
@echo "################################"
@echo
parrot QR.pasm > QR.pas

QR.pl: QR.pas
@echo
@echo "##########################"
@echo "## 49: Pascal -> Perl ##"
@echo "## 50: Pascal -> Perl ##"
@echo "##########################"
@echo
fpc QR.pas
Expand All @@ -451,63 +459,63 @@ QR.pl: QR.pas
QR.php: QR.pl
@echo
@echo "#######################"
@echo "## 50: Perl -> PHP ##"
@echo "## 51: Perl -> PHP ##"
@echo "#######################"
@echo
perl QR.pl > QR.php

QR.png: QR.php
@echo
@echo "#######################"
@echo "## 51: PHP -> Piet ##"
@echo "## 52: PHP -> Piet ##"
@echo "#######################"
@echo
php QR.php > QR.png

QR.pike: QR.png
@echo
@echo "########################"
@echo "## 52: Piet -> Pike ##"
@echo "## 53: Piet -> Pike ##"
@echo "########################"
@echo
vendor/npiet-*/npiet QR.png > QR.pike

QR.prolog: QR.pike
@echo
@echo "##########################"
@echo "## 53: Pike -> Prolog ##"
@echo "## 54: Pike -> Prolog ##"
@echo "##########################"
@echo
pike QR.pike > QR.prolog

QR.py: QR.prolog
@echo
@echo "############################"
@echo "## 54: Prolog -> Python ##"
@echo "## 55: Prolog -> Python ##"
@echo "############################"
@echo
swipl -q -t qr -f QR.prolog > QR.py

QR.R: QR.py
@echo
@echo "#######################"
@echo "## 55: Python -> R ##"
@echo "## 56: Python -> R ##"
@echo "#######################"
@echo
python QR.py > QR.R

QR.rexx: QR.R
@echo
@echo "#####################"
@echo "## 56: R -> REXX ##"
@echo "## 57: R -> REXX ##"
@echo "#####################"
@echo
R --slave < QR.R > QR.rexx

QR2.rb: QR.rexx
@echo
@echo "########################"
@echo "## 57: REXX -> Ruby ##"
@echo "## 58: REXX -> Ruby ##"
@echo "########################"
@echo
rexx ./QR.rexx > QR2.rb
Expand Down
108 changes: 54 additions & 54 deletions QR.rb
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
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}};Q=->s,t=?${s.K(t){B+$&}};M=->s{"<stdio.h>#{N}!t~mX{puts#{E[s]};return~0;}"};V=->s,a,z{s.K(/(#{B*
4})+/){a+"#{$&.size/2}"+z}};$D="program~QR"; %(objec t~QR~ext ends~App{Z#{E[%((display~"#{e[%(Zf~%s~"#{Q[e["Transcr
ipt~show:~'#{d[%(proc~f~{n}~{sJ~rep eat~" Y"~$ n}~; puts~[reK~-all~{.}~"#{V[Q[e[%[!t~mX{sJ~s=#{E[%(with~Ad
a.Text_Io;procedure~qr~is~beg!~Ad a.T e xt_Io.Put_L!e("#{d[%(Z("#{d[%(BEGIN{s=#{E[%(f
={n~as~!t|'Y'*n};a=0;s=#{ V[Q[E [ "#!clude"+M["#!clude<iostream>`n!t~mX{std::cou
t<<#{E[%(class~Program{p ubl ic~static~void~MX{System.Console.Wri
te(#{E[%((doseq[s(lazy- c at["IDENTIFICATION~DIVISION.""PROGRAM
-ID.~QR.""PROCEDURE~DI VISION."'DISPLA`x59](map~#(str
"~~~~^""(.replace%1"^ """^"^"")"^"&")(re-seq~#".{1,45
}""#{e[%((f=(n)->Arr ay(n+1).jo!~"Y");console.l
og("%s",#{V[E[%((H- l!e"#{e[%(~:~A~."#{g*9}"~;~
:~B~A~."~WRITE(*, *)'"~A~;~ :~C~B~T`x59PE~."~'"~CR~
;~:~D~S"~#$D"~C ~S^"~Z~^"(&"~C~S^"~#{e[%( package~ma!;import"fmt";
func~mX{fmt.Pr !t#{E[%(Z'#{e[("ma!=putStr"+E[%(pr ocedure~mX;i:=c:=0;s:=#
{E[%(.class~ public~QR`n.super~#{$T="java/io/Pr!tStrea m"}`n.method~public~s
tatic~ma!([ L#{S="java/lang/"}SJ;)V~;]`n.limit~stack~2`nge tstatic~#{S}System/o
ut~L#$T;`n ldc~"#{e[%(class~QR{public~static~void~ma!(SJ[]v){ SJ~c[]=new~SJ[8000]
,y="",z=y ,s="#{z=t=(0..r=q=126).map{|n|[n,[]]};a="";b=->n{a<<( n%78+55)%84+42};(%
(@s=glob al[#{i=(s=%(PR~"`x48AI^~1.2~PR~"VISIBLE^~"#{Q["Z"+E[%(al l:`n`t@echo~'#{d[
Q["l!el :99999;Z#{E[%(.assem bly~t{}.method~static~void~MX{.entrypo !t~ldstr"#{e[%(m:
db`x60# {e[s="$Z#{E[%(Zf#{E[ "require('util').Z#{E["#import"+M["Z_sJ "+E["Zf"+E["Z#{E
[%(say "#{e["#$D(output);be g !~H(#{((p="eval";%($_="#{s=%(<?php~func tion~f($n){retu
rn~str _repeat("Y",$n);};$f ="f ";$z=3+$w=strlen($s=#{V[Q[E["!t~mX{H#{ E["qr:-H('#{Q[e
[%(for ~l ~!#{E[e[d[%(eval$s=% q(#$s ))]]]}.split("Yn"):Z('cat("say~Y"'+l+' Y"Yn")'))],?']
}')."] };return~0;}"]],"{$f (",")}" ]})*3;echo"^x89PNG^r^n^x1a^n";$m="";$t ="^xc0^0^xff";
for($i= -1;$i<12 8*$z;$m.=$c--?($w-$c||$i> $z)&&$i/$z<($c
<$w?ord( $s[ (!t)($c/3) ]):$c-- %3+2)?$t[2].$ t[$c%3% 2].$t[$c%3]:"^0^0^0":"^0")$ c=++$i%$z;fore
ach(array ("I`x48DR".pack( "NNCV ",$w+2,128,8,2) ,"IDA T".gzcompress($m),"IEND")as$ d)echo~pack("N
A*N",strlen( $d)-4,$d,crc32($d) );? >);(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,c h r$n-!t($n/32)*6-41),2|eg;Z~pac k"B*",$_).scan
(/[~,-:A-z]+|(.)/) {p="s++#{$1?"chr ~#{$1.ord}+e":$&+?+}; "+p};p)).K(/.{1,255}/){|s|"'#{s }',"}}'')end."
]}"`nend)]};quit"+ N]]]]}"]})+N]}; " +N]}`x60`nglobal~_s t art`n_start:mov~edx,#{s. s ize}`nmov~ecx,
m`nmov~ebx,1`nmov~ eax,4`n!t~128 `nm ov~ebx,0`nmov~eax ,1` n!t~128)]}"c a l l~void~[msco
rlib]System.Console ::Write(sJ)r et})] };quit();",B],? $].K( ?'){%('" ' " ')}}')].K(/
[:"]/,":^0"),/[~Y`t ;"(){}`[`] ]/]}"~P R~"`x4bT`x48` x58B`x5 9E~B`x59E)).si z e +1}x~i8]c"
#{s.K(/[^"]/){"^%`x5 8"%$&.ord }}^00"declar e ~ i32@puts(
i8*)def!e~i32@mX{%1= call~i32@puts(i8*gete lementp tr([#{i}x~i8]*@s,i32~0,i3 2~0))ret ~ i 32~0})).b
ytes{|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<s.len gth ();){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.out. Z (z=c[q]);q=0;}}}})]}"`n!vokevirtual~ # $T/Zln(L
#{S}SJ;)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)%2
56));c:=u;};H("PLEASEREADO UT,1^nPLEASEGIVEUP");end)]).tr(B,?&)]}'.tr('&','YY') ;)]};}) ]}"~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"~C R~A~."~END"~CR~B`x59E~;~D~)]}"))],'#{f(',' )}']}))]}"))["~~~~^ "~^".""
STOP~RUN."])](Zln(str"#{g*8}"s) ))).tr~B,?`x7e]}.Replace("`x7e","Y") );}})]};}"]]],"$(f("," ))"]};
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);Z~s})]}"))]}");end~q r;)]};!t~i,j; Z("module~QR;!itial~beg!~");for(i=0
;i<s.length;i++){Z("$H(^"~~~");for(j=6;j >=0;j--)Z((s[i]>>j)%2>0?"Yt":"~");Z("Y
nYtYn~~^`");");}Z("$display(^"YnYn^");end~en dmodule");return~0;}].reverse],/[`[`]$]/],"
[f~",?]]}"~^x60.&]k),?']}';cr"]]}")]}"))]};})).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_fut
###################### Quine Relay -- Copyright (c) 2013 Yusuke Endoh (@mametter), @hirekoke #####################)
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}};Q=->s,t=?${s.K(t){B+$&}};M=->s{"<stdio.h>#{N}!t~mX{puts#{E[s]};return~0;}"};V=->s,a,z{s.K(/(#{B*4})+/){a
+"#{$&.size/2}"+z}};$D="program~QR";%(object~Q R~exten ds~App{Z #{E[%((display~"#{e[%(Zf~%s~"#{Q[e["Transcript~show:~'#
{d[%(proc~f~{n}~{sJ~repeat~"Y"~$n}~;p uts~[ reK~ -all ~{.}~"#{V[Q[e[%[!t~mX{sJ~s=#{E[%(with~Ada.Text_Io;proced
ure~qr~is~beg!~Ada.Text_Io.Put_L!e( "#{ d [%(Z("#{d[%(BEGIN{s=#{E[%(f={n~as~!t|'Y'*n};a=0
;s=#{V[Q[E["#!clude"+M["#!c lude< i ostream>`n!t~mX{std::cout<<#{E[%(class~Program{p
ublic~static~void~MX{Syste m.C onsole.Write(#{E[%((doseq[s(lazy-cat["
IDENTIFICATION~DIVISION." " PROGRAM-ID.~QR.""PROCEDURE~DIVISION."'D
ISPLA`x59](map~#(str"~~~ ~^""(.replace%1"^"""^"^"")"^"&")
(re-seq~#".{1,45}""#{e[ %((f=(n)->Array(n+1).jo!~"Y");con
sole.log("%s",#{V[E[%( (H-l!e"#{e[%(~:~A~."#{g*9}"~
;~:~B~A~."~WRITE(*,*) '"~A~;~:~C~B~T`x59PE~."~'"~CR
~;~:~D~S"~#$D"~C~S^ "~Z~^"(&" ~C~S^"~#{e[%(package~ma!;
import"fmt";func~ mX{fmt.Pr!t#{E[%(Z'#{e[(" ma!=putStr"+E[%(procedure~
mX;i:=c:=0;s:=#{ E[%(.class~public~QR`n.super~#{$T= "java/io/Pr!tStream"}`n.m
ethod~public~s tatic~ma!([L#{S="java/lang/"}SJ;)V~;]`n.l imit~stack~2`ngetstatic
~#{S}System/o ut~L#$T;`nldc~"#{e[%(class~QR{public~static~vo id~ma!(SJ[]v){SJ~c[]=n
ew~SJ[8000], y="",z=y,s="#{z=t=(0..r=q=126).map{|n|[n,[]]};a="" ;b=->n{a<<(n%78+55)%8
4+42};(%(@s =global[#{i=(s=%(PR~"`x48AI^~1.2~PR~"VISIBLE^~"#{Q["Z "+E[%(all:`n`t@echo~
'#{d[Q["l! el:99999;Z#{E[%(.assembly~t{}.method~static~void~MX{.ent rypo!t~ldstr"#{e[%(
m:db`x60# {e[s="$Z#{E[%(Zf#{E[ "require('util').Z#{E["#import"+M["Z_s J"+E[%(s=toascii#{E
["Z#{E[%( say"#{e["#$D(output) ;beg!~H(#{((p="eval";%($_="#{s=%(<?php~ function~f($n){ret
urn~str_ repeat("Y",$n);};$f= " f";$z=3+$w=strlen($s=#{V[Q[E["!t~mX{H#{ E["qr:-H('#{Q[e[%
(for~l~! #{E[e[d[%(eval$s=%q( #$s ))]]]}.split("Yn"):Z('cat("say~Y"'+l+' Y"Yn")'))],?']}')
."]};ret ur n~0;}"]],"{$f(",")}" ]})*3 ;echo"^x89PNG^r^n^x1a^n";$m="";$t="^xc 0^0^xff";for($i=
-1;$i<12 8*$z;$m.=$c--?($w-$c ||$i>$z )&&$i/$z<($c<$w?ord($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".p ack ("NNCV",$w +2,128, 8,2),"IDAT".g zcompre ss($m),"IEND")as$d)echo~pac k("NA*N",strlen(
$d)-4,$d,cr c32($d));?>);(s+ N*(-s .size%6)).unpac k("B* ")[0].K(/.{6}/){n=$&.to_i~2; ((n+14)/26*6+n+4
7).chr}}";s|.| $n=ord$&;substr~un pac k(B8,chr$n-!t($n/ 32) *6-41),2|eg;Z~pack"B*",$_).sc an(/[~,-:A-z]+|(
.)/){p="s++#{$1?"chr ~#{$1.ord}+e":$ & +?+};"+p};p)).K(/.{ 1 ,255}/){|s|"'#{s}',"}}'')end." ]}"`nend)]};quit
"]};t=num2cell(b=11- ceil(s/13));for~ n=1:9m={};for~i=1:141 f=@(x,y,n)repmat(["Ook"~x~"~Ook "~y~32],[1~abs(n
)]);m(i)=[f(z=46,63, n)~f(q=z-(i<13) * 13,q,i-13)~f(33,z,1 ) ~f(63,z,n)];end;t(x)=m(d i ff([0~s(x=b==n)]
)+13);end;Zf(strjo!( t,"")))]]]}"] })+ N]};"+N]}`x60`ngl oba l~_start`n_s t a rt:mov~edx,#{s
.size}`nmov~ecx,m`nmo v~ebx,1`nmov ~eax, 4`n!t~128`nmov~ ebx,0 `nmov~ea x , 1`n!t~128)]}"
call~void~[mscorlib]S ystem.Cons ole::Wr ite(sJ)ret})] };quit( );",B],?$].K(? ' ) {%('"'"')}}'
)].K(/[:"]/,":^0"),/[~ Y`t;"(){} `[`]]/]}"~PR ~ " `x4bT`x48`x
58B`x59E~B`x59E)).size +1}x~i8]c"#{s.K(/[^"] /){"^%` x58"%$&.ord}}^00"declare~ i32@puts ( i 8*)def!e~i3
2@mX{%1=call~i32@puts(i 8*getelementptr([#{i} x~i8] *@s,i32~0,i32~0))ret~i32~0})).byte s { |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<s.leng th();){q=q*78+(s.char A t(i)-13)%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}SJ;)V`nre t urn`n.end
~method)+N]};H("DO,1<-#"||* s);s?while~t:=ord(mo ve(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("PLEAS EREADOU T,1^nPLEA
SEGIVEUP");end)]).tr(B,?&)]}'. tr('&','YY');)]};})]}"~DUP~FOR~S"~&A,&"~C~NE`x58 T~S^"~&A) ^",&"~C~0
~DO~B~."~&char("~COUNT~.~."~),& '"~CR~LOOP~S^"~&^"^""~C~S"~end~#$D"~C~A~." ~STOP"~CR~A~."~END" ~CR~B`x59
E~;~D~)]}"))],'#{f(',')}']}))]}") )["~~~~^"~^".""STOP~RUN."])](Zln(str "#{g*8}"s)))).tr~B,?`x 7e]}.Rep
lace("`x7e","Y"));}})]};}"]]],"$(f(" ,"))"]};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);Z~s})]}"))]}");end~qr;)]};!t~i,j
;Z("module~QR;!itial~beg!~");for(i=0;i<s.l ength;i++){Z("$H(^"~~~");for(j=6;j>=0;j-
-)Z((s[i]>>j)%2>0?"Yt":"~");Z("YnYtYn~~^`");") ;}Z("$display(^"YnYn^");end~endmodule");retur
n~0;}].reverse],/[`[`]$]/],"[f~",?]]}"~^x60.&]k),?']} ';cr"]]}")]}"))]};})).gsub(/[!HJKXYZ^`~]/){[B*2,:wri
te,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fi
######################## Quine Relay -- Copyright (c) 2013 Yusuke Endoh (@mametter), @hirekoke #######################)
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This is a Ruby program that generates
Scala program that generates
Scheme program that generates
...(through 57 languages in total)...
...(through 58 languages in total)...
REXX program that generates
the original Ruby code again.

Expand Down Expand Up @@ -90,7 +90,8 @@ If you could do it, please let me know. Good luck.
$ nodejs QR.js > QR.m
$ gcc -o QR QR.m && ./QR > QR.ml
$ ocaml QR.ml > QR.octave
$ octave -qf QR.octave > QR.gp
$ octave -qf QR.octave > QR.ook
$ ruby vendor/ook.rb QR.ook > QR.gp
$ gp -f -q QR.gp > QR.pasm
$ parrot QR.pasm > QR.pas
$ fpc QR.pas && ./QR > QR.pl
Expand Down Expand Up @@ -169,17 +170,18 @@ For other languages, I used the following deb packages:
44 |Objective-C |gobjc |4:4.8.2-1ubuntu6
45 |OCaml |ocaml |4.01.0-3ubuntu3
46 |Octave |octave |3.8.1-1ubuntu1
47 |PARI/GP |pari-gp |2.5.5-1
48 |Parrot asm |parrot |5.9.0-1build1
49 |Pascal |fp-compiler |2.6.2-8
50 |Perl |perl |5.18.2-2ubuntu1
51 |PHP |php5-cli |5.5.9+dfsg-1ubuntu4.4
52 |Piet |(none) |-
53 |Pike |pike7.8 |7.8.700-7
54 |Prolog |swi-prolog |6.6.4-2ubuntu1
55 |Python |python |2.7.5-5ubuntu3
56 |R |r-base |3.0.2-1ubuntu1
57 |REXX |regina-rexx |3.6-2
47 |Ook! |(none) |-
48 |PARI/GP |pari-gp |2.5.5-1
49 |Parrot asm |parrot |5.9.0-1build1
50 |Pascal |fp-compiler |2.6.2-8
51 |Perl |perl |5.18.2-2ubuntu1
52 |PHP |php5-cli |5.5.9+dfsg-1ubuntu4.4
53 |Piet |(none) |-
54 |Pike |pike7.8 |7.8.700-7
55 |Prolog |swi-prolog |6.6.4-2ubuntu1
56 |Python |python |2.7.5-5ubuntu3
57 |R |r-base |3.0.2-1ubuntu1
58 |REXX |regina-rexx |3.6-2

Note: `CC=tcc ick -bfO` may be used to compile INTERCAL sources
with less memory.
Expand Down
Binary file modified langs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 22 additions & 5 deletions src/code-gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,28 @@ class PARIGP < CodeGen
Code = %q("print#{E[PREV]};quit")
end

class Octave < CodeGen
File = "QR.octave"
Cmd = "octave -qf QR.octave > OUTFILE"
Apt = "octave"
Code = %q("printf"+E[PREV+N])
class Octave_Ook < CodeGen
Name = ["Octave", "Ook!"]
File = ["QR.octave", "QR.ook"]
Cmd = ["octave -qf QR.octave > OUTFILE", "ruby vendor/ook.rb QR.ook > OUTFILE"]
Apt = ["octave", nil]
def code
<<-'END'.lines.map {|l| l.strip }.join
%(
s=toascii#{E[PREV]};
t=num2cell(b=11-ceil(s/13));
for n=1:9
m={};
for i=1:141
f=@(x,y,n)repmat(["Ook" x " Ook" y 32],[1 abs(n)]);
m(i)=[f(z=46,63,n) f(q=z-(i<13)*13,q,i-13) f(33,z,1) f(63,z,n)];
end;
t(x)=m(diff([0 s(x=b==n)])+13);
end;
printf(strjoin(t,""))
)
END
end
end

class OCaml < CodeGen
Expand Down
Loading

0 comments on commit 308d144

Please sign in to comment.