Older blog entries for shapr (starting at number 16)

Yay! Moshe Zadka is contributing to Bicycle Repair Man! Much cheerfulness!

He mentioned that tree transformation in BRM seems to him to be similar in spirit to the Python XML Validator written by Lars Marius Garshol. I've been perusing Lars' code for about an hour or so. It's definitely sparked some ideas.

At this point I'm considering subclassing the Node classes in Python2C's ast.py and adding getParent and getSiblings methods to them. I think I could write a fast tree search that just looked in a dictionary for nodes and then asked those node personal questions about their relatives. I'm not sure how difficult it would be to implement those methods though. I'll know soon enough.

I got a job writing Java for JDK 1.1.4 yay. I've been doing the self-employed thing for months. Means little money, but lots of time. Now I that I am soon to start a real job again, I'll be able to buy hardware, but probly won't have time to play with it. This seems to be the continual trade-off. Ah well, I hope my lack of time doesn't completely kill Bicycle Repair Man.

Minor progress has been made on the tree transformer.

Also, Bicycle Repair Man is soon to appear on the http://www.refactoring.com website. I hope that will increase developer interest in the project.

Nice to see that Moshe Zadka is on advogato now.

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!

7 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!