Skip to content

Commit

Permalink
* the 81st language: Chef
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Dec 4, 2014
1 parent 28b90d4 commit 406b154
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 233 deletions.
105 changes: 57 additions & 48 deletions Makefile

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions QR.rb

Large diffs are not rendered by default.

92 changes: 47 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This is a Ruby program that generates
Scala program that generates
Scheme program that generates
...(through 80 languages in total)...
...(through 81 languages in total)...
REXX program that generates
the original Ruby code again.

Expand Down Expand Up @@ -81,7 +81,8 @@ To run it on Ubuntu 12.04 LTS, you might want to refer to `.travis.yml`.
$ gcc -o QR QR.c && ./QR > QR.cpp
$ g++ -o QR QR.cpp && ./QR > QR.cs
$ mcs QR.cs && mono QR.exe > QR.cd
$ cduce QR.cd > QR.clj
$ cduce QR.cd > QR.chef
$ PERL5LIB=vendor/local/lib/perl5 compilechef QR.chef QR.chef.pl && perl QR.chef.pl > QR.clj
$ clojure QR.clj > QR.cob
$ cobc -O2 -x QR.cob && ./QR > QR.coffee
$ coffee QR.coffee > QR.lisp
Expand Down Expand Up @@ -191,50 +192,51 @@ I used the following Ubuntu deb packages to test this program.
35 |C++ |g++ |4:4.9.1-4ubuntu2
36 |C# |mono-mcs |3.2.8+dfsg-4ubuntu2
37 |CDuce |cduce |0.6.0-1
38 |Clojure |clojure1.4 |1.4.0+dfsg-3
39 |Cobol |open-cobol |1.1-1build1
40 |CoffeeScript |coffeescript |1.4.0-1
41 |Common Lisp |clisp |1:2.49-9ubuntu1
42 |Forth |gforth |0.7.2+dfsg1-1
43 |FORTRAN77 |f2c |20100827-1
44 |Fortran90 |gfortran |4:4.9.1-4ubuntu2
45 |Go |golang |2:1.2.1-2ubuntu1
46 |Groovy |groovy |2.0.0~beta2+isreally1.8.6-4ubuntu1
47 |Haskell |ghc |7.6.3-19
48 |Icon |icont |9.4.3-4.2ubuntu1
38 |Chef |*N/A* |-
39 |Clojure |clojure1.4 |1.4.0+dfsg-3
40 |Cobol |open-cobol |1.1-1build1
41 |CoffeeScript |coffeescript |1.4.0-1
42 |Common Lisp |clisp |1:2.49-9ubuntu1
43 |Forth |gforth |0.7.2+dfsg1-1
44 |FORTRAN77 |f2c |20100827-1
45 |Fortran90 |gfortran |4:4.9.1-4ubuntu2
46 |Go |golang |2:1.2.1-2ubuntu1
47 |Groovy |groovy |2.0.0~beta2+isreally1.8.6-4ubuntu1
48 |Haskell |ghc |7.6.3-19
49 |Icon |icont |9.4.3-4.2ubuntu1
| |iconx |9.4.3-4.2ubuntu1
49 |INTERCAL |intercal |29:0.29-3
50 |Jasmin |jasmin-sable |2.4.0-4
51 |Java |openjdk-6-jdk |6b33-1.13.5-1ubuntu1
52 |JavaScript |rhino |1.7R4-3
53 |LLVM asm |llvm |1:3.5-23ubuntu1
54 |Logo |ucblogo |5.5-2.1
55 |LOLCODE |*N/A* |-
56 |Lua |lua5.2 |5.2.3-1
57 |Makefile |make |4.0-8
58 |Maxima |maxima |5.33.0-14
59 |MSIL |mono-devel |3.2.8+dfsg-4ubuntu2
60 |NASM |nasm |2.11-1
61 |Neko |neko |2.0.0-3
62 |Nickle |nickle |2.77-1
63 |Objective-C |gobjc |4:4.9.1-4ubuntu2
64 |OCaml |ocaml |4.01.0-4ubuntu1
65 |Octave |octave |3.8.1-1ubuntu1
66 |Ook! |*N/A* |-
67 |PARI/GP |pari-gp |2.7.1-1
68 |Parrot asm |parrot |6.3.0-1
69 |Pascal |fp-compiler |2.6.4+dfsg-3
70 |Perl |perl |5.20.1-1
71 |PHP |php5-cli |5.5.12+dfsg-2ubuntu4.1
72 |Piet |*N/A* |-
73 |Pike |pike7.8 |7.8.866-3
74 |PostScript |ghostscript |9.14~dfsg-0ubuntu3
75 |PPT (Punched tape) |bsdgames |2.17-22
76 |Prolog |swi-prolog |6.6.4-2ubuntu1
77 |Python |python |2.7.8-1
78 |R |r-base |3.1.1-1
79 |Ratfor |ratfor |1.0-15
80 |REXX |regina-rexx |3.6-2
50 |INTERCAL |intercal |29:0.29-3
51 |Jasmin |jasmin-sable |2.4.0-4
52 |Java |openjdk-6-jdk |6b33-1.13.5-1ubuntu1
53 |JavaScript |rhino |1.7R4-3
54 |LLVM asm |llvm |1:3.5-23ubuntu1
55 |Logo |ucblogo |5.5-2.1
56 |LOLCODE |*N/A* |-
57 |Lua |lua5.2 |5.2.3-1
58 |Makefile |make |4.0-8
59 |Maxima |maxima |5.33.0-14
60 |MSIL |mono-devel |3.2.8+dfsg-4ubuntu2
61 |NASM |nasm |2.11-1
62 |Neko |neko |2.0.0-3
63 |Nickle |nickle |2.77-1
64 |Objective-C |gobjc |4:4.9.1-4ubuntu2
65 |OCaml |ocaml |4.01.0-4ubuntu1
66 |Octave |octave |3.8.1-1ubuntu1
67 |Ook! |*N/A* |-
68 |PARI/GP |pari-gp |2.7.1-1
69 |Parrot asm |parrot |6.3.0-1
70 |Pascal |fp-compiler |2.6.4+dfsg-3
71 |Perl |perl |5.20.1-1
72 |PHP |php5-cli |5.5.12+dfsg-2ubuntu4.1
73 |Piet |*N/A* |-
74 |Pike |pike7.8 |7.8.866-3
75 |PostScript |ghostscript |9.14~dfsg-0ubuntu3
76 |PPT (Punched tape) |bsdgames |2.17-22
77 |Prolog |swi-prolog |6.6.4-2ubuntu1
78 |Python |python |2.7.8-1
79 |R |r-base |3.1.1-1
80 |Ratfor |ratfor |1.0-15
81 |REXX |regina-rexx |3.6-2

Note that some languages are not available in Ubuntu (marked as *N/A*).
This repository includes their implementations in `vendor/`.
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.
31 changes: 26 additions & 5 deletions src/code-gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def f(s,n)s.gsub(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;
V=->s,a,z{s.gsub(/(#{B*4})+/){a+"#{$&.size/2}"+z}};
C="Console.Write";
$D="program QR";
$G=" contents of"+$F=" the mixing bowl";
END

def self.setup_dir(name)
Expand Down Expand Up @@ -551,11 +552,31 @@ def code
end
end

class CDuce < CodeGen
File = "QR.cd"
Cmd = "cduce QR.cd > OUTFILE"
Apt = "cduce"
Code = %q("print#{E[PREV]};;")
class CDuce_Chef < CodeGen
File = ["QR.cd", "QR.chef"]
Cmd = [
"cduce QR.cd > OUTFILE",
"PERL5LIB=vendor/local/lib/perl5 compilechef QR.chef QR.chef.pl && perl QR.chef.pl > OUTFILE"
]
Apt = ["cduce", nil]
def code
<<-'END'.lines.map {|l| l.strip }.join("\\n")
%(let f(c :Int):Latin1=if c=127then""else(string_of c@" g caffeine "@string_of c@"
")@f(c+1)in print("Quine Relay Coffee.
Ingredients.
"@f 10@"
Method.
");let g(String ->[])
[c;t]->print("Put caffeine "@string_of(int_of_char c)@" into#$F.
");g t
|_ ->print("Liquify#$G.
Pour#$G into the baking dish.
Serves 1.
")in g#{E[PREV.reverse]})
END
end
end

class CSharp < CodeGen
Expand Down
Loading

0 comments on commit 406b154

Please sign in to comment.