2023-07-04, 12:00–12:20, Main hall
This talk will delve into the AST module's capabilities and limitations, covering its class hierarchy, general structure, and supported functions. Attendees will be presented with examples of cool code manipulations based on AST.
The AST (Abstract Syntax Tree) module in Python can be used to analyze code, alert it, and even generate new code. We can use programming to change the AST representation of python, resulting in code that looks and behaves differently than the original.
This is a really cool thing to do.
In this talk we will explore the AST module capabilities, and its lack of capabilities.
We will learn the general structure of ASTmodule, its class hierarchy and its supported functions. Our focus will be on acquiring the skill to recreate the initial code through its AST representation. It seems that even though transforming python code into an AST is a simple task, the inverse process of transforming AST into code fails to replicate the original code.
We will see some examples of fun code-manipulations. First, we will show how to automatically add meaningful logs to your code. Second, we will experiment with code reordering and last, we will explore ideas to manipulate code for mutant testing purposes.