Model or dataset
mame/quine-relay avatar
mame/quine-relay

mame/quine-relay: a 128-language quine chain you build yourself

An uroboros program with 100+ programming languages

14,607 stars566 forksRubyLicense varies

At a glance

What is it?
The repository holds one Ruby file that regenerates itself through 128 interpreters and compilers in sequence. The README's own build log is the honest measure of what running it costs.
Who is it for?
Adopt quine-relay if you want a working reference for self-reproducing programs across many language runtimes and you are willing to install roughly 120 interpreter and compiler packages on Ubuntu 26.04 or run the Dockerfile instead. Do not adopt it as a library, a build dependency, or anything you expect to keep running unattended: the chain has no rollback, the Makefile aborts on the first missing interpreter, and the README names no licence.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository last received commits 28 days ago.
What is it written in?
Mainly Ruby, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What mame/quine-relay actually is

A quine is a program that prints its own source code. quine-relay takes that idea and chains it: QR.rb is a Ruby program that generates a Rust program, which generates a Scala program, and so on through 128 languages, until the last program in the sequence emits the original Ruby code again. The repository's own diagram calls this a language uroboros.

The author is Yusuke Endoh, who is also the maintainer behind the mame GitHub account. The README points to a 50-language branch for the older version, so the current master is the 128-language chain. The only topic on the repository is quine, and the primary language listed is Ruby, which reflects QR.rb itself rather than the 128 outputs.

This is not a library and not a tool you import. It is a demonstration, plus the scaffolding needed to reproduce the demonstration on a clean Ubuntu machine. The audience is narrow: people interested in quines, esoteric languages, and the mechanics of self-reproduction, and people who want to see how far a single generation chain can be pushed before the toolchain gives out.

How the chain moves from Ruby to REXX and back

The data flow is linear. Each step reads a file and writes a new file in a different language. QR.rb is run by Ruby and writes QR.rs. rustc compiles QR.rs to a binary named QR; running it writes QR.scala. scalac compiles that, scala runs it, and the output is QR.scm for Guile. The README lists the steps in order, and the Makefile encodes the same order as dependencies, with each step echoing a banner such as "1: Ruby -> Rust" before it runs.

The chain passes through general-purpose languages (Rust, Scala, Scheme, C, C++, C#, Java, Go, Haskell, OCaml, Swift, Kotlin, Lua, Perl, PHP, Python, Ruby), shell languages (bash, ksh, tcsh, zsh, fish, execline), and a long tail of esoteric and special-purpose ones. There is sed, dc, m4, make, awk, bc, gnuplot, GDB command files, Vim script, XSLT, and Whitespace. Some steps need a helper in vendor/: subleq.rb, thue.rb, unlambda.rb, whitespace.rb, blc.rb, bf.rb, false.rb, grass.rb, golfscript.rb, aheui.rb, ante.rb, and compilechef. Those helpers are Ruby scripts that translate a notation the host system cannot execute into something it can.

A few steps deserve attention because they show the seams. The dc step ends with "|| true", so a failure there does not stop the run. The gpt step moves QR.c aside, generates a new QR.c, compiles it, and then restores the backup with mv QR.c.bak QR.c. The VB.NET and F# steps write a temporary .vbproj or .fsproj file into the working directory and run dotnet run against it. The Makefile declares .DELETE_ON_ERROR, so a failed recipe removes its target instead of leaving a half-written file that the next step would consume.

Installing quine-relay on Ubuntu 26.04

The README gives one supported path, and it is Ubuntu 26.04 (Resolute Raccoon). The first command installs the interpreters and compilers, and it is long by design:

bash
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

A second group of packages supports the bundled interpreters that live in vendor/:

bash
sudo apt-get install cmake libpng-dev libgd-dev libfl-dev groff bison curl
make -C vendor

With everything in place, the README's usage section shows the first real step. The stack limit matters, because several generated programs recurse deeply:

bash
ulimit -s unlimited
ruby QR.rb > QR.rs
rustc QR.rs && ./QR > QR.scala

After those three lines you have QR.rs, a compiled binary named QR, and QR.scala. If you prefer not to install 120 packages on your own machine, the repository ships a Dockerfile that starts from ubuntu:26.04 and installs the same set in batches, using chronic from moreutils to keep the apt output quiet. The Makefile drives the whole sequence: make all produces QR2.rb and then runs diff -s QR.rb QR2.rb, which is the check that the chain closed. make check goes further and verifies SHA256SUMS.

Where the chain breaks, and why it is not a build dependency

The Makefile opens with a find_any macro that probes for alternatives: nodejs, node, or js for JavaScript; guile, csi, or gosh for Scheme; gbs3, gbs2, or gba3 for Gambas; wasmtime or node for the WASI runtime. If none is present, the macro raises "interpreter not found!" and the build stops. There is no partial mode and no way to skip a language and rejoin the chain later, because each output is the input to the next step. One missing interpreter costs you the whole run.

The README's own command list is fragile in places that are visible in the text. The dc step carries "|| true", which means a dc failure is tolerated and the run continues with whatever QR.dhall contains. The gpt step temporarily overwrites QR.c and restores it afterwards, so an interrupted run can leave QR.c in the generated state rather than the original. The dotnet steps write tmp.vbproj, tmp.csproj, and tmp.fsproj into the repository root, which means the working tree is not read-only. The Makefile's .DELETE_ON_ERROR softens the failure mode for Make-driven runs, but the README's hand-typed command list has no such protection.

None of this is a defect in the demonstration; it is the nature of a chain that depends on 128 separately installed toolchains. The wrong use is treating quine-relay as something to vendor into a project, wrap in CI for a product, or run on a machine you care about. It installs compilers, writes temporary project files, and in at least one place deliberately overwrites a source file mid-run.

The Dockerfile route and what it does not solve

The Dockerfile is the same dependency set expressed as image layers, starting from ubuntu:26.04 with DEBIAN_FRONTEND set to noninteractive. It groups packages into RUN lines with chronic apt-get -qq install -y, followed by chronic apt-get clean, which keeps the build log readable and the layer sizes down. If you only want to watch the chain run once, this is the shorter path: build the image, then invoke make inside it.

The image does not remove the underlying constraints. A container still needs the same packages present at build time, so the build is long and pulls a large amount of software. The WASI runtime is still resolved by the Makefile at run time, either as wasmtime or as node with --experimental-wasi-unstable-preview1 and vendor/wasi-runtime.js. The dotnet steps still write temporary project files, though inside the container that is harmless. And the Dockerfile inherits the Ubuntu 26.04 assumption: package names such as dotnet-sdk-10.0, openjdk-25-jdk, and swiftlang are tied to that release, so a different base image would need the package list reworked.

How quine-relay differs from a single-language quine

A conventional quine is one program in one language that prints itself. The classic trick is to hold the source in a string and print that string with the string substituted into itself, so the output is byte-identical to the input. The related search terms people use, such as how to write a quine or quine in C, describe that single-language exercise.

quine-relay takes a different approach. Instead of one program reproducing itself directly, it builds a cycle of 128 programs, each written in a different language, where the composition of all 128 steps is the identity on QR.rb. No individual step is a quine; the cycle as a whole is. That difference changes the engineering problem completely. A single-language quine is a puzzle about quoting and self-reference. quine-relay is a puzzle about quoting plus a dependency problem: 128 toolchains, each with its own invocation syntax, must be present and must behave as the generator expects. The Makefile's diff -s QR.rb QR2.rb is the moment where the whole cycle is either correct or not, and there is no intermediate signal that tells you which of the 128 steps went wrong.

Maintenance, upgrade cost and licence status

The repository is not archived, and the last push was on 2026-09-01, so it is being touched. That does not translate into a stable interface, because there is no interface to stabilise: the deliverable is QR.rb plus the build recipe around it, and the recipe is tied to Ubuntu 26.04 package names. Upgrading means moving to a new Ubuntu release and re-checking every package in the apt-get line, including the ones that pin a version, such as dotnet-sdk-10.0, openjdk-25-jdk, and swiftlang. A package rename or removal in a future release breaks the documented path, and the Makefile's fallback probing only covers four of the languages.

The repository provides no releases, so there is nothing to pin to. Anyone depending on this would track the master branch and re-run make check against SHA256SUMS after each change, which is the only integrity signal the project ships.

The README does not state a licence, and the top-level entries listed for the repository do not include a licence file. Without a stated licence, the default position is that the author retains rights, so redistributing QR.rb or the generated files is a question for the author rather than something the documentation settles. Check the repository for a licence before reusing any of it.

Editorial conclusion

Adopt quine-relay if you want a working reference for self-reproducing programs across many language runtimes and you are willing to install roughly 120 interpreter and compiler packages on Ubuntu 26.04 or run the Dockerfile instead. Do not adopt it as a library, a build dependency, or anything you expect to keep running unattended: the chain has no rollback, the Makefile aborts on the first missing interpreter, and the README names no licence. Verify the licence file, the SHA256SUMS check, and whether your platform supplies every package the apt-get line asks for before you commit a machine to it.

Frequently asked questions

What is a quine in programming?

A quine is a program that prints its own source code. In quine-relay the idea is extended to a cycle: QR.rb generates a chain of 128 programs, and the last one regenerates QR.rb.

How to make quine?

The README's approach is to write one program per language that emits the next language's source, then run them in sequence. quine-relay's Makefile encodes that sequence as dependencies, and make all finishes with diff -s QR.rb QR2.rb to confirm the cycle closed.

What is a Python quine?

A Python quine is a single Python program that prints its own source. quine-relay is a different exercise: Python appears as one link in the 128-language chain rather than as a self-contained quine, and the repository's primary language is Ruby.

Official sources

  1. Issues
  2. mame/quine-relay on GitHub
  3. README
For maintainers

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/mame-quine-relay.svg)](https://hysenlabs.com/projects/mame-quine-relay)
Community notes

Community notes