Related articles |
---|
Partial grammars ? sriram@tcs.com (1994-06-05) |
Re: Partial grammars sperber@provence.informatik.uni-tuebingen.de (1994-06-13) |
Newsgroups: | comp.compilers |
From: | sriram@tcs.com (Sriram Srinivasan) |
Keywords: | parse, question |
Organization: | Teknekron Communications Systems, Berkeley, California |
Date: | Sun, 5 Jun 1994 21:59:49 GMT |
Hi,
I was wondering if there are any techniques to attack the following
problem.
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.
Sriram
(sriram@tcs.com)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.