Monday, February 22, 2010

Instrumenting the AST

Here is the place for you to leave comments on "Instrumenting the AST" wherein I describe an way to modify the AST for Python code in order to insert new code for things like line and branch tracing and ways to add tests which aren't otherwise easily possible.


Paddy3118 said...

In chip design, it costs a lot to fab an ASIC so their is a ready market for Coverage tools for the Verilog and VHDL languages used in chip design.

Coverage tools for these languages have evolved ways to display the expression coveraage results you speak of in your "x = a or b or c" example; an can also handle multiple expressions on a line etc.

The problem is that the tools are proprietary, but I have found one online source of documentation on what we can do:

Maybe reading that will help.

- Paddy.

Loki said...

Great tool to visualize your ast tree:

vipin said...

I wanted to solve this problem (

using ast module but it seems nodes in ast tree don't have links to parent nodes. I think there still might be a way to build such a tree by ourselves but it would be nice to have a configuration such that ast tree has links and flexibility to move around the nodes in the tree.

Unknown said...

Hi. "Manual Tree Walking Is Better Than Tree Grammars" link in your text is dead. FYI. Thanks.

Andrew Dalke said...

It's a nearly 9 year old blog post. Thing change and I've long given up caring to maintain old posts. Stick the title into a web search engine to find the newest location, or use