Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!ncar!hsdndev!spdcc!iecc!compilers-sender From: joshua@Atherton.COM (Joshua Levy) Newsgroups: comp.compilers Subject: Re: Looking for dynamic parser generator Keywords: parse, interpreter, yacc Message-ID: <34658@joshua.athertn.Atherton.COM> Date: 7 Mar 91 19:32:59 GMT References: <18231@cs.utexas.edu> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: joshua@Atherton.COM (Joshua Levy) Organization: Atherton Technology, Sunnyvale, CA Lines: 27 Approved: compilers@iecc.cambridge.ma.us In article <18231@cs.utexas.edu> turpin@cs.utexas.edu (Russell Turpin) writes: >I am interested in any parser generators ... that one can, at run time, >parse strings from many languages and also define new languages. ... > >I doubt this can be done with yacc and lex. Ye of little faith! :-) Read "Parsing Distfix Operators" in CACM Feb. 1986 (Vol 29, #2) by Simon L. Peyton Jones on page 118. To quote the summary: We have described a simple technique whereby a fixed BNF grammar can describe languages including user defined infix, postfix, and disfix operators. The technique requires only that the parts of disfix operators be lexically distinguishable. Standard parser generators can then produce efficient parsers for such grammars ... The idea has been successfully implemented with minimal effort. The paper is only 5 pages long, easy to understand, and includes some sample code. They use YACC as their "standard parser generator". Note the limitation of the method: certain tokens must be lexically distinguishable. I doubt this solves your whole problem, but I think it solves part of it. Joshua Levy (joshua@atherton.com) 408-734-9822 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.