CJam 0.6.6 dev / GolfScript, 15 14 12 bytes
"0$p"0$~a:n;
Thanks to @jimmy23013 for golfing off 2 bytes!
Rest to be updated.
Verification
Since the submission involves significant whitespace, it's best to compare hexdumps.
$ xxd -g 1 mpquine
0000000: 22 60 30 24 7e 22 30 24 7e 4e 4d 3a 6e 3b "`0$~"0$~NM:n;
$
$ cjam mpquine | tee quine.gs | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e 0a "`0$~"`0$~.
$ golfscript quine.gs | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e 0a "`0$~"`0$~.
$ cjam quine.gs | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e "`0$~"`0$~
$
$ golfscript mpquine | tee quine.cjam | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e "`0$~"`0$~
$ cjam quine.cjam | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e "`0$~"`0$~
$ golfscript quine.cjam | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e 0a "`0$~"`0$~.
CJam
CJam prints "`0$~"0$~
and a trailing linefeed. Try it online!
The generated program prints "`0$~"0$~
with the trailing linefeed in GolfScript (Try it online!), but without the linefeed in CJam (Try it online!).
How the metaquine works
"`0$~" e# Push that string on the stack.
0$~ e# Push a copy and evaluate it:
e# ` Inspect the string, pushing "\"`0$~\"".
e# 0$ Push a copy.
e# ~ Evaluate, pushing "`0$~".
e# Both "\"`0$~\"" and "`0$~" are now on the stack.
NM e# Push "\n" and "".
:n; e# Map print over the elements of "" (none) and pop the result.
e# "\"`0$~\"", "`0$~", and "\n" are now on the stack, and the
e# characters they represent will be printed implicitly.
How the quine works
"`0$~" # Push that string on the stack.
0$~ # As in CJam.
<LF> # Does nothing.
# "\"`0$~\"" and "`0$~" are now on the stack, and the characters
# they represent will be printed implicitly, plus a linefeed.
Unlike GolfScript, CJam doesn't print a trailing linefeed by default, so this is not a quine in CJam.
GolfScript
GolfScript prints "`0$~"0$~
, without trailing whitespace. Try it online!
The generated program prints "`0$~"0$~
without trailing whitespace in CJam (Try it online!), but GolfScript appends a linefeed (Try it online!).
How the metaquine works
"`0$~"0$~ # As in CJam.
NM # Unrecognized token. Does nothing.
:n # Store the top of the stack – "`0$~" – in the variable n. n holds
# "\n" by default. When the program finishes, the interpreter
# prints n implicitly, usually resulting in a trailing linefeed.
# By redefining n, it will print "0$~" instead.
; # Pop the string from the stack so it won't be printed twice.
How the quine works
"`0$~"0$~ e# Works as in GolfScript.
Unlike CJam, GolfScript will append a linefeed to the contents of the stack, so this is not a quine in GolfScript.
1A quine is basically a meta-meta-meta-meta-meta-meta-meta-etc. program anyways :) – Esolanging Fruit – 2016-11-08T04:50:57.193
How to count bytes if the two languages use different character encodings? You should probably score in characters rather than bytes – Luis Mendo – 2016-11-08T08:13:06.833
1If I run the quine in language A to generate a quine for language B, should that be runnable in A? – corvus_192 – 2016-11-08T08:33:55.330
2@LuisMendo When writing a polyglot for languages with different encodings, I'd assume that they both receive the same byte stream (not different encodings of the same characters). – Martin Ender – 2016-11-08T14:11:18.093
@corvus_192 it doesn't matter how it runs in language A as long as it is not a quine. – Pavel – 2016-11-08T14:53:17.823
1
@Pavel I actually wrote a similar challenge here, but it got closed as a duplicate.
– Oliver Ni – 2016-11-11T04:22:56.547