|Looking for dynamic parser generator firstname.lastname@example.org (1991-03-01)|
|Re: Looking for dynamic parser generator joshua@Atherton.COM (1991-03-07)|
|From:||joshua@Atherton.COM (Joshua Levy)|
|Keywords:||parse, interpreter, yacc|
|Organization:||Atherton Technology, Sunnyvale, CA|
|Date:||7 Mar 91 19:32:59 GMT|
In article <email@example.com> firstname.lastname@example.org (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 (email@example.com) 408-734-9822
Return to the
Search the comp.compilers archives again.