Spin1/Ruby polyglot
Wuerfel_21
Posts: 5,678
So for some reason I wondered: "Can you make a file that's both a Spin program and a Ruby program"
Then I passed out and an hour later I woke up with this in my editor (hey forum admins, why is there still no button for the code block?):
Then I passed out and an hour later I woke up with this in my editor (hey forum admins, why is there still no button for the code block?):
''# The amazing Ruby/Spin polyglot!
''; puts "Henlo World!"
''; text = %{
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
pst : "parallax serial terminal"
PUB main
pst.start(115_200)
repeat
pst.str(string("Henlo world!",13))
''}
'';p text

Comments
''# The amazing Ruby/Spin polyglot! ''; puts "Henlo World!" {{ } => 0 } 10.times { |x| p x } ''; { 0 => { }} ''; text = %{ CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ pst : "parallax serial terminal" PUB main pst.start(115_200) repeat pst.str(string("Henlo world!",13)) ''} '';p texthttps://www.ruby-lang.org/en/
https://en.wikipedia.org/wiki/Ruby_(programming_language)
I don't think there is really anything useful one can do with this, but it's cool, still.
-Phil