Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to restrict a rule
How to restrict a rule [message #1058265] Mon, 13 May 2013 12:16 Go to next message
rohit ahuja is currently offline rohit ahujaFriend
Messages: 27
Registered: February 2013
Junior Member
I have something like,


where EXPRESSION handles all kind of possible cases that i require.

Now the problem is that '+' is also part of an expression, and exp1 basically spans across the '+' symbol and consumes the exp2 as well.

is it possible to do this in some other way?

Re: How to restrict a rule [message #1058447 is a reply to message #1058265] Tue, 14 May 2013 07:19 Go to previous messageGo to next message
Colonel Panic is currently offline Colonel PanicFriend
Messages: 7
Registered: May 2013
Junior Member
Before you can answer this question you need to decide for yourself how the compiler should decide which expression belongs in which side of the AST. For example, should it parse:

a + b + c

exp1='a' '+' exp2='b + c'

exp1='a + b' '+' exp2='c'

Until you can decide this for yourself, there isn't a general case answer to your problem.

It may be the case that you are trying to put too much validation into the parser. Consider parsing 'EXPRESSION + EXPRESSION' in a single rule, rather than two, then deciding in your model validation and/or inference which version of the rule is intended (according to rules of your own choosing).

Hope that helps!
Re: How to restrict a rule [message #1058461 is a reply to message #1058447] Tue, 14 May 2013 08:43 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12044
Registered: July 2009
Senior Member
This might help as well

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Developing custom xtext editor
Next Topic:Generate mydsl Plug-in with Updatesite
Goto Forum:

Current Time: Mon Jun 25 08:26:55 GMT 2018

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

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

Back to the top