Code Monkey home page Code Monkey logo

python-supply / analyzing-and-transforming-abstract-syntax Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 60 KB

Python's built-in libraries include powerful tools for retrieving and operating over abstract syntax trees. This article provides an overview of how to use these features to analyze and transform Python code programmatically.

Home Page: https://medium.com/python-supply/analyzing-and-transforming-abstract-syntax-d7d3da23b14f

License: MIT License

Jupyter Notebook 100.00%
python python-introduction python-articles abstract-syntax code-analysis code-transformation ast python-syntax python-syntax-converter python-syntax-and-semantics

analyzing-and-transforming-abstract-syntax's Introduction

analyzing-and-transforming-abstract-syntax

When managing a codebase, you may find it necessary to analyze some aspects of it (e.g., whether a potential vulnerability appears, how often a language feature is used, or what fraction of the codebase has been documented) or to transform it (e.g., in order to restore its compatibility with a new version of a dependency or even to transpile it to another language). What tools are available to help you accomplish this in an automated and scalable way?

Python's built-in libraries include powerful modules that make it possible to retrieve and operate over abstract syntax trees (ASTs) of modules, classes, and functions/methods. This article reviews the Python syntax definition, Python's abstract syntax data structure, and how this data structure's features can be used to write succinct Python code that can examine and transform other Python code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.