Welcome, Guest
Username: Password:
  • Page:
  • 1

TOPIC:

R-R Conflict 06 Nov 2002 09:10 #6261

Hello ,
I am getting Reduce -Reduce Conflict for the following grammar. How can I resolve it?

Production Rules
VariableRef ::= (VarIdentifier | ValueParIdentifier) [ExtendedFieldReference]

VarIdentifier ::= Identifier
ValueParIdentifier ::= Identifier

ExtendedFieldReference:=...........

As 'Identifier' is giving two production we will get this conflict. What is the way to resolve it?
I am using Yacc for the parsing.

regards,
Anil Krishna

Please Log in to join the conversation.

R-R Conflict 06 Nov 2002 09:24 #6262

Hi Anil,

this is one of the examples why I said earlier that then TTCN-3 BNF as given in the standard is not suitable as an implementation grammar. The grammar states that a VariableRef is either a VarId or a ValueParId, which are in turn both identifiers. From a context free grammar point of view, there is no easy way to distinguish between an id that refers to a variable and an id that refers to a value parameter - this is context sensitive information.

To solve this problem, you need to simplify the grammar, e.g., into

VariableRef ::= Identifier [ExtendedFieldReference]

and then at during the analysis phase of the compilation, e.g., during name resolving, determine what this particular id refers to.

Best regards

Stephan Tobies

Original Message
From: ext AnilKrishna [This email address is being protected from spambots. You need JavaScript enabled to view it.]
Sent: Wednesday, November 06, 2002 10:10 AM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: R-R Conflict


Hello ,
I am getting Reduce -Reduce Conflict for the following grammar. How can I resolve it?

Production Rules
VariableRef ::= (VarIdentifier | ValueParIdentifier) [ExtendedFieldReference]

VarIdentifier ::= Identifier
ValueParIdentifier ::= Identifier

ExtendedFieldReference:=...........

As 'Identifier' is giving two production we will get this conflict. What is the way to resolve it?
I am using Yacc for the parsing.

regards,
Anil Krishna

Please Log in to join the conversation.

R-R Conflict 06 Nov 2002 12:17 #6263

Hello Anil,

the point is you can not resolve this problem. Stephan mentioned already
before that you have to modify your grammar in order to be able to write
a parser. This is an example of the issues.

The question whether an identifier is a variable identifier or a
parameter identifier can not be decided with a context free grammar. In
fact you need a context in order to be able to answer this questions.

Best regards,

Theo

AnilKrishna schrieb:
> Hello ,
> I am getting Reduce -Reduce Conflict for the following grammar.
> How can I resolve it?
>
>
Production
> Rules
> VariableRef ::= (VarIdentifier | ValueParIdentifier)
> [ExtendedFieldReference]
>
> VarIdentifier ::= Identifier
> ValueParIdentifier ::= Identifier
>
> ExtendedFieldReference:=...........
>

>
> As 'Identifier' is giving two production we will get this conflict. What
> is the way to resolve it?
> I am using Yacc for the parsing.
>
> regards,
> Anil Krishna


--
Theofanis Vassiliou-Gioles Testing Technologies IST
Oranienburger Str. 65 The TTCN-3 Company
10117 Berlin, Germany phone +49 30 726 19 19 0
This email address is being protected from spambots. You need JavaScript enabled to view it. DDI +49 30 726 19 19 12
www.testingtech.de fax +49 30 726 19 19 20

Please Log in to join the conversation.

  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin