
This is why I suggested that the better way (I do not claim it's the best way, though) of connecting parser to state machine is by having regex_creator to perform the shift-reduce activity. These actions must be present somewhere in some form in any case, and moving them to regex_creator allows us to get by without creating additional structures (read: trees) if we don't need them explicitly.
The following sample creates a tree as the parser calls creator's feature functions. Can your regex compilation process be represented this way?
class abstract_regex_creator { public: void charset( const charset & ) { throw exception_unsupported; } void repeat( int, int, bool ) { throw exception_unsupported; } void cat() { throw exception_unsupported; } // ... };
I think I quite like that idea, although it would require quite a bit of rewriting on my part to support it, I'm also concerned that there may be some unseen showstoppers hiding somewhere, but that may prove to be unfounded. Right now, I think I really need to concentrate on getting another release out; it's already slipped by 9 months or so, and I simply must get my head down and right some code! This is an area I want to explore though, if I can get this next lot of code out the door, then I'll create a cvs branch to experiment with this, if you want to suggest / experiment with a design for the abstract creator in the meantime, then go for it. John.