mame/ quine-relay
View on GitHubAn uroboros program with 100+ programming languages
An uroboros program with 100+ programming languages
QR.rb is a Ruby program that generates a Rust program that generates a Scala program that generates ...(through 128 languages in total)... a REXX program that generates the original Ruby code again.

(If you want to see the old 50-language version, see the 50 branch.)
If you are using Ubuntu 26.04 (Resolute Raccoon), you can follow these steps.
First, you need to type the following apt-get command to install them all.
$ sudo apt-get install afnix algol68g aspectj asymptote ats2-lang bash \
bc bsh clisp clojure cmake coffeescript crystal dc dhall \
dotnet-sdk-10.0 elixir emacs-nox erlang execline f2c fennel fish flex \
fp-compiler g++ gambas3-gb-pcre gambas3-scripter gap gawk gcc gdb gdc \
genius gforth gfortran ghc ghostscript gm2 gnat gnucobol4 gnuplot \
gobjc golang gpt groovy guile-3.0 gzip haxe icont iconx intercal \
iverilog jasmin-sable jq kotlin ksh libevent-dev libpolyml-dev \
livescript llvm lua5.3 m4 make minizinc mono-devel nasm neko nickle \
nim node-typescript nodejs ocaml octave openjdk-25-jdk pari-gp \
parser3-cgi perl php-cli pike8.0 polyml python3 r-base rakudo ratfor \
rc regina-rexx ruby ruby-mustache rustc scala scilab-cli sed slsh spin \
squirrel3 surgescript swi-prolog swiftlang tcl tcsh valac vim wabt \
xsltproc yabasic yorick zoem zsh
Then, build the bundled interpreters.
$ sudo apt-get install cmake libpng-dev libgd-dev libfl-dev groff bison curl
$ make -C vendor
$ ulimit -s unlimited
$ ruby QR.rb > QR.rs
$ rustc QR.rs && ./QR > QR.scala
$ scalac QR.scala && scala QR > QR.scm
$ guile QR.scm > QR.sci
$ scilab-cli -nb -f QR.sci > QR.sed
$ sed -E -f QR.sed QR.sed > QR.spl
$ spl2c < QR.spl > QR.spl.c && gcc -z muldefs -o QR -I ./vendor/local/include -L ./vendor/local/lib QR.spl.c -lspl -lm &&
./QR > QR.sl
$ slsh QR.sl > QR.nut
$ squirrel QR.nut > QR.sml
$ polyc -o QR QR.sml && ./QR > QR.sq
$ ruby vendor/subleq.rb QR.sq > QR.ss
$ surgescript QR.ss > QR.swift
$ swiftc QR.swift && ./QR > QR.tcl
$ tclsh QR.tcl > QR.tcsh
$ tcsh QR.tcsh > QR.t
$ ruby vendor/thue.rb QR.t > QR.ts
$ tsc --outFile QR.ts.js QR.ts && nodejs QR.ts.js > QR.unl
$ ruby vendor/unlambda.rb QR.unl > QR.vala
$ valac QR.vala && ./QR > QR.mid
$ mono vendor/local/bin/Vlt.exe /s QR.mid && mono QR.exe > QR.v
$ iverilog -o QR QR.v && ./QR -vcd-none > QR.vim
$ vim -EsS QR.vim > QR.vb
$ echo '<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup><ItemGroup><Compile Include="QR.vb" /></ItemGroup></Project>' > tmp.vbproj &&
DOTNET_NOLOGO=1 dotnet run --project tmp.vbproj > QR.wasm
$ $(WASI_RUNTIME) QR.wasm > QR.wat
$ wat2wasm QR.wat -o QR.wat.wasm && $(WASI_RUNTIME) QR.wat.wasm > QR.ws
$ ruby vendor/whitespace.rb QR.ws > QR.xslt
$ xsltproc QR.xslt > QR.yab
$ yabasic QR.yab > QR.yorick
$ yorick -batch QR.yorick > QR.azm
$ zoem -i QR.azm > QR.zsh
$ zsh QR.zsh > qr.adb
$ gnatmake qr.adb && ./qr > QR.als
$ LANG=C LD_LIBRARY_PATH=/usr/lib/afnix axi QR.als > QR.aheui
$ ruby vendor/aheui.rb QR.aheui > QR.a68
$ a68g QR.a68 > QR.ante
$ ruby vendor/ante.rb QR.ante > QR.aj
$ ajc QR.aj && java QR > QR.asy
$ asy QR.asy > QR.dats
$ patscc -o QR QR.dats && ./QR > QR.awk
$ awk -f QR.awk > QR.bash
$ bash QR.bash > QR.bc
$ BC_LINE_LENGTH=4000000 bc -q QR.bc > QR.bsh
$ bsh QR.bsh > QR.bef
$ cfunge QR.bef > QR.Blc
$ ruby vendor/blc.rb < QR.Blc > QR.bf
$ ruby vendor/bf.rb QR.bf > QR.c
$ gcc -o QR QR.c && ./QR > QR.cpp
$ g++ -o QR QR.cpp && ./QR > QR.cs
$ echo '<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup><ItemGroup><Compile Include="QR.cs" /></ItemGroup></Project>' > tmp.csproj &&
DOTNET_NOLOGO=1 dotnet run --project tmp.csproj > QR.chef
$ PERL5LIB=vendor/local/lib/perl5 compilechef QR.chef QR.chef.pl &&
perl QR.chef.pl > QR.clj
$ clojure QR.clj > QR.cmake
$ cmake -P QR.cmake > QR.cob
$ cobc -O2 -x QR.cob && ./QR > QR.coffee
$ coffee --nodejs --stack_size=100000 QR.coffee > QR.lisp
$ clisp QR.lisp > QR.cr
$ crystal QR.cr > QR.d
$ gdc -o QR QR.d && ./QR > QR.dc
$ dc QR.dc > QR.dhall || true
$ dhall text --file QR.dhall > QR.exs
$ elixir QR.exs > QR.el
$ emacs -Q --script QR.el > QR.erl
$ escript QR.erl > QR.e
$ execlineb QR.e > QR.fsx
$ echo '<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup><ItemGroup><Compile Include="QR.fsx" /></ItemGroup></Project>' > tmp.fsproj &&
DOTNET_NOLOGO=1 dotnet run --project tmp.fsproj > QR.false
$ ruby vendor/false.rb QR.false > QR.fnl
$ fennel QR.fnl > QR.fl
$ flex -o QR.fl.c QR.fl && gcc -o QR QR.fl.c && ./QR > QR.fish
$ fish QR.fish > QR.fs
$ gforth QR.fs > QR.f
$ gfortran -o QR QR.f && ./QR > QR.f90
$ gfortran -o QR QR.f90 && ./QR > QR.gbs
$ gbs3 QR.gbs > QR.g
$ gap -q QR.g > QR.gdb
$ gdb -q -x QR.gdb > QR.gel
$ genius QR.gel > QR.plt
$ gnuplot QR.plt > QR.go
$ go run QR.go > QR.gs
$ ruby vendor/golfscript.rb QR.gs > QR.gpt
$ mv QR.c QR.c.bak && gpt -t QR.c QR.gpt && gcc -o QR QR.c && ./QR > QR.grass &&
mv QR.c.bak QR.c
$ ruby vendor/grass.rb QR.grass > QR.groovy
$ groovy QR.groovy > QR.gz
$ gzip -cd QR.gz > QR.hs
$ rm -f QR.o && ghc QR.hs && ./QR > QR.hx
$ haxe -main QR -neko QR.n && neko QR.n > QR.icn
$ icont -s QR.icn && ./QR > QR.i
$ ick -bfOc QR.i && gcc -std=c99 -static QR.c -I /usr/include/ick-* -o QR -lick &&
./QR > QR.j
$ jasmin QR.j && java QR > QR.java
$ javac QR.java && java QR > QR.js
$ nodejs QR.js > QR.jq
$ jq -r -n -f QR.jq > QR.jsfuck
$ nodejs --stack_size=100000 QR.jsfuck > QR.kt
$ kotlinc QR.kt -include-runtime -d QR.jar && kotlin QR.jar > QR.ksh
$ ksh QR.ksh > QR.lazy
$ lazyk QR.lazy > QR.ls
$ lsc QR.ls > QR.ll
$ llvm-as QR.ll && lli QR.bc > QR.lol
$ lci QR.lol > QR.lua
$ lua5.3 QR.lua > QR.m4
$ m4 QR.m4 > QR.mk
$ make -f QR.mk > QR.mzn
$ minizinc --solver COIN-BC --soln-sep '' QR.mzn > QR.mod
$ gm2 -fiso QR.mod -o QR && ./QR > QR.il
$ ilasm QR.il && mono QR.exe > QR.mustache
$ mustache QR.mustache QR.mustache > QR.asm
$ nasm -felf QR.asm && ld -m elf_i386 -o QR QR.o && ./QR > QR.neko
$ nekoc QR.neko && neko QR.n > QR.5c
$ nickle QR.5c > QR.nim
$ nim compile QR.nim && ./QR > QR.m
$ gcc -o QR QR.m && ./QR > QR.ml
$ ocaml QR.ml > QR.octave
$ mv QR.m QR.m.bak && octave -qf QR.octave > QR.ook && mv QR.m.bak QR.m
$ ruby vendor/ook-to-bf.rb QR.ook QR.ook.bf && ruby vendor/bf.rb QR.ook.bf > QR.gp
$ gp -f -q QR.gp > QR.p
$ parser3 QR.p > QR.pas
$ fpc QR.pas && ./QR > QR.pl
$ perl QR.pl > QR.pl6
$ perl6 QR.pl6 > QR.php
$ php QR.php > QR.png
$ npiet QR.png > QR.pike
$ pike QR.pike > QR.ps
$ gs -dNODISPLAY -q QR.ps > QR.prolog
$ swipl -q -t qr -f QR.prolog > QR.pr
$ spin -T QR.pr > QR.py
$ python3 QR.py > QR.R
$ R --slave -f QR.R > QR.ratfor
$ ratfor -o QR.ratfor.f QR.ratfor && gfortran -o QR QR.ratfor.f &&
./QR > QR.rc
$ rc QR.rc > QR.rexx
$ rexx ./QR.rexx > QR2.rb
You will see that QR.rb is the same as QR2.rb.
$ diff QR.rb QR2.rb
Alternatively, just type make.
$ make
Note: It may take a lot of memory to compile some files.
Simply build the image and run a container as follows:
$ docker build -t qr .
$ docker run --privileged --rm -e CI=true qr
Note: You must run in privileged mode, otherwise the maxima command will fail.
If you want to check the generated files, you can mount the local directory in the Docker container (but still use the vendor directory of the container), as follows:
$ docker run --privileged --rm -e CI=true -v $(pwd):/usr/local/share/quine-relay -v /usr/local/share/quine-relay/vendor qr
You may find instructions for other platforms in the wiki.
If you do not use these Linux distributions, please find your own way. If you manage it, please let me know. I wish you good luck.
I used the following Ubuntu deb packages to test this program.
# |language |ubuntu package |version ----|----------------------------|----------------------------------|----------------------------------- 1 |Ruby |ruby |1:3.3build1 2 |Rust |rustc |1.93.1ubuntu1 3 |Scala |scala |2.11.12-6build1 4 |Scheme |guile-3.0 |3.0.11-2 5 |Scilab |scilab-cli |2024.1.0+dfsg1-2 6 |sed |sed |4.9-2build3 7 |Shakespeare |N/A |- 8 |S-Lang |slsh |2.3.3-5build1 9 |Squirrel |squirrel3 |3.1-8.3 10 |Standard ML |polyml, libpolyml-dev |5.7.1-5build1 11 |Subleq |N/A |- 12 |SurgeScript |surgescript |0.6.1-1 13 |Swift |swiftlang |6.1.3-4build1 14 |Tcl |tcl |8.6.16build1 15 |tcsh |tcsh |6.24.13-2.1 16 |Thue |N/A |- 17 |TypeScript |node-typescript |5.2.2-2 18 |Unlambda |N/A |- 19 |Vala |valac |0.56.18-7 20 |Velato |N/A |- 21 |Verilog |iverilog |12.0-3 22 |Vimscript |vim |2:9.1.2141-1ubuntu4.2 23 |Visual Basic |dotnet-sdk-10.0 |10.0.111-0ubuntu1~26.04.1 24 |WebAssembly (Binary format) |wabt |1.0.36+dfsg+~cs1.0.36-2ubuntu1 25 |WebAssembly (Text format) |wabt |1.0.36+dfsg+~cs1.0.36-2ubuntu1 26 |Whitespace |N/A |- 27 |XSLT |xsltproc |1.1.45-0.1 28 |Yabasic |yabasic |1:2.91.4-1build1 29 |Yorick |yorick |2.2.04+dfsg1-14build1 30 |Zoem |zoem |21-341-2build1 31 |zsh |zsh |5.9-8ubuntu3 32 |Ada |gnat |14.1ubuntu2 33 |AFNIX |afnix |3.8.0-1.1ubuntu1 34 |Aheui |N/A |- 35 |ALGOL 68 |algol68g |3.1.2-1.2 36 |Ante |N/A |- 37 |AspectJ |aspectj |1.9.6-1build1 38 |Asymptote |asymptote |3.05+ds-2 39 |ATS |ats2-lang |0.4.2-5 40 |Awk |gawk |1:5.3.2-1ubuntu1.1 41 |bash |bash |5.3-2ubuntu1 42 |bc |bc |1.07.1-4build1 43 |BeanShell |bsh |2.0b4-20build1 44 |Befunge |N/A |- 45 |BLC8 |N/A |- 46 |Brainfuck |N/A |- 47 |C |gcc |4:15.2.0-5ubuntu1 48 |C++ |g++ |4:15.2.0-5ubuntu1 49 |C# |dotnet-sdk-10.0 |10.0.111-0ubuntu1~26.04.1 50 |Chef |N/A |- 51 |Clojure |clojure |1.12.0-1build2 52 |CMake |cmake |4.2.3-2ubuntu2 53 |Cobol |gnucobol4 |4.0~early~20200606-8build1 54 |CoffeeScript |coffeescript |2.7.0+dfsg1-4 55 |Common Lisp |clisp |1:2.49.20250504.gitf662209-2 56 |Crystal |crystal, libevent-dev |1.18.2+dfsg-1 57 |D |gdc |4:15.2.0-5ubuntu1 58 |dc |dc |1.07.1-4build1 59 |Dhall |dhall |1.42.3-1build1 60 |Elixir |elixir |1.18.3.dfsg-1build1 61 |Emacs Lisp |emacs-nox |1:30.2+1-2ubuntu1 62 |Erlang |erlang |1:27.3.4.6+dfsg-1 63 |Execline |execline |2.9.6.1-1build1 64 |F# |dotnet-sdk-10.0 |10.0.111-0ubuntu1~26.04.1 65 |FALSE |N/A |- 66 |Fennel |fennel |1.6.0+dfsg-1build1 67 |Flex |flex |2.6.4-8.2build2 68 |Fish |fish |4.2.1-3.2 69 |Forth |gforth |0.7.3+dfsg-9build4.1 70 |FORTRAN77 |f2c |20240504-1build1 71 |Fortran90 |gfortran |4:15.2.0-5ubuntu1 72 |Gambas script |gambas3-scripter, gambas3-gb-pcre |3.20.4-1ubuntu1 73 |GAP |gap |4.15.1-1 74 |GDB |gdb |17.1-2ubuntu1 75 |GEL (Genius) |genius |1.0.27-1build5 76 |Gnuplot |gnuplot |6.0.2+dfsg1-2ubuntu2 77 |Go |golang |2:1.26~1 78 |GolfScript |N/A |- 79 |G-Portugol |gpt |1.2.0-1 80 |Grass |N/A |- 81 |Groovy |groovy |2.4.21-10build1 82 |Gzip |gzip |1.14-1~exp2ubuntu1 83 |Haskell |ghc |9.10.3-4 84 |Haxe |haxe |1:4.3.7-1.1 85 |Icon |icont, iconx |9.5.25a-2 86 |INTERCAL |intercal |30:0.30-6 87 |Jasmin |jasmin-sable |2.5.0-3build1 88 |Java |openjdk-25-jdk |25.0.4+7-1~26.04 89 |JavaScript |nodejs |22.22.1+dfsg+~cs22.19.15-1ubuntu1 90 |Jq |jq |1.8.1-4ubuntu2 91 |JSFuck |nodejs |22.22.1+dfsg+~cs22.19.15-1ubuntu1 92 |Kotlin |kotlin |1.3.31+ds1-3ubuntu1 93 |ksh |ksh |20240113-1.0.10-2build1 94 |Lazy K |N/A |- 95 |LiveScript |livescript |1.6.1+dfsg-4 96 |LLVM asm |llvm |1:21.1.6-71 97 |LOLCODE |N/A |- 98 |Lua |lua5.3 |5.3.6-3 99 |M4 |m4 |1.4.21-1 100 |Makefile |make |4.4.1-3 101 |MiniZinc |minizinc |2.9.3+dfsg1-1 102 |Modula-2 |gm2 |4:15.2.0-5ubuntu1 103 |MSIL |mono-devel |6.14.1+ds2-2 104 |Mustache |ruby-mustache |1.1.1-2 105 |NASM |nasm |3.01-1 106 |Neko |neko |2.4.1-1build1 107 |Nickle |nickle |2.107 108 |Nim |nim |2.2.4-2 109 |Objective-C |gobjc |4:15.2.0-5ubuntu1 110 |OCaml |ocaml |5.4.0-3ubuntu1 111 |Octave |octave |11.1.0-3 112 |Ook! |N/A |- 113 |PARI/GP |pari-gp |2.17.3-1 114 |Parser 3 |parser3-cgi |3.5.1-3build1 115 |Pascal |fp-compiler |3.2.2+dfsg-49 116 |Perl 5 |perl |5.40.1-7build1 117 |Perl 6 |rakudo |2024.09-4build1 118 |PHP |php-cli |2:8.5+99ubuntu1 119 |Piet |N/A |- 120 |Pike |pike8.0 |8.0.1956-4 121 |PostScript |ghostscript |10.06.0~dfsg-3ubuntu1 122 |Prolog |swi-prolog |9.2.9+dfsg-1.1build1 123 |Promela (Spin) |spin |6.5.2+dfsg-2build1 124 |Python |python3 |3.14.3-0ubuntu2 125 |R |r-base |4.5.2-1ubuntu2 126 |Ratfor |ratfor |1.07-1build1 127 |rc |rc |1.7.4+97.gceb59bb-7 128 |REXX |regina-rexx |3.9.5+dfsg1-0.3
Note that some languages are not available in Ubuntu (marked as N/A).
This repository contains their implementations in vendor/.
See also vendor/README for detail.
A. Take your pick.
A. Good news: I have published a book, "The World of Obfuscated, Esoteric, Artistic Programming". It explains how to write a quine, an ascii-art quine, and an uroboros quine like this quine-relay. You can buy my book on amazon.co.jp.
(It also contains my almost all of my (about forty) works, including alphabet-only Ruby program, radiation-hardened quine, etc., and explains many techniques for writing such programs.)
Bad news: It is written in Japanese. I hope you can translate it into English and help me earn royalties.
A. See the language inclusion criteria in detail. (In short, please create a deb package and contribute it to Ubuntu.)
See also :heart:.
A. Are you trying to cross the world line?
A. Here you go.
A.
$ sudo apt-get install rake ruby-cairo ruby-rsvg2 ruby-gdk-pixbuf2 \
optipng advancecomp ruby-chunky-png
$ cd src
$ rake clobber
$ rake
Added: Ruby, Scala, Scheme, bash, Smalltalk, Unlambda, Tcl, Whitespace, Verilog, Vala, Ada, ALGOL 68, Awk, Brainfuck, Boo, C, C++, C#, Cobol, Clojure, Fortran90, FORTRAN77, Forth, Common Lisp, CoffeeScript, Groovy, Go, INTERCAL, Icon, Haskell, Jasmin, Java, LLVM asm, Logo, Lua, Makefile, MSIL, Objective-C, JavaScript, OCaml, Octave, Parrot asm, Pascal, Perl, PHP, Pike, Prolog, Python, R, REXX
Added: Scilab, S-Lang, SPL, LOLCODE, Maxima, NASM, Neko, Nickle, Ook!, PARI/GP, Piet, PPT (Punched tape), PostScript, Ratfor
Added: Subleq, Standard ML, Thue, Visual Basic, XSLT, Yorick, Zoem, A+, AFNIX, Ante, Asymptote, ATS, BLC8, Befunge, bc, Chef, CDuce, D, dc, eC, Emacs Lisp, Erlang, F#, Falcon, FALSE, Gambas script, GAP, GEL (Genius), Gnuplot, G-Portugol, Gri, Haxe, Julia, Lisaac, Lazy K, Kaya
Removed: Boo, Falcon, Kaya
Added: Elixir, Jq, Nim
Removed: SPL, Gri, Logo, Parrot asm
Added: Squirrel, Dafny, Grass, MiniZinc
Removed: CDuce
Added: Rust
Removed: Gambas script, Perl
Added: Shakespeare, sed, tcsh, TypeScript, Velato, Vimscript, Yabasic, zsh, Aheui, AspectC++, AspectJ, BeanShell, CMake, Flex, Fish, GDB, GolfScript, Gzip, Gri, JSFuck, ksh, LiveScript, M4, Mustache, nesC, Parser 3, Perl 5, Perl 6, Promela (Spin), rc
Removed: Scilab, G-Portugol, nesC
Added: Curry, Gambas script, GeneratorScriptingLanguage
Removed: Gri
Added: Scilab
Removed: AspectC++, eC
Added: SurgeScript, Dhall
Removed: Curry
Added: G-Portugol
Removed: Julia, Nim, Pike
Added: WebAssembly (Text format), WebAssembly (Binary format), Kotlin
Removed: Squirrel, GeneratorScriptingLanguage
Added: Crystal, Nim
Removed: Smalltalk
Added: Modula-2
Removed: PPT (Punched tape)
Added: Pike
Removed: Dafny, Maxima
Added: Execline, Squirrel
Removed: Lisaac
Added: Swift
Removed: A+
Added: Fennel
The MIT License applies to all resources
except the files in the vendor/ directory.
The files in the vendor/ directory are from third-parties
and are distributed under different licenses.
See vendor/README in detail.
The MIT License (MIT)
Copyright (c) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Yusuke Endoh (@mametter), @hirekoke
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No comments yet. Set the tone — say what you would want to know.