When compiling python using transcrypt is it possible to get standard python error logging?

197 Views Asked by At

When compiling python to javascript using transcrypt I've noticed the syntax error reporting is more vague than the standard python syntax error reporting. Since the code cannot be compiled using the standard python compiler as it would throw syntax errors due to the transcrypt syntax is there a way to get more specific syntax error reporting that resembles the python compiler?

1

There are 1 best solutions below

0
On

In some cases: yes, in general: no.

Transcrypt syntax IS Python syntax, since both use CPython's ast module to parse the source code. But Transcrypt programs may call JavaScript code, which won't work in CPython. So while many Transcrypt modules can also be used with CPython, the ones directly using JavaScript can not. For those modules, the (syntax and semantics) error reporting of the CPython interpreter is unavailable.

One note about the __pragma__'s. Indeed even those syntactically are simply function calls, although semantically they work at compile time.

Note that running Transcrypt modules with the CPython interpreter is the core of what Transcrypt's back-to-back autotesting system is all about. Without this possibility it would be very hard to avoid regression bugs in new releases.

Correct Transcrypt behavior is simply defined as "what CPython would do"...