From the course: Exploring Deterministic LLM Programming

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Understanding AST agentic coding

Understanding AST agentic coding

- [Instructor] What is AST or abstract syntax tree? It means that code becomes a tree. It's not just text lines, but it's structured data and every piece has a place, a function, a variable. Operators all then become nodes, and this is a language agnostic structure. This means that Python or Rust or JavaScript all become trees of logic, and this is a lot like a Lego instruction set. You know how the pieces connect and not just what they look like. The reason why AST powers agentic coding is that the agent can see the code structure, not just the strings. And it knows when a function or a variable or a loop is put inside of a piece of logic and it can trace the dependencies automatically. In terms of manipulation, you could surgically modify a specific node. You could refactor without using regular expressions. You could add air handling to an exact spot, and you could also transform an entire pattern across the code…

Contents