Understanding Abstract Syntax Trees

Srijan Saurav (~sauravsrijan)


Syntax tree is a tree representation of the abstract syntactic structure of source code written in a programming language. Python’s ast module provides a simple API to access the source’s AST; which can be used to manipulate/modify the source code. The intention of this talk is to go to the depth of the AST understanding how everything works with a demonstration of playing with source code and transforming it as per will. The talk will also deal with transforming source code per your needs using astroid package (which is a library for AST parsing, static analysis, and inference, currently powering most of pylint), and how it is used by different analyzers to improve the code quality.


  • Basic understandings of Python.
  • Knowledge of tree data structure would be a good to have

Speaker Info:

Srijan is a 4th Year Undergrad student pursuing Information Technology from KIIT University, Bhubaneshwar, and right now working with DeepSource.io as a software engineering intern. He is a PythonHead, with a keen interest in open source. In this talk, he would also share his experiences on how he has used AST for assuring code quality and shipped fewer bugs.

Id: 1341
Section: Core Python
Type: Talks
Target Audience: Intermediate
Last Updated: