spirit grammar graphs
Gordon Woodhull <[email protected]> Wed, 30 Mar 2011 18:26:11 -0400
| Newsgroups | gmane.comp.parsers.spirit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Spirit Developers, I am working on the MPL.Graph paper & talk for BoostCon. I want to say a little bit about Spirit grammar rules, because I think it's a good example of a compile-time graph that many people are familiar with. So I'd like to summarize how type erasure and object references are used in Spirit to produce a graph when expressions only allow us trees. I will write/say something like this: (needs editing but is this basically correct?) Spirit generates a compile-time graph of function objects calling each other by tying together nodes of expression trees by common rule references. The rules use type erasure to make it easy to construct the objects without having to specify insanely complicated types; type erasure is used as a substitute for C++0x "auto". The technique also allows rule objects to remain uninitialized so they can be referred to before they are defined. Next, I was going to ask a simple question about type erasure, but I found the answer in the Spirit Rationale. So I'll ask a more complex question. :-) Since type erasure blocks inlining, isn't there some kind of type unerasure that can bring it back? Or would that require templated virtual functions? Obviously I have an ulterior motive: if it is possible, then I want to be able to build compile-time graphs using the same nice syntax Spirit uses. If it's not possible, then I want to see if Spirit could use compile-time graphs to solve the same problem with greater efficiency (and perhaps better clarity). Thanks, Gordon ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf