mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-07-16 17:26:58 -04:00
This patch adds support for viewing the abstract syntax tree (AST) of Python source code in Compiler Explorer, matching the existing AST viewer feature for C/C++ (Clang AST). - This patch adds a helper script `ast_dump.py` that parses and dumps the AST for a Python source code file. `python -m ast` should also work, but it's not available in old versions of Python. - This patch adds an AST parser for Python which mimics the structure of the C/C++ AST parser. It also updates the Python compiler to enable AST output. - All existing and new tests pass. Assisted-by: GitHub Copilot / DeepSeek v4 Flash Assisted-by: GitHub Copilot / DeepSeek v4 Pro <!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE IT Thanks for taking the time to improve CE. We really appreciate it. Before opening the PR, please make sure that the tests & linter pass their checks, by running `make check`. In the best case scenario, you are also adding tests to back up your changes, but don't sweat it if you don't. We can discuss them at a later date. Feel free to append your name to the CONTRIBUTORS.md file Thanks again, we really appreciate this! --> Co-authored-by: Matt Godbolt <matt@godbolt.org>