Related articles |
---|
LALR(1)- but not LR(1)-conflict holzmuel@kafka.informatik.uni-stuttgart.de (1995-01-31) |
Re: LALR(1)- but not LR(1)-conflict adam@index.ping.dk (1995-02-02) |
Re: LALR(1)- but not LR(1)-conflict salomon@silver.cs.umanitoba.ca (1995-02-03) |
Re: LALR(1)- but not LR(1)-conflict Robert.Corbett@Eng.Sun.COM (1995-02-04) |
Re: LALR(1)- but not LR(1)-conflict frederic.tendeau@inria.fr (1995-02-09) |
Re: LALR(1)- but not LR(1)-conflict ludemann@netcom.com (1995-02-12) |
Re: LALR(1)- but not LR(1)-conflict adam@index.ping.dk (1995-02-18) |
Newsgroups: | comp.compilers |
From: | ludemann@netcom.com (Peter Ludemann) |
Keywords: | parse, LR(1), LALR |
Organization: | NETCOM On-line Communication Services (408 261-4700 guest) |
References: | 95-02-024 95-02-039 |
Date: | Sun, 12 Feb 1995 06:39:31 GMT |
holzmuel@kafka.informatik.uni-stuttgart.de (Bernd Holzmueller) writes:
>Does anybody know of a concrete example of an LALR(1)-conflict in an existing
>(or hypothetical but semantically meaningful) programming language grammar
>which is *exactly* LALR(1), i.e. the conflict is solved by moving to LR(1)?
Here's a real example I came across. It's from the "Arden Syntax",
the formal specification (ASTM E1460) of which I am currently editing:
expr_function ::=
expr_factor
| of_func_op opt_OF expr_function
| from_of_func_op index_modifier opt_OF expr_function
| from_of_func_op index_modifier expr_factor FROM expr_function
| from_func_op index_modifier expr_factor FROM expr_function
opt_OF ::= OF | /* empty */
YACC (and BISON) didn't like this; I had to replace the 3rd rule by 2
lines (one with OF and one without). Note that the 2nd rule still
has opt_OF:
expr_function ::=
expr_factor
| of_func_op opt_OF expr_function
| from_of_func_op index_modifier expr_function
| from_of_func_op index_modifier OF expr_function
| from_of_func_op index_modifier expr_factor FROM expr_function
| from_func_op index_modifier expr_factor FROM expr_function
--
Peter Ludemann ludemann@netcom.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.