At 14:50 -0500 1-01-06, William F. Hammond wrote:
>Although I've written in C, I've never gotten into C++. Are there
>good regular expression libraries for C++?
I once wrote a regular expression -> NFA translator. If one wants to
translate into a DFA, one problem is that some regular words produces
exponential size DFA's. One way around this is to translate DFA transitions
dynamically, in which case both size and time can be made fast (space as
NFA, time as DFA).
I have never seen any such libraries, but they must exist, as there are
programs like grep and the like, which uses regular expression and must use
some kind of FA (finite automata) for string identification.
In your case, I think you want to attach rules to the parsing, so parser
generateors seem to be better. In addition, you probably have a limited
amount of programmer time at your disposal. So this speaks for relying on
existing parser generators. Once one knows what is needed, one can choose
other alternatives as a means of optimization.
If one does not want to use C/C++, there is a parser generator in Haskell
http://haskell.org/, called "Happy" I think. And for Java, there is ANTLR