• Martin Thoma
  • Home
  • Categories
  • Tags
  • Archives
  • Support me

Polyglots - Crazy Programming Stuff

Have you ever heard of polyglots? This is so crazy. A polyglot is a program which can be interpreted as many programming languages. You don't believe me that something crazy like that is possible? Here is an example I've made: public gist

You can download the file at martin-thoma.com/python/polyglot.py.

I used three languages in this piece of code: Python, Brainfuck and Whitespace. You can try it with ideone.com. But please, copy the whole code!

It might be considered as cheating to use comments as often as I did and using two esoteric programming languages. Whitespace works only with whitespaces (space, tab) and Brainfuck needs only +-.;<>[]. Everything else is interpreted as a comment.

When I have much more freetime and I don't know what to do, I'll probably write some code with a more interesting output and which is not that obvious.

Published

Sep 21, 2011
by Martin Thoma

Category

Code

Tags

  • Brainfuck 1
  • Esoteric programming language 1
  • Programming 52
  • Python 141
  • Whitespace 1

Contact

  • Martin Thoma - A blog about Code, the Web and Cyberculture
  • E-mail subscription
  • RSS-Feed
  • Privacy/Datenschutzerklärung
  • Impressum
  • Powered by Pelican. Theme: Elegant by Talha Mansoor