bob
bob

Reputation: 31

Too many constructions with phoenix::new_ in boost spirit grammar

I'm quite new to the spirit framework, and I'd like to ask you a question concerning my program.

My idea is to implement the C- programming language grammar into spirit (link is here http://marvin.cs.uidaho.edu/Teaching/CS445/c-Grammar.pdf).

I'm creating a tree of nodes containg the whole code (each node will be a subclass of a main CodePart class; such as WhileStatement, IfStatement...).

To each rule, I create a node of the tree using the phoenix::new_ function; for instance:

rule1 = (...)[qi::_val = phoenix::new_<CodePart1>(...)]

My first issue is that a very high number of nodes are created during the parsing; every try of rule creates a new pointer, but none is deleted (I added debug messages in constructors and destructors).

Is the node creation idea a correct one, or am I going the wrong way?

Thanks for your insights.

Upvotes: 3

Views: 19

Answers (0)

Related Questions