|multi-language parsing by using yacc pliang@msmail4.HAC.COM (Peter Liang) (1995-08-13)|
|Re: multi-language parsing by using yacc firstname.lastname@example.org (steve (s.s.) simmons) (1995-08-17)|
|Re: multi-language parsing by using yacc email@example.com (1995-08-21)|
|Re: multi-language parsing by using yacc firstname.lastname@example.org (Cees Visser) (1995-08-21)|
|Re: multi-language parsing by using yacc email@example.com (1995-08-21)|
|multi-language parsing by using yacc 75066.3204@CompuServe.COM (Carl Barron) (1995-08-22)|
|From:||"steve (s.s.) simmons" <firstname.lastname@example.org>|
|Organization:||Bell-Northern Research Ltd.|
|Date:||Thu, 17 Aug 1995 13:05:15 GMT|
> 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. A simple example
A filename identifier is usually allowed to have periods and "/"
in the name. A variable's name usually can't have "/" in it.
You could have been able to choose the right scanner by completely
parse the command first.
The person in our group was able to get it to work with YACC; however,
many of his solutions were made more complicated by the approach. Like
the components of the filename were completely parsed, and then concatenated
together to form a file name.
[I agree - yacc is fine for grammars that are close to context free, but a
huge pain for seriously context dependent ones. I've even parsed Fortran using
yacc, but it wasn't pretty. -John]
Return to the
Search the comp.compilers archives again.