ASTでコードを走査する方法について整理した。 最初は ast.walk() と FunctionDef.body の違いが曖昧だったため、それぞれ何を取得しているのかを図にしながら理解を進めた。 調べていく中で、「ツリーを歩く方法が2種類ある」のではなく、 コードの実行順を ...
AST (Abstract Syntax Tree) is a tree representation that represents the syntactic structure of source code. It is widely used in compilers and interpreters to reason about relationships between ...
Overview Python's "ast" module transforms the text of Python source code into an object stream. It's a more powerful way to walk through Python code, analyze its components, and make changes than ...
Non-linear pattern matching for Python's objects, or a regexp-like for objects, query/match object graphs/tree/AST in a declarative way ...