Re: flex/yacc--many multiple parsers in same program

vadim@mercury.co.il (Vadim Arshavsky)
19 May 1996 17:37:08 -0400

          From comp.compilers

Related articles
flex/yacc--many multiple parsers in same program cowden@leitess.com (1996-05-13)
Re: flex/yacc--many multiple parsers in same program gclind01@starbase.spd.louisville.edu (1996-05-14)
Re: flex/yacc--many multiple parsers in same program qjackson@mail.direct.ca (1996-05-19)
Re: flex/yacc--many multiple parsers in same program zucco@world.std.com (1996-05-19)
Re: flex/yacc--many multiple parsers in same program vadim@mercury.co.il (1996-05-19)
Re: flex/yacc--many multiple parsers in same program pardo@cs.washington.edu (1996-05-19)
Re: flex/yacc--many multiple parsers in same program jlilley@ix.netcom.com (1996-05-19)
| List of all articles for this month |
From: vadim@mercury.co.il (Vadim Arshavsky)
Newsgroups: comp.compilers
Date: 19 May 1996 17:37:08 -0400
Organization: Compilers Central
References: 96-05-089
Keywords: lex, yacc, parallel

cowden@leitess.com (Michael Cowden) writes:
>
> I'm looking to write a single interpreter that can simultaneously
> parse up to 96 separate programs. Due to other restraints in the
> program I cannot fork a process to handle each parser. What are my
> options using lex and yacc? It seems like a real hack to get either
> of them to handle more than one program.


You can make reentrant parser using the output of lex/yacc. You will need to
make some postprocessing of this output (with sed/awk/perl whatever) which
would force it to use your parser's context instead of global variables.
It's not that trivial, but it is possible if you understand well internals
of the parser produced by yacc/lex. I've seen a couple of such parsers
around. One that I came across recently and can point you is SGML lexical
analyzer written by Dan Conolly (conolly@w3.org). It makes such a hack with
flex. Check out http://www.w3.org/pub/WWW/MarkUp/SGML/sgml-lex/sgml-lex.html


--------
Vadim
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.