Archive for October 3rd, 2008

Newick C++ parser in Boost.Spirit

Friday, October 3rd, 2008

Here’s the Newick parser for C++ I mentioned in a previous post.  It is written in Boost.Spirit, so it is a recursive decend parser.  This might give you problems with the stack if you are parsing really deep trees, but for moderately sized trees (a few thousands of taxa) it shouldn’t be a problem.

It is code I pulled out of a tool for coalescence trees, so it only handles rooted binary trees.  To make it a little more useful I’ll add code for re-rooting the tree.  I have that code already, but in a different tool that only works on the tree topology, so I need to handle the branch lengths before I can add it here.

Let me know what you think.