[Compiler-sig] python refactoring browser questions
Shae Erisson
shae@webwitches.com
Mon, 31 Jul 2000 04:22:10 +0300
From: Jeremy Hylton <jeremy@beopen.com>
Subject: Re: [Compiler-sig] python refactoring browser, is it on topic?
Date: Sun, 30 Jul 2000 12:35:42 -0400 (EDT)
> Let's pick one of these places. I'm interested in participating in the
> discussion, but I don't know where it should happen. The compiler sig
> is dormant, so there wouldn't be much harm in shanghai-ing it. The
> same is true for idle-dev.
If anyone minds us discussing here, speak up ;)
My current question is how to do abstract syntax tree transformation in Python.
I'm trying to implement the tree transformation pattern variables described in the refactoring browser thesis[1].
Problem is, I don't know how to do it :)
I've had some ideas tonight, I think I'll turn the search code into an ast, and then into a finite state machine.
Then I'll walk the tree and for each node, spawn a new fsm and notify all existing fsms.
Can anyone think of a better solution?
The endpoint of this at its most basic is to get regast('`var = `var + 1') to run across 'x = x + 1' and return a dictionary with key 'var' and value 'x' for later substitution.
[1] rb thesis: http://st-www.smalltalk.cs.uiuc.edu/~droberts/thesis.pdf
Shae Matijs Erisson - http://www.webwitches.com/~shae/