View Full Version : Grammar/BNF Detection Library
Feb 26, 2012, 05:17 PM
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.
Feb 26, 2012, 06:42 PM
Isn't this what lex and yacc (or Flex and Bison) do?
Feb 26, 2012, 06:47 PM
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).
Feb 26, 2012, 07:25 PM
I know you said C preferred but perhaps "Spirit" a member of the BOOST project.
Feb 27, 2012, 01:12 AM
I believe Perl 6 can do this as well.