You need to write a program in any language that will produce (source code for) a program in a different language. That program will produce a 3rd program in another language and so on.

You should aim to create many programs; you aren't limited to 3. You can re-use a language, but it won't be counted in the scoring.

Your entry is the source code of the first program, together with a list of the languages of subsequent programs produced in the order they are produced. For easy reading maybe include each program's output/source.

Scoring will be the length of the source code of the first program divided by the number of different languages used.

To prevent solutions such as 1 (that has been pointed out in the comments) I suggest the following extra rule:

The output of one program must not be valid code in the language of that program.

  • 9
    \$\begingroup\$ You do know that 1 is at the very least a Golfscript program that outputs a PHP program that outputs an APL program that outputs a J program that outputs a Perl program that outputs nothing, right? \$\endgroup\$
    – marinus
    Commented Jul 16, 2013 at 12:04
  • 9
    \$\begingroup\$ Or what about this non-trivial quine version, going through 50 languages: github.com/mame/quine-relay \$\endgroup\$
    – daniero
    Commented Jul 16, 2013 at 12:52
  • \$\begingroup\$ Similar to codegolf.stackexchange.com/questions/2582/golf-a-mutual-quine \$\endgroup\$ Commented Jul 16, 2013 at 13:22
  • \$\begingroup\$ @marinus: maybe I should add a rule that states the source code produced for the next language must be invalid in the one producing it. \$\endgroup\$ Commented Jul 16, 2013 at 13:35
  • \$\begingroup\$ @marinus: I'm curious what your point is. Are you suggesting that nobody should pose a challenge which can be trivially accomplished with GolfScript? That would make most challenges moot, and render this stackexchange site pointless. Is it perhaps better to consider non-GolfScript solutions worthwhile in spite of the existence of GolfScript? \$\endgroup\$ Commented Jul 17, 2013 at 3:57

2 Answers 2


My first time for that kind of challenge:

R > Julia > BrainF**k - 91 characters - Score: 30.33

The initial R code:


It produces the following Julia code:


Which produces:


which equates to:


in BrainF**k.

NB: None of the three programs is valid in any of the two other languages.


Clojure → C → Python 2.7 → BASIC → Bash

Score: 13.40

(println"int main(){puts(\"print'PRINT\\\"echo\\\"'\");return 0;}")

Here is the breakdown:

  1. Clojure

    (println"int main(){puts(\"print'PRINT\\\"echo\\\"'\");return 0;}")
  2. C

    int main(){puts("print'PRINT\"echo\"'");return 0;}
  3. Python 2.7

  4. BASIC

  5. Bash


I guess a simpler alternative would be


in Python 2.7, which outputs Bash code. This has a score of 5.5, but isn't as fancy as what's above.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.