Skip to content

Commit

Permalink
Do compression in eC
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Apr 14, 2017
1 parent c2f32b9 commit b6346c5
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 153 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ QR.chef: QR.cd
@echo "## 36: CDuce -> Chef ##"
@echo "#########################"
@echo
cduce QR.cd > QR.chef
ulimit -s unlimited && cduce QR.cd > QR.chef

QR.clj: QR.chef
@echo
Expand Down
98 changes: 49 additions & 49 deletions QR.rb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Then, build the bundled interpreters.

#### 2. Run each program on each interpreter/compiler.

$ ulimit -s unlimited
$ ruby QR.rb > QR.scala
$ scalac QR.scala && scala QR > QR.scm
$ guile QR.scm > QR.sci
Expand Down
200 changes: 100 additions & 100 deletions SHA1SUMS
Original file line number Diff line number Diff line change
@@ -1,100 +1,100 @@
4552d038dd11e43b999ae7732732d0f24c2631e0 *QR.rb
c608d86db30f8a040d061be8096bca50f482114b *QR.scala
296bb228bb785d9735586623995964c026315f46 *QR.scm
70c0b4e24507714cd87d6e5ff140f7ee01b67406 *QR.sci
cdec80cfade30ebac23f8cf0ae4b8109d6942fdb *QR.bash
18f38af54cc8e5ae8827f22dee8f5cb9fc475bdb *QR.sl
7925c3ec9c8094c3d165d12ee7e6e12f67c6e035 *QR.st
a5019cf63cdd2fa14fa2da590bbda3560c24f525 *QR.nut
a971b900db3c2062b4268ab39f403a1e9555349d *QR.sml
d6aa6381438d9c02a7cd9792db9e2314ef5a910e *QR.sq
491911f2a28a9e836d01552aad062bd8fc466109 *QR.tcl
bbae26936360f2bf90d0d3bc4f3bbcb4a73d50e6 *QR.t
041c53f81a2a07806ff9c70f4eea67a36b523de8 *QR.unl
5f5b760e530679bbbcb47537b0d22258397fb89f *QR.vala
a60046eb3ebd0868efd43c7e4fab20e2d8533507 *QR.v
298d1bd41d3b3f445566d77960c5357482250512 *QR.vb
e000d979e0062daf98ac03440f2797c70ac34d40 *QR.ws
738bbc585f6cd838fdf24e745cd1dc9f1cf73c9a *QR.xslt
7fed32e7e506d5e4ecac2dda9e4580634e25bb43 *QR.yorick
ce226888230f9fde91b929fa69e7f99432a95476 *QR.azm
3ef49542667db7b56eac3c9412c313e267b4fbd3 *QR.+
bdc9e4e173882a35d3cf0d872c592f920d3c30ac *qr.adb
198e1ebb0c69c7a494e704bcbdd990ebc46cece2 *QR.als
588b8c3b33424ef3d1e57f1d9eb784173d698aa3 *QR.a68
fb1132b584742c9a2dbff64aaecaa3eddcb46323 *QR.ante
db05ddd2dbc2e30553e5f269aabdfdbf9ed5b8be *QR.asy
bfd5a96ed858bb57bc4e481868e46bc8dc39cd62 *QR.dats
440d7d54ae64a663d26925cba07eb48c387ebad0 *QR.awk
505e87ab85e999c1f559faf79926fc4a08e364c5 *QR.bc
505dec51c54fb0f92e131be2e2e80d347e8d9193 *QR.bef
78a1a1a5d2383825b48a2675d5eddfa9b69f84e8 *QR.Blc
36570222fc3301315e61e079cc3a203b99b5a661 *QR.bf
bf388c9255cf71775cb915562d40df25b2821a3f *QR.c
4a0621ec2e47cbcceecd40b9cf4a5e0b7cd56051 *QR.cpp
a24f2450c7b2cf9b257de24f3d4c4fbf8fb3beb8 *QR.cs
333aa546ade6a935bfbe1a38f92c3158b0e04fc4 *QR.cd
e02837f4510ff5ced6e1750123a4be0e1183ed50 *QR.chef
4f36baabcf63fac352517dce3f04b9f481fd70c3 *QR.clj
5d55664c5735eaf24153e1b3e5c617b5318f4951 *QR.cob
8157a16780f55694730ca7ffa181183461d8847d *QR.coffee
5a94bae113d4aa25f68ff666dea06c964e173be5 *QR.lisp
1cc44ed6e2156a25f8f7cb4150f17b38ee44af3c *QR.d
8c29132ed5a289d0827722362663bab389f01373 *QR.dfy
c067406c534692c99b29ccc7ed7c7ff551b7fc2b *QR.dc
06ab0ca50022a28a6df9567936eaa9e6fe4aff34 *QR.ec
76c7bfa4d4dd09125514cc4db7090c0c65d784cc *QR.exs
96b751536dbc3ec50046125d2a89f4858f94ee42 *QR.el
f96e882fb1bdd67a7f16b8057481f30f00a31bfc *QR.erl
5cf530228849e154a9da146d9ba0fde2928bab38 *QR.fsx
44ae6bf57babb47bf380c7a9c8d465aae22e8990 *QR.false
65b7e94a2e1919ac9149429f233eae55e2b63b6f *QR.fs
f059378e53f5e67d4e3bcce5a7af3af57ffe5deb *QR.f
097d9eca24d11e7c99e651745aba25740040db10 *QR.f90
b4efc7ea831656b2be321c831d9d573fdef67335 *QR.gbs
f8ccbd05ecb264ec14e086e7ee1bccc158d46cd7 *QR.g
3ce9920a4126be384df80ddbad97d9eb5fe1f5fa *QR.gel
3cb8fc7ea98ebeec305c57afcbb442767476f97e *QR.plt
072b41b72c250d35bb84715935a3a19ff00ed59a *QR.go
78d018ad0bdbcbc31058102db0b67b2949630353 *QR.gpt
9d5ca6cde4aa662770f3e91d2dabc9bd25a97649 *QR.grass
ef548303018fc5339d50ffe072cd85fb307e239a *QR.groovy
a968ed8306fc98e6649997fb8a45bc82c1b6edcc *QR.hs
a9f86c713dabc23d411bc9e7830b18b63d3ccbbf *QR.hx
4f7ec715c9ad2400efabd388060684c186d6ab6f *QR.icn
a637ec3cae0fa4164cec0aafbfb6042e9968157a *QR.i
c567109ba8f6dbf7df6a89c851dd621be1226c9d *QR.j
709fb6fff33d757d132809e5a42be55b20a79f76 *QR.java
5d084eccc77de0f98cc78247c9ad4de872b690fb *QR.js
bcd3048ede713062eab22f7efc3b3df0eed0547d *QR.jq
8c9b769f1e1b6bc0e551adee12f344e1eed817c2 *QR.jl
4876d7d60eb60f1cffd12413f797d97eee6a3be6 *QR.lazy
503da41178c2f3ac9e7b478f7908dffb8645e7bd *qr.li
4b1b23b460bde6df4f276ac74d65d395f92ca191 *QR.ll
bb7a47a0c727cfcf0e581a860754479ecc5c88df *QR.lol
c6dbf562b77cc4f5dcba83f7efe87cb55da352ef *QR.lua
8ea9e4d5e427b45e626dc54046685a9447bbdf33 *QR.mk
c0f07547c6f0dc811eda931cb6b979dd2160fd30 *QR.mac
08f6f0aef91cdaf14a2375992ed7dacc511fe77c *QR.mzn
b3a2b5f0124ebdbcc94a79df1f6d3c867c71cd52 *QR.il
4188198c858e4d157db9de14f8681a8ce209f430 *QR.asm
c63c48dd83994c26abfa3e5d40fdf69559594395 *QR.neko
b9b72766af1e0e5c4cb2d87e97aff84ea5c8fd7d *QR.5c
2d6939946ed2e2f625a8aac628129f66d380279a *QR.nim
30b98152fd0aa0b7f25f07c07b8545670c5a85ad *QR.m
4cce8809423b1b0314ba926ee0e5a42c323e2485 *QR.ml
ac19eff4b03f0d6f7130ad33294f13e7d92c4e05 *QR.octave
9373975c3e4d1a61b7da31ad8ea1fd29bcc53000 *QR.ook
629f032777ebc1694ebf8429acd4fe5be621c26d *QR.gp
5a1c5419be69f243a97d8b06ead96a9881050d58 *QR.pas
f693703e36fd4a9a70fd33d15ac0b6a8081f22f4 *QR.pl
c96d295fcb2a0602bacbc10207203841c6d4fe41 *QR.php
aa707ddf958174e484d19010adcd1dceb72b8be4 *QR.png
4b60646b9a9e69f5c7635ed74bdb50b0127eea6b *QR.pike
bef3d1b9d7ed15f7e859d7f17b9591729fd5ff5a *QR.ps
635bcae98b8d8651f0e0169eba9f9146028a7b92 *QR.ppt
aa97c828eccdc699e01e74a16a280966807412dd *QR.prolog
8f91c47f80a798b3cbf601fc7a9d7f9f4894d85e *QR.py
c3fb43b512cd0ba10904e1039e2cd0fd344ab1f8 *QR.R
bb3c3339d6abc60c362a0cf5ba8c284a6acfe8ca *QR.ratfor
c9c6550b24fcfaa496cf68069c932a76cff63c70 *QR.rexx
287ba3dc0aa228a92de77e43898d4b0b40fa916f *QR.rb
2e787a64b5104b6fd4412ea018987709d22ff50e *QR.scala
3ee178cd891db06753bfda89455d42ed55dbc184 *QR.scm
2615ca9420590b764a2e4880be26703c295cd598 *QR.sci
f1fee5dadb2bb5e6475db67a5aa55cc086528b63 *QR.bash
c8f751f0c8eb5fac0924456ea01978941f0aa2b3 *QR.sl
08c05f8f6f42f1d2344553884394877e0f3f1114 *QR.st
d99f571155d20a6af643d78158d82da3c4a4facf *QR.nut
e873e8dfd63e5178876d2d266000d338d2ed7bae *QR.sml
379c7744fe20a1df3072a2dbc17a536e06ca547c *QR.sq
88f913da70640564f60361cebf0380a4e625021a *QR.tcl
f22e5bac92372aa88d3e6f20d386fe4236d65436 *QR.t
35eb0709827c9c4f8eb681bf211211e808a42115 *QR.unl
e1f66b1e94e40dfd32bfc3189e6723736fb7ddf2 *QR.vala
2713bc8f8aedc78d770e07f950543f92f8018cc9 *QR.v
8846feb392df10999de2f72d927ac30544bf8177 *QR.vb
620e4f69177b63672c194ef3b8a1147f250b6e10 *QR.ws
a80295f1f2a4a6be7fb06cc90c582bdfc8b46b8b *QR.xslt
e51f8e4544d5c5af758cbab4a55e65976b4020cc *QR.yorick
d5366f22dd06780545e67309cd967aeef3c28dd2 *QR.azm
0503670e21f5f4ce223c7c5c243b89cc2b2d81b9 *QR.+
e9bd42a6c1a3dc45e6942b8508848bd02412c2f8 *qr.adb
dbf1e39e7ba35b6e0936e4aa06e4b6d398ba4b40 *QR.als
950ec4fff5ec0b5811be75b49f9b8e5afb24644c *QR.a68
9b4fb8881e935ffcc83755f7fb0f69a040871f2f *QR.ante
a196947f9868dc0a17474d726ddba84174dbcb4d *QR.asy
4eac30177dcf1d4bea8fd14c3a62827bb5ebc6cb *QR.dats
f58362c54c9492514d150c52bb8315644a771b6d *QR.awk
eb89137d9e35cdd4f7d2e57d2a4cebb8dd81700c *QR.bc
f16526287ed829a75d1d74c67a26f4b9b1039cb1 *QR.bef
796201f25144a560b54b3ce17e32cca190bb96f1 *QR.Blc
15d7dba157400a7473ebcb7ca2549c78e888ff6c *QR.bf
0ffecb4cbabc756f00ec0af5789196c9ca079ffd *QR.c
b641297be5ef4163eef9ae6916a75489625542db *QR.cpp
f525758692a19f9bff3e315980286744d0ce0235 *QR.cs
59df2bd8041fabc5165e1da3a90dbc7c0bbf6687 *QR.cd
ae5b652d047e15d74ed3d2c513b6e7b1ba542731 *QR.chef
96b6b74e98b52f86d5371e20fb389a3b9e32ae97 *QR.clj
75639202f486d5e3df56e1cad7e7b617ef361dfd *QR.cob
1a8a11ea11775f6d4710fa44349f8985b5b2b3db *QR.coffee
0e34bd9f33e29c48a3db4406bd16170350554a3f *QR.lisp
1180e39cd4cb6d6bced17f08bc388e42fd23d65f *QR.d
f9718c8eb9d217cc7f2824a44522189ddfdee675 *QR.dfy
4faf2f3e93dcf72b4e3f827984a4be9b94ad928c *QR.dc
51d204c31a0583552cfc607c40d4bbefcd2ced90 *QR.ec
0ba65a95cf0c75490dc763565c2f09eef62382e7 *QR.exs
5496c508847ae97a9e40e029df149ec3f23b7c3c *QR.el
190317a6ed8ea19d56e96bb22b8b6757e808c0e8 *QR.erl
2888615e65aca89dbb79a9b5c9db6d14d8109d1e *QR.fsx
61d3a76d9a264574f0b2f724b308f77f89857da7 *QR.false
373b6f254de494636396a741a7aed5976cb25ed2 *QR.fs
f1b20f304e2cf6a0b12a246316ba6c14d716d86f *QR.f
0a5e816732808b51e6fe0bd29f1670ea3880343e *QR.f90
90316bda00f2d1a331852e6984d5d5c63daaf445 *QR.gbs
b10052ec82eb10c32cfca5ffc492f9fe65be8c39 *QR.g
70540915efdbe5f387c5fea3549d2574640844ec *QR.gel
5500760c8311f4d1432d33188048125190aafbea *QR.plt
c1249f5c39ae9fc2cf0ace20f351c12479abbc67 *QR.go
e0dc11c6c096b674c5a774005fc572bf52ea694f *QR.gpt
9c5ef882731e6a747524b5a7d425152e22a5ed2f *QR.grass
0027f45c2e94fe7e03e743d3205187f46412694f *QR.groovy
6d738f312211b637a09757291fc74cdb7438f9ab *QR.hs
d3611e5e8261ea5ffbd0fa225ec3de18f643b778 *QR.hx
ec28e60644f6a03222accd2184ce83fcc28eb950 *QR.icn
b17e7439e52e51a5d6d8a1ecdd0a07da61573a8c *QR.i
2083fd756ca73a66f8b24d5c513da681b9a9b760 *QR.j
1a64863ba19e470b4f09be9803f38eefde264c0c *QR.java
1ff943c01f2fa14afbedf9b9a2832a946f4ed3a7 *QR.js
734c2fe33add19ae6766d99be0b11553f724da8f *QR.jq
704b417a52a9ec00937c7355e49b4787f1f247d7 *QR.jl
b99254f1fbc30f5c31b82de9cf3bc8668121d9b2 *QR.lazy
1c71d3cd65a760547d1c4c8d4b5d21f4300d6954 *qr.li
aad49803cfe14d9806ff35c59d8784e4c47ab9a9 *QR.ll
74def061e960352e4ff845c5e04e767e6092be25 *QR.lol
777807dd13e6d7d69b9f40a8aea32f4cff974847 *QR.lua
66a53a794c2c6e25070d489f674465150b12beb4 *QR.mk
3fb4e6211a48a481ac314a38d0fdbd5436c04f85 *QR.mac
4387697e7b0e8e241e8289c62c8b7b339c4e2a41 *QR.mzn
e5f217c3eedceef1ab89debce822acc22eb6deb3 *QR.il
e513b90b5d210bcc8f7feefb371897dd6cd371c0 *QR.asm
282764094103554ed885c21e80f2362b6af71fb2 *QR.neko
ecccce727c056c1ca39c42df9ab7e2effe0c09b1 *QR.5c
2f75aec2b59c4367959623473f8d8c2edbc2403a *QR.nim
c2b4de1e83bfbb0cb58e41e6aedef8b1c4f458de *QR.m
b980e8325b11538f5ee15092e1730ebced978962 *QR.ml
2413817b20f1ff986a46fdb21480d2d69f9d0938 *QR.octave
b1f7f288138c253fa3fab82ea29c273e4304aefc *QR.ook
3fcc5ed38d2b41d758aedc88cfc967f6c889ab64 *QR.gp
ec3194e009347322fbbfeef071d3a4994c968cca *QR.pas
084b91d299d7d463ca2951f14c98abce6d300e53 *QR.pl
56a084febfb1217ba006c2949043a0029c5513ca *QR.php
e1ed767d340e87ac738a06a1f5280279ec4e75b9 *QR.png
47e1f09905cb101b4967684db4aebc8f702697ed *QR.pike
c62750ea748b417f5b0cb8bd3e48b6a68123687f *QR.ps
e9b564690123133184549cbaa8fa82a5b7505277 *QR.ppt
09fa8eebe7ef78fbb3a2f2cf7aaaeb96588167b1 *QR.prolog
efea16159d09745e111bae87926be2ed38a74866 *QR.py
93a5b59bfab9b5d11e860bf297e15d197f55785b *QR.R
ae06b3b2ca55ae9eace2a0d413273803116ae893 *QR.ratfor
12445b93264852935c788cc06f8bdbdf936a2287 *QR.rexx
2 changes: 1 addition & 1 deletion src/Makefile.gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def banner(s1, s2=nil, i=nil)
OUT << "#{ s2.src }: #{ s1.src }"
banner(s1.name, s2.name, i)
OUT << "\t@mv #{ s1.backup } #{ s1.backup }.bak" if s1.backup
cmd.split("&&").each {|c| OUT << "\t" + c.strip }
cmd.split("&&").each {|c| OUT << "\t" + c.strip.gsub(/^!/, "ulimit -s unlimited && ") }
OUT << "\t@mv #{ s1.backup }.bak #{ s1.backup }" if s1.backup
end

Expand Down
2 changes: 2 additions & 0 deletions src/README.md.gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
src = s2.src
cmd = cmd.gsub("OUTFILE", src)

cmd = cmd.gsub(/^!/, "")
cmd = cmd.gsub(/.{60,}?&&/, "\\0\n ")

cmd
Expand Down Expand Up @@ -91,6 +92,7 @@

#### 2. Run each program on each interpreter/compiler.

$ ulimit -s unlimited
% cmds.each do |cmd|
$ <%= cmd %>
% end
Expand Down
13 changes: 11 additions & 2 deletions src/code-gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,16 @@ class EC < CodeGen
Cmd = "ecp -c QR.ec -o QR.sym && ecc -c QR.ec -o QR.c && ecs -console QR.sym QR.imp -o QR.main.ec && ecp -c QR.main.ec -o QR.main.sym && ecc -c QR.main.ec -o QR.main.c && gcc -o QR QR.c QR.main.c -lecereCOM && ./QR > OUTFILE"
Backup = "QR.c"
Apt = "ecere-dev"
Code = %q("class QR:Application{void Main(){#{f(PREV,15){"Print#$S;"}}}}")
def code
<<-'END'.lines.map {|l| l.strip }.join
%(
class QR:Application{
void f(String const s,int n){for(Print(s);n;n--)Print("\\\\");}
void Main(){#{f(PREV,15){"f(#{V[$S[1..-2],'",',');f("']},0);"}}}
}
)
END
end
end

class Dc < CodeGen
Expand Down Expand Up @@ -843,7 +852,7 @@ def code
class CDuce_Chef < CodeGen
File = ["QR.cd", "QR.chef"]
Cmd = [
"cduce QR.cd > OUTFILE",
"!cduce QR.cd > OUTFILE",
"PERL5LIB=vendor/local/lib/perl5 compilechef QR.chef QR.chef.pl && perl QR.chef.pl > OUTFILE"
]
Apt = ["cduce", nil]
Expand Down
Binary file modified thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b6346c5

Please sign in to comment.