quot;-char(34)-char(39))-char(36)-"quot;) as quine'-char(34)-char(39))-char(36)-'select replace(replace("quot;-char(34)-char(39))-char(36)-"quot;) as quine') as quine some programming languages have the ability to evaluate a string as a program. quines can take advantage of this feature. for example this ruby quine eval s="print 'eval s=';p s" lua can do s="print(string.format('s=%c%s%c; load(s)()'-34-s-34))"; load(s)() in python 3.8 exec(s:='print("exec(s:=%r)"%s)') in many functional languages including scheme and other lisps and interactive languages such as apl numbers are self-evaluating. in ti-basic if the last line of a program returns a value the returned value is displayed on the screen. therefore in such languages a program consisting of only a single digit results in a 1-byte quine. since such code does not construct itself this is often considered cheating in some languages particularly scripting languages but also c an empty source file is a fixed point of the language being a valid program that produces no output. such an empty program submitted as "the world's smallest self reproducing program" once won the "worst abuse of the rules" prize in the international obfuscated c code contest. the program was not actually compiled but used `cp` to copy the file into another file which could be executed to print nothing # # source code inspection quines per definition cannot receive any form of input including reading a file which means a quine is considered to be "cheating" if it looks at its own source code. the following shell script is not a quine # !/bin/sh invalid quine reading the executed file from disk is cheating cat $0 a shorter variant exploiting the behavior of shebang directives other questionable techniques include making use of compiler messages; for example in the gw-basic environment entering "syntax error" will cause the interpreter to respond with "syntax error" quine code can also be outputted visually for example it's used to visualize the neutral zone in yars' revenge along with syntactic saccharin to obfuscate the source code the quine concept can be extended to multiple levels of recursion giving rise to "ouroboros programs" or quine-relays. this should not be confused with multiquines such programs have been produced with various cycle lengths **+** haskell → python → ruby **+** python → bash → perl **+** c → haskell → python → perl **+** haskell → perl → python → ruby → c → java **+** ruby → java → c→ python **+** c → c++ → ruby → python → php → perl **+** ruby → python → perl → lua → ocaml → haskell → c → java → brainflock → whitespace → unlambda **+** ruby → scala → scheme → scilab → shell (bash) → s-lang → smalltalk → squirrel3 → standard ml → ... → rexx (128 (and formerly 50) programming languages) **+** web application → c (web application source code consists of html javascript and css) david madore creator of unlambda describes multiquines as follows > a multiquine is a set of r different programs (in r different languages - without this condition we could take them all equal to a single quine) each of which is able to print any of the r programs (including itself) according to the command line argument it is passed. (cheating is not allowed: the command line arguments must not be too long - passing the full text of a program is considered cheating) a multiquine consisting of 2 languages (or biquine) would be a program which **+** when run is a quine in language x **+** when supplied with a user-defined command line argument would print a second program in language y **+** given the second program in language y when run normally would also be a quine in language y **+** given the second program in language y and supplied with a user-defined command line argument would produce the original program in language x a biquine could then be seen as a set of two programs both of which are able to print either of the two depending on the command line argument supplied theoretically there is no limit on the number of languages in a multiquine. a 5-part multiquine (or pentaquine) has been produced with python perl c newlisp and fand there is also a 25-language multiquine similar to but unlike a multiquine a polyglot program is a computer program or script written in a valid form of multiple programming languages or file formats by combining ir syntax. a polyglot program is not required to have a self-reproducing quality although a polyglot program can also be a quine in one or more of its possible ways to execute unlike quines and multiquines polyglot programs are not guaranteed to exist between arbitrary sets of languages as a result of kleene's recursion theorem because they rely on the interplay between the syntaxes and not a provable property that one can always be embedded within another a radiation-hardened quine is a quine that can have any single character removed and still produces the original program with no missing character. of necessity such quines are much more convoluted than ordinary quines # automatic generation using relational programming techniques it is possible to generate quines automatically by transforming the interpreter (or equivalently the compiler and runtime) of a language into a relational program and then solving for a fixed point **+** diagonal lemma **+** droste effect **+** fixed point combinator **+** self-modifying code **+** self-interpreter **+** self-replicating machine **+** self-replication **+** self-relocation **+** tiddlywiki **+** tupper's self-referential formula **+** programming languages **+** quine's paradox **+** polyglot (computing) 1. examples include bash perl and python **+** douglas hofstadter: gödel escher bach: an eternal golden braid **+** ken thompson: "reflections on trusting trust" (communications of the acm 27(8):761-3) **+** tiddlywiki a quine manifested as a wiki **+** the quine page (by gary p. thompson) **+** a brief guide to self-referential programs **+** quineprogram at the portland pattern repository wiki **+** david madore's discussion of quines **+** zip file quine **+** zip files all the way down **+** an introduction to quines - in particular quines using more than one language **+** quine web page: a standards-conforming html+javascript web page that shows its own source code **+** html quine: an html page that only uses html and css to show its own source code **+** quine challenge for tom's javascript machine with a series of interactive hints **+** a java quine built straight from kleene's fixed point theorem composition and s-n-m **+** a qr code quine // republic of bob