Writing a triple polyglot script(nkanaev.github.io) |
Writing a triple polyglot script(nkanaev.github.io) |
https://codegolf.stackexchange.com/a/198810/71130
Each language was added by a distinct answer, each answer building on the work of all the previous ones. The community teamwork in building such a monstrosity is beautiful.
Thank you for posting this, it's brilliant! Now to look at a tree or something until I can identify which way is up again.
Instead of being parsed, it was `import`-ed and `include`-d in Python code and Makefiles. It had a `.py` extension so it took me a while to figure out why everything was breaking when I added some Python code in it. All in all, a very cursed setup.
A more impressive alternative would be writing nested interpreters in multiple languages... Or writing code which runs in one "language" and then self modifies to another language which runs and subsequently self modifies, and so on.
CuG #%* POLYGLOT - a program in eight languages 15 February 1991 *+Ex=https://www.alchemistowl.org/pocorgtfo/
I mean, does HN filter out PoC||GTFO release announcements or something? I seem to remember there being mention that it might've hit the filter list ..
Haha, very cool though!
I came up with: https://github.com/sorbet/sorbet/blob/master/gems/sorbet/bin...
rem () { ./bash-version.bash; exit $?; }
rem skip rest of script if executed by bash
rem batch script follows:
IF %blah% EQU 0 etc.Usual solve is %3 = fizz, %5 = buzz, %15 = fizzbuzz ...
If you change 3 or 5, you now have to go edit 15 too, does that not seem like a problem?
Nicely done.