coppit has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a code generator that needs to parse a YACC-like input file (including partially parsing the C/C++ parts of the head and tail sections), as well as a LEX-like input file.
I figured I would start with existing YACC and LEX grammars, and modify them to add my new features. Unfortunately, I'm having trouble finding suitable Perl tools for parsing YACC, LEX, C, and C++. (I know the latter two are hard--I only need a partial parsing.) Do anyone know where I can find grammars for these languages?
Parsing a YACC file
I need to fully parse the YACC and LEX input files, but for the C and C++ code I just need to locate any definitions so that I can move them to an implementation file and replace them with "extern" declarations. (I'm generating multiple source files from the YACC/LEX files, instead of the normal one big implementation file.)
Thanks for the help!
David
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: In search of grammars for parsing
by jaldhar (Vicar) on Aug 06, 2004 at 03:14 UTC | |
|
Re: In search of grammars for parsing
by kvale (Monsignor) on Aug 06, 2004 at 04:52 UTC | |
|
Re: In search of grammars for parsing
by Velaki (Chaplain) on Aug 06, 2004 at 11:30 UTC |