Hello readers,

Recently, as I said in my previous post Toward a zero bugs interpreter / compiler, I was working on an AST-interpreter and it is now able to run the whole Pharo kernel and probably the whole Pharo image.

There is not a lot to say about the AST-interpreter (except for implementation details that nobody is interested in). So I didn’t know what to blog about. Last week, at the Pharo conference in Bern, I discussed with Stéphane Ducasse and he recommended me to do a tree coverage tool. In fact it was not a lot of work (several hours) because it works on top of what I’ve already had implemented.

AST tree coverage tool

Screenshot of the tree coverage tool

Basically I’ve just made a working prototype so other people can reuse it in their code analysis projects. So don’t blame me if the tool is not user-friendly.

On the top of the spec window you can see two lists, that permit to select packages that have a least 1 class of tests (TestCase subclass). After selecting your packages with the buttons ‘add’, ‘addAll’, ‘remove’, ‘removeAll’, you should click on the right button ‘run’. Then, the analysis occurs and you have in the middle panel the list of methods that have been run. When you click on a method, it displays on the bottom panel the code source, coloring the code depending if the AST node was executed or not.

Of course if you would like to create a real tool out of it, you would need to polish it a little (there are currently some issue with pragmas and ‘yourself’ keyword but I don’t have time to spend to work on it), but it is already quite something.