Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » multiple decisions warning (unassigned grammar entry late rule action before rule delegation)
multiple decisions warning [message #1692662] Fri, 17 April 2015 09:39 Go to next message
naseclipse naseclipse is currently offline naseclipse naseclipseFriend
Messages: 14
Registered: April 2015
Junior Member
Hello,

I have two languages : Geez and Amharic
Geez is a superset of Amharic.

How can I have a rule entry for both languages in my xText grammar , which is shown below. Of course, the "Amharic" rule should be consumed in "Geez" rule. The compilation is showing me warnings. I fail to see where/why there is multiple decisions in the parsing!! (I am just strating to learn xText Rolling Eyes )

The grammar

Language:
Geez | Amharic
;
Geez:
geez = STRING amharic = Amharic
;
Amharic:
amharic = STRING
;

The warnings:
warning(200): ../org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/parser/antlr/internal/InternalMyDsl.g:119:1: Decision can match input such as "RULE_STRING RULE_STRING" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.xtext.example.mydsl.ui/src-gen/org/xtext/example/mydsl/ui/contentassist/antlr/internal/InternalMyDsl.g:176:1: Decision can match input such as "RULE_STRING RULE_STRING" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input


Thank you.
Regards,
Nas
Re: multiple decisions warning [message #1692666 is a reply to message #1692662] Fri, 17 April 2015 09:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Please share a complete grammar

I guess you have multiple langues elements. That makes the grammar ambigous


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: multiple decisions warning [message #1692720 is a reply to message #1692666] Fri, 17 April 2015 13:00 Go to previous messageGo to next message
naseclipse naseclipse is currently offline naseclipse naseclipseFriend
Messages: 14
Registered: April 2015
Junior Member
Thank you Christian!

grammar org.xtext.example.langdsl.LangDsl with org.eclipse.xtext.common.Terminals

generate langDsl "http://www.xtext.org/example/langdsl/LangDsl"

LanguagesModel:
languages+=Language*;

Language:
Geez | Amharic
;

Geez:
geez = STRING amharic = Amharic
;

Amharic:
amharic = STRING
;



Regards,
Nas
Re: multiple decisions warning [message #1692721 is a reply to message #1692720] Fri, 17 April 2015 13:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi yes this ambigoes.

The model "a" "b" shall this be two amharic or one geez


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: multiple decisions warning [message #1692728 is a reply to message #1692721] Fri, 17 April 2015 13:12 Go to previous messageGo to next message
naseclipse naseclipse is currently offline naseclipse naseclipseFriend
Messages: 14
Registered: April 2015
Junior Member
I didn't get what you meant ..."a" "b"...
I should be able to delegate "Amharic" rule from "Geez"

Cheers,
Nas
Re: multiple decisions warning [message #1692731 is a reply to message #1692728] Fri, 17 April 2015 13:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

what i want to say

consider you have the following input model

"a" "b"


This can result in two possible models

LanguagesModel [languages=[Amharic(amharic="a"),Amharic(amharic="b")]]

or

LanguagesModel [languages=[Geez(geez="a",amharic=Amharic(amharic="b"))]]

=> in One case you have one language, in the other two


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 17 April 2015 13:24]

Report message to a moderator

Re: multiple decisions warning [message #1692737 is a reply to message #1692731] Fri, 17 April 2015 13:32 Go to previous message
naseclipse naseclipse is currently offline naseclipse naseclipseFriend
Messages: 14
Registered: April 2015
Junior Member
Got it!!! Tnx a lot.
Solved, of course, with minor mark at the end of the assignment, that makes the parsing unique (unambiguous).

Cheers,
Nas
Previous Topic:How to format lists with new Xtext formatter?
Next Topic:[SOLVED] Creating if-then expression on the fly in the JvmModelInferrer
Goto Forum:
  


Current Time: Fri Mar 29 14:26:56 GMT 2024

Powered by FUDForum. Page generated in 0.03488 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top