Python Forum
What are ways of pointing cross-compiled origin source line for python? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: What are ways of pointing cross-compiled origin source line for python? (/thread-15829.html)



What are ways of pointing cross-compiled origin source line for python? - wyvogew - Feb-02-2019

I'm considering using Python as compiler backend (target). The problem I see is that there is no standard way to "tell" interpreter about origin line (from other language it was compiled). For example, JavaScript uses Source Maps for debugging, but it's not that perfect. Ideally I'd compile down to bytecode (pyc), where arbitrary lines can be set, but as I see, Python bytecode, it's not as portable, is it? Is generating bytecode portable between e.g. Python 3.1 and Python 3.6? What are ways of pointing cross-compiled source lines for python?


RE: What are ways of pointing cross-compiled origin source line for python? - Larz60+ - Feb-02-2019

There are several questions here.
I'm having trouble understanding what exactly you are trying to do.
and why generate byte code, why not just interpret script which will run on any platform, and any version of python (that contains all objects used)


RE: What are ways of pointing cross-compiled origin source line for python? - wyvogew - Feb-02-2019

(Feb-02-2019, 10:30 AM)Larz60+ Wrote: I'm having trouble understanding what exactly you are trying to do.

I take some language and cross-compile it to Python, but original line positions can't be prevailed in Python (e.g. for that JavaScript uses Source Maps). So basically I'm asking if there are any ways to do that, since .pyc bytecode is not reliable enough.