|multi-language parsing by using yacc pliang@msmail4.HAC.COM (Peter Liang) (1995-08-13)|
|Re: multi-language parsing by using yacc email@example.com (steve (s.s.) simmons) (1995-08-17)|
|Re: multi-language parsing by using yacc firstname.lastname@example.org (1995-08-21)|
|Re: multi-language parsing by using yacc email@example.com (Cees Visser) (1995-08-21)|
|Re: multi-language parsing by using yacc firstname.lastname@example.org (1995-08-21)|
|multi-language parsing by using yacc 75066.3204@CompuServe.COM (Carl Barron) (1995-08-22)|
|From:||email@example.com (Erik Corry)|
|Date:||Mon, 21 Aug 1995 00:43:21 GMT|
steve (s.s.) simmons (firstname.lastname@example.org) wrote:
: > Does anyone have experience using yacc to specifiy several grammars
: > in one parser application for parsing different languages (files)?
: > In other words, can I create multi-instances of parsers by using yacc?
: > Does yacc++ help?
: Actually, we had this fight 5 years ago when we were building command
: language for our debugger at Convex.
: Theoretically, it is a bad idea to use yacc for this. YACC works
: with a LALR(1) grammar. This is bottom up parsing technique. You should
: use a top down LL parsing. Why??? The reason is simple. Both the parsing
: and scanning of items further in the command line are context dependent
: upon those items parsed earlier in the command line.
Interestingly enough, Bjarne Stroustrup says the he regretted using yacc
for the Cfront compiler. He allowed himself to be persuaded that it was
uncool to go to the trouble of writing your own parser, but concluded that
yacc caused more problems than it was worth.
My experience is that it is difficult to report good error messages from
a Yacc parser, though admittedly gcc does very well.
On the original question, piping yacc's output though
will sort out the symbols, at least to a first approximation. It's
not nice, but that's what we have make for.
Erik Corry email@example.com
[It's true, parsing C++ with yacc is quite hard because the syntax is quite
context dependent and in a few cases ambiguous. Some people think this says
at least as much about the design of C++ as about yacc. -John]
Return to the
Search the comp.compilers archives again.