Older blog entries for shapr (starting at number 14)

not much motivation lately to work on BRM :(

I wish I could collaborate with someone for awhile.

Went to sweden again for a couple of days, this time to Buden. This time I learned about Finite State Machines from Skip Montanaro's fsm.py. It's pretty nifty stuff. So far I've figured out I need to generate FSMs to match the tree. I keep wavering on whether I should go ahead and implement the tree matching language. Sometimes I think it's easier than it looks, sometimes harder. I'm not really sure.

I went to Sweden for three days with a laptop and no net access. Suddenly there's a webpage for Bicycle Repair Man. It's minimal, I'm thinking about an icon and more information. Doubt I'll get much done when Mr Wizard shows up.

Great News! Erno is moving to Oulo in six weeks! Oulo is 1.5 hours bus ride away from here, and boy is that closer than Helsinki. I'm hoping I'll be able to go hang out and code with Erno regularly. I'm very much looking forward to that.

Well, I've been lazing around and playing a new game I got for $2. I thought it was a nice price.. it also came with spiffy stuff like Autechre and Squarepusher for the sound track, so it can't be all bad. So... I think I'll be preparing for Mr Wizard's visit from Alabama for a few days, don't expect much for a week or so.

Ya know, Open Source seems to be more about kicking something out the door and letting people play with it. I think I'll just hand code each parse tree transformation and save the transformation language till the next version. It seems I don't really understand how to do something until I've already written it anyway. And then it needs doing again.

I think I'll refactor genpy into a subclass of the Python Compiler Visitor, and then hand-code up the tree transformations. I would really like to get a minimal prototype out the door SOON.

Aha, it's called tree pattern matching, and it seems to be a bit of deep algorithmic science. I am unsurprised that it involves algorithms similar to regular expressions. Now that someone told me what it is, and sent me a link to code he had written (Thanks much Thilo :), I can actually do it.

It looks like I'm going to use the AST Visitor that Jeremy Hylton wrote to zip across the tree and fill in a state machine. Should be entertaining.

Much frustration ensues. I'm currently floundering about trying to figure out exactly how to write a search and transform module for ASTs. Everything I've tried so far has turned out flaky. <sigh>

If you have advice, I'd love to hear it.

Okay, so it wasn't almost finished. I found many many bugs to fix. But it seems to be finished now, so I've checked it into the sourceforge cvs tree. If anyone finds bugs, I wish to be notified of them.

I've been unit testing the ast to Python source module by taking original source, turning it into the original ast, then turning that into newsource, and then getting a new ast and comparing original ast to new ast. If they weren't exactly equal, I had a bug. The best file I found to do that with is the x-python file that comes with Python2C, it's full of degenerate cases of legal Python syntax. Boy was it rough to get through.

So now it's time to build a search and transform module for the syntax tree. I don't really know the best way to approach it, but I think I'll just go in a certain direction until it works or the approach turns out to be a dead-end. I wonder how other people do exploratory programming. If you'd like to tell me how you do exploratory programming, send me email!

well, it's 3:30am and genpy.py is almost finished. I think I'm going to abstract out the common code between n_function and n_lambda... but maybe I'll do that tomorrow. I wrote some very strange code to make this module work. If anyone wants a copy to try out, send me email!

I'm looking forward to tomorrow, when I get to start on the parse tree search module. There's some pretty strange syntax in the parse tree matcher from the refactoring browser thesis, it should make for an exciting implementation in Python.

For now, though, it's sleeptime.

Wheee. It's 5:26am and the first rough version of the Python2C AST to Python source module is working! Yeeehaaa!

It's nice that something is working!

The bicyclerepair-general list actually had a message. Wow. I responded with lots of detail, so I probably scared the guy off. *sigh*

Now that I have a rough AST to source, I need to add the rest of the node handlers and get on to something else. I know I should clean up the source and refactor out at least the indentation code, but hey, I want to get other parts working. Hm, XP says I should refactor now while I can still understand the code. Hm.

The next piece I'll be writing is the AST search and transform code. That should be challenging, but I've had my hands deep enough in the AST that I may actually be qualified to do it.

I've also been thinking about IsExclusive. Personally, I never do raw instance variable access, but that's not necessarily true for everyone, therefore, not even self.var = value in the __init__ function is a safe bet for IsExclusive. I'll keep thinking.

Since two people have asked me if they can contribute to BRM, it's about time for me to write up the UserStories and such. When it was just me, YAGNI applied. Now it's time for enough structure to be able to delegate with a minimum of effort.

This is the first Open Source project I've worked on, so I don't know how to proceed. Do I advertise on comp.lang.python? Should I raise public awareness about a wonderful tool on the horizon? Should I wait to mention anything till there's an alpha version?

Somebody tell me, how exactly does the "release early and often" strategy apply?

Oh well, sleeptime, and more coding tomorrow.

5 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!