Grammar/BNF Detection Library

Discussion in 'Mac Programming' started by MorphingDragon, Feb 26, 2012.

  1. MorphingDragon, Feb 26, 2012
    Last edited: Feb 26, 2012

    macrumors 603


    Mar 27, 2009
    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.
  2. macrumors 604

    Aug 9, 2009
    Isn't this what lex and yacc (or Flex and Bison) do?
  3. macrumors 68040

    Feb 2, 2008
    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).
  4. macrumors 6502a

    May 10, 2009
    Des Moines, WA
    I know you said C preferred but perhaps "Spirit" a member of the BOOST project.

  5. macrumors 6502a

    Jan 23, 2010
    San Diego, CA USA

Share This Page