|Partial grammars ? email@example.com (1994-06-05)|
|Re: Partial grammars firstname.lastname@example.org (1994-06-13)|
|From:||email@example.com (Sriram Srinivasan)|
|Organization:||Teknekron Communications Systems, Berkeley, California|
|Date:||Sun, 5 Jun 1994 21:59:49 GMT|
I was wondering if there are any techniques to attack the following
I wish to write a parser that needs to take an action only on some parts
of an input file - say, only class declarations/definitions in C++ files.
I want to skip over most of the code in the C++ file, because that
information is not important to me. One way is to take the C++ grammar and
have code attached to only those productions that I am interested in. I
feel it would be simpler if the lexer is aware of the tokens that are of
interest at any stage of parsing - (Once the parser has finished
processing one class declaration, and the closing brace has been seen, it
tells the lexer not to bother it until the token "class" is seen again).
I realize this can be achieved by implementing a state machine on the lex
side of things, but I was wondering if there are any less painstaking
approaches to this problem.
Return to the
Search the comp.compilers archives again.