Related articles |
---|
a tool for partial parsing? briank@leland.Stanford.EDU (1995-11-14) |
Re: a tool for partial parsing? mtimmerm@microstar.com (1995-11-20) |
Newsgroups: | comp.compilers |
From: | briank@leland.Stanford.EDU (Brian E Korver) |
Keywords: | parse, question |
Organization: | Stanford University |
Date: | Tue, 14 Nov 1995 02:47:39 GMT |
I'd like a version of (something like) yacc that will return and allow
reentrance mid-parse. In other words, instead of having the parser
drive the whole program, I want a front end to drive the parser.
This has to do with parsing files as they come over the net. I don't
want to have to wait to read these files into memory before I can
start parsing them. I want to be able to feed each packet to the
parser as it comes in, and the parser (ie yyparse()) to return
(without an error) when it hits the end of the current buffer.
Something like:
yyparse_init();
while ((nread = read(from network) > 0) {
if (yyparse_continue(data_packet) == OBVIOUS_SYNTAX_ERROR) break;
}
yyparse_done();
I realize I could get the same effect by redefining 'yyin' (or the
associated function), but my actual application is more complex than
the example above and I really need to do it this way.
Thanks.
briank
briank@cs.stanford.edu
http://www-cs-students.stanford.edu/~briank
[You could always use a coroutine package and wrap the parser up as a
task. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.