Questions tagged [polyglot]
For challenges involving code that runs in multiple programming languages.
108 questions
1
vote
2
answers
191
views
Abuse some parsers your way to a Polyglot [closed]
Many polyglots fill in the blanks between languages by either making code that is ignored in one language or loading code dynamically.
This time, let's write a polyglot that works without that. This ...
1
vote
0
answers
90
views
Write a piece of Quine code that can be excuted by both C and Python [duplicate]
Write a piece of code that is compatible with both C and Python compilers/interpreters, which can output its own source code.
Quine is quite easy, but how about this double language version?
Hint:
To ...
-2
votes
1
answer
148
views
PHP+C polyglot solution to mixed types
Some built-in functions in PHP return mixed types, like file_get_contents that returns both string or ...
27
votes
15
answers
4k
views
Reverse the polyglot, change the language
Task
Write a polyglot in two languages that when run, outputs the name of the language it is run in. Additionally, this program must also output the other language's name if the source code is ...
6
votes
1
answer
263
views
Need some feedback with PHP+C polyglot code and class/struct properties [closed]
If you consider the following PHP+C polyglot snippet, there is a problem regarding class property access in the printf call:
...
10
votes
9
answers
2k
views
Polyglot Quiz (Robbers' thread)
This is the robbers' thread. For the main rules to this challenge see the cops' thread
In this challenge, robbers will choose a cop's vulnerable or safe post and try to figure out a pair of languages ...
22
votes
15
answers
3k
views
Polyglot Quiz (Cops' thread)
This is the cops' thread of a cops-and-robbers challenge. The robbers' thread can be found here
In this challenge as a cop you will choose two programming languages A and B, as well as a non-empty ...
6
votes
2
answers
331
views
Case Conversion Polyglot
Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of ...
-14
votes
5
answers
481
views
12 with no 1234567890, but polyglot
This is my 12th question, so I thought of this idea.
Goal:
Output 12, with any preceding or trailing whitespace permitted
In as many languages as possible (where different versions or flags count as ...
19
votes
3
answers
977
views
Universal Unicode Clock
Plot contrivance
You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991.
You check the computer ...
9
votes
10
answers
830
views
Two In One: Guess That Language - Robbers
Cops' challenge
This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-...
20
votes
15
answers
2k
views
Two In One: Guess That Language - Cops
Robber's challenge
This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-...
29
votes
21
answers
5k
views
Add a hidden language to a polyglot
Inspired/mostly copied but I don't think it's a dupe. Also Inspired.
In this challenge, you will create polyglots that include all languages from previous answers, and another language which you won't ...
6
votes
1
answer
727
views
Irradiated Polyglots
Design a function or program that, when run normally, outputs the triangular numbers. However, when any single character is deleted, the program/function should not function in the original ...
17
votes
5
answers
1k
views
Are you a probabilist or a physicist?
Hermite polynomials refer to two sequences of polynomials:
The "probabilist's Hermite polynomials", given by
$${He}_n(x) = (-1)^n e ^ \frac {x^2} 2 \frac {d^n} {dx^n} e ^ {-\frac {x^2} 2}$$
...