Related articles |
---|
Technical question about yacc and LALR parsers jar@florida.HQ.Ileaf.COMid AA07671; Sun, 21 Apr 91 (1991-04-20) |
Re: Technical question about yacc and LALR parsers jml@wally.altair.fr (1991-04-22) |
Re: Technical question about yacc and LALR parsers mauney@eos.ncsu.edu (1991-04-22) |
Re: Technical question about yacc and LALR parsers bliss@sp64.csrd.uiuc.edu (1991-04-22) |
Re: Technical question about yacc and LALR parsers boyland@aspen.berkeley.edu (1991-04-23) |
Technical question about yacc and LALR parsers compres!chris@crackers.clearpoint.com (1991-04-21) |
Newsgroups: | comp.compilers |
From: | boyland@aspen.berkeley.edu (John Boyland) |
Keywords: | parse, design |
Organization: | Compilers Central |
References: | <9104222013.AA09131@florida.HQ.Ileaf.COM> |
Date: | Tue, 23 Apr 91 15:30:11 -0700 |
In article <9104222013.AA09131@florida.HQ.Ileaf.COM>, jar@florida.HQ.Ileaf.COM (Jim Roskind x5570) writes:
|> [...] A second
|> example would would be (again verifiable by the parser generator) when a
|> "grammar preprocessor" back-substituted some rules and in doing so,
|> replicated the code actions.
|> [...]
|>
|> Jim Roskind- Author of a YACCable C++ grammar
|> jar@hq.ileaf.com or ...!uunet!leafusa!jar
Unfortunately, grammar preprocessors (such as one I've developed), often
have subtly different actions:
For example:
stmtlist : stmtlist ';' ? ';;' stmtlist
{ $$ = sequence($stmtlist'1,$stmtlist'2); }
gets expanded into:
stmtlist : stmtlist ';' DOUBLESEMI stmtlist
{ $$ = sequence($1,$4); }
| stmtlist DOUBLESEMI stmtlist
{ $$ = sequence($1,$3); }
(Duplicating rather than having a special optional-semicolon rule more often results in an LALR(1) grammar).
Notice how the actions differ in where arguments are found.
John Boyland
boyland@sequoia.Berkeley.EDU
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.