mame / quine-relay Goto Github PK
View Code? Open in Web Editor NEWAn uroboros program with 100+ programming languages
An uroboros program with 100+ programming languages
It's a must-have.
$ shasum -c SHA1SUMS
QR.rb: OK
QR.scala: OK
QR.scm: OK
QR.sci: OK
QR.bash: OK
QR.sl: OK
QR.st: OK
QR.spl: OK
QR.sml: OK
QR.sq: OK
QR.tcl: OK
QR.t: OK
QR.unl: OK
QR.vala: OK
QR.v: OK
QR.vb: OK
QR.ws: OK
QR.xslt: OK
QR.yorick: OK
QR.azm: OK
QR.+: OK
qr.adb: OK
QR.als: OK
QR.a68: OK
QR.ante: OK
QR.asy: OK
QR.dats: OK
QR.awk: OK
QR.bc: OK
QR.bef: OK
QR.Blc: OK
QR.boo: OK
QR.bf: OK
QR.c: OK
QR.cpp: OK
QR.cs: OK
QR.cd: OK
QR.chef: OK
QR.clj: OK
QR.cob: OK
QR.coffee: OK
QR.lisp: OK
QR.d: OK
QR.dc: OK
QR.ec: OK
QR.el: OK
QR.erl: OK
QR.fsx: OK
QR.fal: OK
QR.false: OK
QR.fs: OK
QR.f: OK
QR.f90: OK
QR.gbs: OK
QR.g: OK
QR.gel: OK
QR.plt: OK
QR.go: OK
QR.gpt: OK
QR.gri: OK
QR.groovy: OK
QR.hs: OK
QR.hx: OK
QR.icn: OK
QR.i: OK
QR.j: OK
QR.java: OK
QR.js: OK
QR.jl: OK
QR.k: OK
QR.lazy: OK
qr.li: OK
QR.ll: OK
QR.logo: OK
QR.lol: OK
QR.lua: OK
QR.mk: OK
QR.mac: OK
QR.il: OK
QR.asm: OK
QR.neko: OK
QR.5c: OK
QR.m: OK
QR.ml: OK
QR.octave: OK
QR.ook: OK
QR.gp: OK
QR.pasm: OK
QR.pas: OK
QR.pl: OK
QR.php: OK
QR.png: OK
QR.pike: OK
QR.ps: OK
QR.ppt: OK
QR.prolog: OK
QR.py: OK
QR.R: OK
shasum: QR.r:
QR.r: FAILED open or read
QR.rexx: OK
shasum: WARNING: 1 listed file could not be read
Made me wanna quit my job. Please fix.
Hi,
I'm on Arch Linux.
With these changes applied: (Makefile.patch) I got all the way to Pike (for now). This file also needs to be present: logo.sh.
"beef" can now be used instead of "brainfuck" and "clojure" can be used instead of "clj".
logo was troublesome. There might be better solutions.
Best regards,
Alexander Rødseth
This isn't complete yet.
You don't own a company with 50%, you need 51% or more.
http://en.wikipedia.org/wiki/LOLCODE
Bring in
HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
Hi!
Compiling with Maxima 5.34.1 on 64-bit Arch Linux:
maxima -q --init-mac=QR.mac > QR.il
debugger invoked on a SB-INT:SIMPLE-CONTROL-ERROR in thread
#<THREAD "main thread" RUNNING {100532ED53}>:
attempt to THROW to a tag that does not exist: RETURN-FROM-DEBUGGER
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [MACSYMA-QUIT] Maxima top-level
1: [CONTINUE ] Ignore runtime option --eval "(cl-user::run)".
2: [ABORT ] Skip rest of --eval and --load options.
3: Skip to toplevel READ/EVAL/PRINT loop.
4: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
("no debug information for frame")
0]
Just saying, your description has a typo. :)
When any interpreter/compiler fails to produce output, bash still creates an empty file. This confuses make
, which recognizes that file as a valid input for the next rule.
Can you add Nemerle language ( http://nemerle.org/ ) ?
Examples of quines in Nemerle: ( https://rsdn.org/forum/nemerle/4540959.all )
#pragma indent
def s = <##pragma indent
def s = <#{0}#>
System.Console.WriteLine(s, s)#>
System.Console.WriteLine(s, s)
or
def s= <#def s= <#{0}#>;System.Console.WriteLine(s, s)#>;System.Console.WriteLine(s, s)
Syntax of '<# ... #>' means string.
It is same as " ... " but allows any character and allows recursion.
Thanks.
Hi,
When running quine-relay with Clojure 1.6.0 (released around 2014-03-26), the chain of compilation stops. I'm on 64-bit Arch Linux. This is the error message:
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: in this context, compiling:(/home/alexander/.quine-relay/QR.clj:0:0)
at clojure.lang.Compiler.analyze(Compiler.java:6464)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler.eval(Compiler.java:6707)
at clojure.lang.Compiler.load(Compiler.java:7130)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$script_opt.invoke(main.clj:336)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve symbol: in this context
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler.resolveIn(Compiler.java:6940)
at clojure.lang.Compiler.resolve(Compiler.java:6884)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6845)
at clojure.lang.Compiler.analyze(Compiler.java:6427)
... 12 more
Best regards,
Alexander Rødseth
I am looking forward when you complete this section.
When compiling QR.c, I get the following results:
quine-relay% tcc -o QR QR.c
QR.c:2: error: declaration expected
quine-relay% gcc -o QR QR.c
QR.c:2:13091: error: expected identifier or ‘(’ before ‘}’ token
\\\\\\\"s)))\\\").Replace(\\\"~\\\",\\\"\\\\\\\\\\\"));}}\");}");return 0;}}}}
^
QR.c:2:13092: error: expected identifier or ‘(’ before ‘}’ token
\\\\\\\"s)))\\\").Replace(\\\"~\\\",\\\"\\\\\\\\\\\"));}}\");}");return 0;}}}}
^
QR.c:2:13093: error: expected identifier or ‘(’ before ‘}’ token
\\\\\\\"s)))\\\").Replace(\\\"~\\\",\\\"\\\\\\\\\\\"));}}\");}");return 0;}}}}
^
quine-relay% clang -o QR QR.c
QR.c:2:13091: error: extraneous closing brace ('}')
QR.c:2:13092: error: extraneous closing brace ('}')
QR.c:2:13093: error: extraneous closing brace ('}')
3 errors generated.
This is for
tcc version 0.9.26 (x86-64 Linux)
gcc (GCC) 5.2.0
clang version 3.7.0 (tags/RELEASE_370/final)
The preceeding step is using the beef brainfuck compiler: http://kiyuko.org/software/beef
This is for the "50"-branch, on 64-bit Arch Linux.
icont QR.icn
runs without issue.
Running ./QR > QR.i
produces the error message:
./QR: 8: exec: iconx: not found
and produces a blank output.
This is on a VM running Linux Mint 17 64-bit. I had previously installed all the required packages exactly as was listed in the README.
So I did:
dsm@work ~/workspace/toys % git clone https://github.com/mame/quine-relay.git
Cloning into 'quine-relay'...
remote: Counting objects: 273, done.
remote: Compressing objects: 100% (153/153), done.
remote: Total 273 (delta 159), reused 224 (delta 118)
Receiving objects: 100% (273/273), 329.72 KiB | 174 KiB/s, done.
Resolving deltas: 100% (159/159), done.
dsm@work ~/workspace/toys % ll
total 12
drwxrwxr-x 3 dsm dsm 4096 Aug 15 16:37 ./
drwxrwxr-x 9 dsm dsm 4096 Aug 15 16:37 ../
drwxr-xr-x 4 dsm dsm 4096 Aug 15 16:37 quine-relay/
dsm@work ~/workspace/toys % cd quine-relay
dsm@work ~/workspace/toys/quine-relay
% ruby QR.rb
QR.rb:54: (eval):53: (eval):1: compile error (SyntaxError)
(eval):1: syntax error, unexpected '>'
B=92.chr;N=10.chr;n=0;e=->(s){Q[Q[s,B],?"].gsub(N,B+?n)}...
^
(eval):1: syntax error, unexpected '{', expecting $end
B=92.chr;N=10.chr;n=0;e=->(s){Q[Q[s,B],?"].gsub(N,B+?n)};E=-...
^
dsm@work ~/workspace/toys/quine-relay
%
oops.
Running on:
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
Linux work 3.2.0-51-generic-pae #77-Ubuntu SMP Wed Jul 24 20:40:32 UTC 2013 i686 i686 i386 GNU/Linux
When I get to the line that uses the fpc compiler, fpc QR.pas && ./QR > QR.pl
, I get the following error message:
Compiling QR.pas
QR.pas(1,32) Error: Constant strings can't be longer than 255 chars
QR.pas(2) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
I'm trying to find an option flag for the compiler that will make it accept longer constant strings, but can't find one so far.
Naturally, this also can be fixed by breaking it into shorter strings concatenated by +
, so long as you could chase the relay back up to the point where they should be inserted.
How long did it take you?
I’d love to see all the code files without all the hassle involved in installing everything.
> gfortran -o QR QR.f && ./QR > QR.f90
gfortran: internal compiler error: Killed (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
> gfortran --version
GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
The source file is 27685 lines long, so I'm going to pass on putting it here.
> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
I used your apt-get
line to install everything (except clojure; couldn't find package clojure1.4
). Do I need to upgrade Fortran?
It is madness 💯
It has the 'signed integer labels' bug.
The string of bits use for a label definition is (by the reference interpreter) supposed to be just that. A string of anonymous bits. It does not begin with a sign bit and leading zeros are significant.
For example, using your intermediate form all these are different labels (marks).
200 0012
200 012
200 102
200 12
200 2
If you want you could say it uses a bijective positional notation
NB: This doesn't have to change the 'quine' but in theory could make the Whitespace step shorter. (Nevermind, just noticed it's a huge print command)
For example, as a quick hack, adding this line seems to work.
num = "01" + num if (num && insn != :push && insn != :copy && insn != :slide)
Title says it all. I forked with the intent of updating the README, but it looks like the README is generated, and I don't have enough time to re-learn ruby and fix it right now.
Getting all the compilers/interpreters to run is pretty hard if your repos are outdated, you're using a RPM distro etc. Although many people have forked and compiled this, it would be nice to have the intermediate sources in the main repository.
Or is this only working for your source code, if the source code changes the relay doesn't work?
Hi,
When running the latest revision of quine-relay on Arch Linux, I get the following error:
#######################
## Fortran90 -> Go ##
#######################
gfortran -o QR QR.f90
QR.f90:25380.10:
&A,&
1
Error: Invalid character in name at (1)
QR.f90:38057.10:
&char(112 ),&
1
Error: Invalid character in name at (1)
QR.f90:50744.23:
end program QR
1
Error: Syntax error in END PROGRAM statement at (1)
make: *** [QR.go] Error 1
This is the version of gfortran:
GNU Fortran (GCC) 4.8.1 20130725 (prerelease)
Thanks
I don't have time to download and install 50 compilers or interpreters, so does this thing work?
Since very few of us will actually have all the software required to follow this through (and some of us are unable / unwilling) to install it all), I suggest that you record it running with asciinema.
Why is ✡ incorporated into the image in the readme?
I ran your code on ubuntu 13.04.
I had to download more then 1Gb of stuff from apt-get, and during some compilations the computer would hang for a while, but in the end it worked beatifully. I and my coworkers around me were fascinated with it.
When I opened meld with QR.rb and QR2.rb, everyone screamed a big "WHOOOAA!"... it was really fun. Thank you for this :-)
Now, I'm very curious to understand how is this even possible.
Do you think you could explain, in a high level how do you go about building something like this?
For example, start with how you would build a Quine with 2 languages (like Python and Java), and how would you add a third language, and how could you play with characters positioning to get a arbitrary ascii art and still get the desired end result.
You might want to answer here or make a blog post about it, whatever you think it's best.
I'm unable to pass the lisaac step.
I tried on a fresh install, I tried with the dockerfile. That used to work but it's now broken somehow.
lisaac qr.li && ./qr > QR.ll
ERROR: `-lm' library for GCC not found.
Hi, all the steps up until gcc
succeeds:
gcc -o QR QR.c && ./QR > QR.cpp
QR.c:1:1: error: stray ‘\33’ in program
#include<stdio.h>
^
QR.c:1:2: error: expected identifier or ‘(’ before ‘[’ token
#include<stdio.h>
^
QR.c:1:4: error: invalid suffix "h" on integer constant
#include<stdio.h>
^
QR.c:1:9: error: stray ‘#’ in program
#include<stdio.h>
^
I'm on 32-bit Arch Linux.
Versions:
ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
Scala compiler version 2.10.0-20121205-235900-18481cef9b -- Copyright 2002-2012, LAMP/EPFL
Gauche scheme shell, version 0.9.3.3 [utf-8,pthreads], i686-pc-linux-gnu
GNU bash, version 4.2.45(2)-release (i686-pc-linux-gnu)
GNU Smalltalk version 3.2.5
tclsh 8.6
Vala 0.20.1
Icarus Verilog version 0.9.6 (v0_9_6)
GNATMAKE 4.8.1
Algol 68 Genie 2.7
GNU Awk 4.1.0, API: 1.0 (GNU MPFR 3.1.2, GNU MP 5.1.2)
Boo Compiler version 0.9.4.9 (3.0.7 (tarball Fri May 24 20:12:53 UTC 2013))
Beef 1.0.0
gcc (GCC) 4.8.1
(I'm trying to make the whole chain work on Arch Linux, building and submitting packages as I go).
XProc implementation : xmlcalabash ( http://xmlcalabash.com/ ) available on github https://github.com/ndw/xmlcalabash1
A possible Quine is https://github.com/innovimax/xproc/blob/master/quine.xpl
This is more than a cool program – it's a computer science breakthrough! Apparently, you have discovered a method for constructing quines based on an arbitrary blueprint involving any amount of languages.
Please write a technical paper describing your approach. I'm sure you'll have no trouble finding a CS journal that will publish it.
Hi,
congratulations on your madness.
I am trying to build your Rube Goldberg Eternatron. I've got 83 K of Scala from your initial Ruby file, but then ran into trouble:
error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:53)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:45)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:45)
at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
at scala.reflect.internal.Mirrors$RootsBase.getClassByName(Mirrors.scala:102)
at scala.reflect.internal.Mirrors$RootsBase.getRequiredClass(Mirrors.scala:105)
at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:257)
at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:257)
at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1394)
at scala.tools.nsc.Global$Run.<init>(Global.scala:1215)
at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
at scala.tools.nsc.Driver.process(Driver.scala:51)
at scala.tools.nsc.Driver.main(Driver.scala:64)
at scala.tools.nsc.Main.main(Main.scala)
I am using the build instructions provided "manually", because the Makefile complains that I do not have all the compilers (Scheme, in my case). That's true, but only because I lack the 3.5 GB of disk space to install all the missing ones (don't worry, I'll buy a new disk soon to rectify this!).
ruby QR.rb > QR.scala
completes fine.
scalac QR.scala && scala QR > QR.scm
yields the error above.
💥
http://en.wikipedia.org/wiki/Pizza_(programming_language)
Good job though.
Sadness ensues =(
########################
## Icon -> INTERCAL ##
########################
icont -s QR.icn
File QR.icn; Line 1 # "%": invalid argument
File QR.icn; Line 1 # "%": invalid argument
File QR.icn; Line 1 # "%": invalid argument
make: *** [QR.i] Error 1
Version:
$ dpkg -s icont
Package: icont
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 176
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Source: icon
Version: 9.4.3-3
Depends: libc6 (>= 2.7)
Recommends: iconx
Suggests: icon-ipl
Note I got a warning from Cobol:
#############################
## Cobol -> CoffeeScript ##
#############################
cobc -O2 -x QR.cob
/tmp/cob3127_0.c: In function ‘QR_’:
/tmp/cob3127_0.c:77:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
(*(int *) (b_1)) = 0;
^
/tmp/cob3127_0.c:78:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
(*(int *) (b_2)) = 0;
^
/tmp/cob3127_0.c:79:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
(*(int *) (b_3)) = 0;
^
/tmp/cob3127_0.c:90:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
(*(int *) (b_3)) = cob_call_params;
^
/tmp/cob3127_0.c:109:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
cob_stop_run ((*(int *) (b_1)));
^
/tmp/cob3127_0.c:113:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
return (*(int *) (b_1));
^
./QR > QR.coffee
I installed everything with the apt-get command provided, except manually installed Clojure 1.4 and Ruby 2.0.0 .
Running from the Docker image built locally on Docker for Mac, I get the following error when running make
:
##############################
## 77: Maxima -> MiniZinc ##
##############################
maxima -q --init-mac=QR.mac > QR.mzn
Makefile:685: recipe for target 'QR.mzn' failed
make: *** [QR.mzn] Error 255
make: *** Deleting file 'QR.mzn'
When I run the command maxima -q --init-mac=QR.mac
I get the following:
personality failure 1
I verified that the file SHA1 matches.
root@bfa052cfb044:/usr/local/share/quine-relay# sha1sum QR.mac
a92ec44504c8ff952bb9adc5d572ae78ec344e2d QR.mac
root@bfa052cfb044:/usr/local/share/quine-relay# cat SHA1SUMS | grep QR.mac
a92ec44504c8ff952bb9adc5d572ae78ec344e2d *QR.mac
See WWDC'14. :-)
Why? Why? Why?
I see you have Visual Basic, but what about FreeBASIC? Please consider adding it. :-)
Hi,
The quine-relay-git has no comments and no "out-of-date" flags, but it fails when compiling clojure:
clojure QR.clj > QR.cob
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: in this context, compiling:(/home/alexander/.quine-relay/QR.clj:0:0)
at clojure.lang.Compiler.analyze(Compiler.java:6464)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler.eval(Compiler.java:6707)
at clojure.lang.Compiler.load(Compiler.java:7130)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$script_opt.invoke(main.clj:336)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve symbol: in this context
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler.resolveIn(Compiler.java:6940)
at clojure.lang.Compiler.resolve(Compiler.java:6884)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6845)
at clojure.lang.Compiler.analyze(Compiler.java:6427)
... 12 more
Makefile:184: recipe for target 'QR.cob' failed
Have you seen this before? Do you know what can be done to fix it?
Without this working, I'm having a hard time fixing/updating the quine-relay-git package, ref: "If you are using Arch Linux, you might want to ask @xyproto to update the quine-relay-git package :-)"
Is this a problem with the clojure package?
Any help is welcome.
Best regards,
Alexander F Rødseth / xyproto
Ubuntu 13.04 64bit 2GB RAM (Virtualbox):
##########################
## INTERCAL -> Jasmin ##
##########################
mv QR.c QR.c.bak
ick -b QR.i
gcc: internal compiler error: Ucciso (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Resolved growing the RAM to 4GB. Maybe it could help someone :-)
Many systems have Guile installed as a dependency of various other programs. It is a Scheme implementation:
guile QR.scm > QR.bash
I'll try to add Rust.
For eC, may I suggest depending on ecere-dev rather than ecere-sdk, this would avoid downloading the heavy ecere-samples package (bunch of graphics and 3D models in there).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.