Related articles |
---|
grammar conflicts jean.morissette666@videotron.ca (Jean Morissette) (2005-03-27) |
Re: grammar conflicts 148f3wg02@sneakemail.com (Karsten Nyblad) (2005-03-31) |
Re: grammar conflicts cfc@shell01.TheWorld.com (Chris F Clark) (2005-03-31) |
Re: grammar conflicts xous@xouslab.com (Xous - Jose R. Negreira) (2005-03-31) |
From: | Jean Morissette <jean.morissette666@videotron.ca> |
Newsgroups: | comp.compilers |
Date: | 27 Mar 2005 17:32:03 -0500 |
Organization: | Compilers Central |
Keywords: | parse, question |
Posted-Date: | 27 Mar 2005 17:32:03 EST |
Hi,
I'm playing with JavaCUP and encounter some conflicts with my grammar (see
below) and I don't know how to resolve these conflicts. Any help would be
greatly appreciated.
Thank
-Jean
main ::=
identifier_chain
| qualified_asterisk
;
identifier_chain ::=
identifier_chain PERIOD identifier
| identifier
;
qualified_asterisk ::=
asterisked_identified_chain PERIOD asterisk
;
asterisked_identified_chain ::=
asterisked_identified_chain PERIOD
| identifier
;
*** Reduce/Reduce conflict found in state #5
between asterisked_identified_chain ::= identifier (*)
and identifier_chain ::= identifier (*)
under symbols: {PERIOD}
Resolved in favor of the second production.
*** Shift/Reduce conflict found in state #5
between asterisked_identified_chain ::= identifier (*)
under symbol PERIOD
Resolved in favor of shifting.
*** Shift/Reduce conflict found in state #5
between identifier_chain ::= identifier (*)
under symbol PERIOD
Resolved in favor of shifting.
Checking for non-reduced productions...
*** Production "asterisked_identified_chain ::= identifier " never reduced
[It's the usual LALR problem, the parser has to look more than one
token ahead to figure out what it's parsing. In this case,
identified_chain and asterisked_identified_chain are too similar. I'd
suggest combining them and tell the difference semantically. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.