Skip to content

[epScript] Emit Python AST instead of Source Code for robust tracebacks and compatibility #171

Description

@armoha

Currently, epScript emits Python source code and replaces co_lnotab or co_linetable attributes of the resulting CodeObject to map line numbers. This approach is CPython-specific and incompatible across multiple Python versions and Python implementations. (such as PyPy, GraalPy, etc.) This is super hacky and has been major obstacles when upgrading to newer CPython releases.

Hy language, a Lisp dialect on Python uses Python AST instead, using Python's native ast module:
https://github.com/hylang/hy/blob/master/hy/compiler.py
https://github.com/hylang/hy/blob/master/hy/importer.py

Hy also runs test on multiple python versions and pypy3 as well.
We need to be cautious about potential regressions on Python interoperability; it could alter how eval() and exec() behave.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions