Skip to main content



      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 05:39 Go to next message
Eclipse UserFriend
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 05:45 Go to previous messageGo to next message
Eclipse UserFriend
Please share a complete grammar

I guess you have multiple langues elements. That makes the grammar ambigous
Re: multiple decisions warning [message #1692720 is a reply to message #1692666] Fri, 17 April 2015 09:00 Go to previous messageGo to next message
Eclipse UserFriend
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 09:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi yes this ambigoes.

The model "a" "b" shall this be two amharic or one geez
Re: multiple decisions warning [message #1692728 is a reply to message #1692721] Fri, 17 April 2015 09:12 Go to previous messageGo to next message
Eclipse UserFriend
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 09:18 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Fri, 17 April 2015 09:24] by Moderator

Re: multiple decisions warning [message #1692737 is a reply to message #1692731] Fri, 17 April 2015 09:32 Go to previous message
Eclipse UserFriend
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: Wed Jul 02 09:25:06 EDT 2025

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

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

Back to the top