Computer Science, asked by shreyamathur2114, 1 year ago

Converting python code to whitespace language

Answers

Answered by akash498
0
There is no such thing -- it would require the whole Python language to be running in Whitespace - so that your Python program culd use functions, lists, and other built-ins, not to mention the standard library.

Such a thing could be achievable via Pypy - you could write a Whitespace backend -- An effort I doubt could find funding or support.

However, a "one man hack" to get there might be changing the Python byte-code ops to use only whitespace charaters. It would not be "whitespace compatible" - but you would have the same effect in the end: compiled Python files - those we know as "pyc"s could be composed of Whitespace only for the code. (but not for the data and meta-data markup), hacking a couple of files in the Python source tree.

Changing the opcodes themselves is easy - they are in the Lib/opcode.py file in a Python Source tree - but you would have to change the interpreter to work with multi-byte opcodes (as currently all opcodes are one byte+ parameters

Similar questions