Yes, and if it's about the most minimal non-empty quine pretty sure it would be this:
s='s=%r;print(s%%s)';print(s%s)
Anyway, let's make it a bit less boring and make it a C/Python polyglot (not relay) quine:
#include<stdio.h>
#define len int main(){char*
#define zip return 0;}
#if 0
def printf(f,*a):print(f%a,end=str())
#endif
len
s="#include<stdio.h>%c#define len int main(){char*%c#define zip return 0;}%c#if 0%cdef printf(f,*a):print(f%%a,end=str())%c#endif%clen%cs=%c%s%c;printf(s,10,10,10,10,10,10,10,34,s,34,10);zip%c";printf(s,10,10,10,10,10,10,10,34,s,34,10);zip
There is one interesting conclusion to be derived from this exercise - in Python, '%r' is a fixed point of the function f(x)=x%x.
And yes, this is the most boring quine, you've punted the problem to the formatting mini-language and solved it in a manner equivalent of print(open(argv[0]).read()). I would say perhaps the ideal formulation for producing an interesting quine that doesn't leverage other languages would be "write a quine in C, using no preprocessor directives and no external functions except the POSIX write function, you may assume stdout is 1". So your program would look like:
extern long write(int, const void *, unsigned long);
int main(int, char**) {
/* your code here, using write(1, buf, count) for output */
return 0;
}
You would of course end up writing a function equivalent to 'x%x' in Python, but getting there is a bit more exciting.
Or write a binary quine that doesn't read it's own program memory. I wrote a Python script that generates appropriate NASM code: https://github.com/panzi/binary-quine
Did it that way so I don't need to learn about the ELF format, but use several passes to get a binary that is a quine.
No reason to stop at print("print()"), you can nest further, print('print("print()")'). And then you can short-circuit the process, write a single program which first does print(), then print("print()"), then print('print("print()")'), then the next level, then the next level, etc. And no need to stop there: once you have that program, you can print IT. And then continue the process.
Or write an infinitely long source code. This is technically---and I stress only technically---possible in not all but many languages, where an infinitely sized code is not explicitly disallowed. C is a surprisingly rare counterexample, which even doesn't allow for an infinitely sized memory anyway (because the pointer should be finitely sized).
A slightly more general formula works in any language that can manipulate strings, without leveraging the built-in escaping mechanism. Basically, create a program that prints a variable, but replaces a token in the variable with the contents of another variable, properly escaped for the target language. Finally, replace the content of the variable with the entire source code of the program. Naively applying this formula to Python gives you this: step 1:
The beauty of this approach is that you could include the definition of the repr function in the code, so it works in any language that can manipulate strings. Another generally-applicable approach is to use eval: write a program that prints a variable assignment and an eval of that variable, then wrap that program in a variable and eval it:
Again this uses "!r" for brevity but it could easily include the function responsible for doing the escaping. Requires eval, so not as universally applicable as the previous method (but produces shorter quines).
Anyone aware of other generally-applicable techniques for producing quines?
It was interesting to see the author work through the major obstacles one by one when writing a quine. Glad they didn't take the actual boring route!