Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Decision tables in Xtext
Decision tables in Xtext [message #1743280] Tue, 13 September 2016 16:20 Go to next message
Eclipse UserFriend
Good evening,

the forum and google search couldn't help me so far.

I was looking for decision tables or something equal within XText. I know that "decision table" is an old term and that today it may run with a new term for it.

I'm not sure if I saw it within the docs.

It would be nice if you could point me into the correct direction. I have a strange feeling I'm overlooking something very simple.

Thanks for your help.
Re: Decision tables in Xtext [message #1743282 is a reply to message #1743280] Tue, 13 September 2016 16:56 Go to previous messageGo to next message
Eclipse UserFriend
Hi this question is extremely vague. Can you be a bit more specific what this is about?
Grammar? Formatting ... https://blogs.itemis.com/en/tabular-formatting-with-the-new-formatter-api

.....
Re: Decision tables in Xtext [message #1743284 is a reply to message #1743282] Tue, 13 September 2016 17:43 Go to previous messageGo to next message
Eclipse UserFriend
Hello Christian,

thanks for the fast answer as always. Wink

I was looking
a) if it is possible,
b) for the syntax,
and c) under what terms they are refered to within Xtext. Since eighter the forum nor google has a single matching result for xText and decision tables.

As far as I recall it is never even mentioned in the Xtext online docs.

Edit: With "decision table" I'm refering to the pattern not to a common table
(https://en.wikipedia.org/wiki/Decision_table)

[Updated on: Tue, 13 September 2016 17:58] by Moderator

Re: Decision tables in Xtext [message #1743286 is a reply to message #1743284] Tue, 13 September 2016 23:01 Go to previous messageGo to next message
Eclipse UserFriend
You have to build that yourself
Re: Decision tables in Xtext [message #1743291 is a reply to message #1743280] Wed, 14 September 2016 02:38 Go to previous messageGo to next message
Eclipse UserFriend
Why would you build that in Xtext? I assume it is because you would like to embed decision tables in a DSL. Otherwise real tabular editors could be better.

I think Dominik's blog post that Christian linked is a good start to define tables in an Xtext grammar. This could be extended to your use case. You may want to name the rules not so generic as in the example, but more suited to your case. Also the structure is more fixed.

Please let us know if the example does not help you.
Re: Decision tables in Xtext [message #1743442 is a reply to message #1743291] Thu, 15 September 2016 09:45 Go to previous messageGo to next message
Eclipse UserFriend
I will try it. But since decision tables are a rather basic concept within DSLs I thought there would be a simple mechanism to use them with full Xtext support etc.
Re: Decision tables in Xtext [message #1743514 is a reply to message #1743442] Fri, 16 September 2016 03:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I think you are confusing paradigms.

Xtext provides powerful automation for a textual DSL.

There are many alternative paradigms for a DSL.
graphical - Papyrus/Sirius/Graphiti/...
tree - Sample Ecore Editor, ?EEF
forms - ? EEF
tables - ? EEF
text - Xtext

You seem to require tables which is a different and inappropriate paradigm to Xtext.

If you want a mixture of paradigms as an integrated whole, then you need an integration technology. You might want to look at Mylyn Intent. Pushing additional paradigms down into Xtext seems rather suspect.

Regards

Ed Willink
Re: Decision tables in Xtext [message #1743519 is a reply to message #1743514] Fri, 16 September 2016 03:44 Go to previous messageGo to next message
Eclipse UserFriend
having a look at MPS might be another option - well they have text like looking syntax but dont use parsers as Xtext does or other Parser Based internal and external dsls do
Re: Decision tables in Xtext [message #1743563 is a reply to message #1743519] Fri, 16 September 2016 08:15 Go to previous messageGo to next message
Eclipse UserFriend
More specifically take a look at http://mbeddr.com/index.html which builds on MPS
Re: Decision tables in Xtext [message #1743564 is a reply to message #1743519] Fri, 16 September 2016 08:16 Go to previous messageGo to next message
Eclipse UserFriend
More specifically take a look at http://mbeddr.com/index.html which builds on MPS
Re: Decision tables in Xtext [message #1743594 is a reply to message #1743564] Fri, 16 September 2016 12:44 Go to previous messageGo to next message
Eclipse UserFriend
I read Fowlers chapter about decision tables again and I think that it isn't that complicated after all if you have to implement it yourself.

I didn't have time to start programming so I'm glad to be pointed to logic mistake I make.

Instead of using the top rows of the column as the condition, just use the first columns as the conditions and the following columns as the consequences.
More or less a rotated table.
decisionTable {
condition1 | condition2 | condition3 | consequence1 | consequence2;
condition1 | condition2 | condition3 | consequence1 | consequence2;
}

Don't mind the syntax, just as a hint to what I ment with rotated table. If you declare the number of conditions that are used in the table and do the checks this would work, right?
With a bit of formatting you can get the "table" look and have all the logic to build the decision table in xtend.

Am I overlooking something or would this rather simple attempt work?
Re: Decision tables in Xtext [message #1743719 is a reply to message #1743594] Mon, 19 September 2016 04:26 Go to previous message
Eclipse UserFriend
Quote:
If you declare the number of conditions that are used in the table and do the checks this would work, right?

Yes, that is basically it. You would have to identify what columns are conditions and which are consequences. Maybe by adding a special header row. And which valid consequences you have.

For the formatting take Dominik's blog post.
Previous Topic:Localization in the IParserErrorContext
Next Topic:Retrieving STRING terminals in Xtend?
Goto Forum:
  


Current Time: Wed Jul 23 16:21:48 EDT 2025

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

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

Back to the top