Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MorphingDragon

macrumors 603
Original poster
Mar 27, 2009
5,159
6
The World Inbetween
Is there any C (Preferred) or C++ libraries that will take a string and check if it matches a formal grammar or its BNF notation? Writing a robust library (as I found out) is not a trivial task.
 
Last edited:
Yacc/Bison are parser generators, and should already installed as well. They will generate a parser from a set of rules similar to BNF. I have never used any of them though, writing a recursive descent parser is not that hard though depending on what you are up to, (I have done it for math expressions).
 
I know you said C preferred but perhaps "Spirit" a member of the BOOST project.

<http://www.ibm.com/developerworks/aix/library/au-boost_parser/>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.