Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Selection for a type system
Selection for a type system [message #871576] Mon, 14 May 2012 13:00 Go to next message
Zlatka Manas is currently offline Zlatka Manas
Messages: 26
Registered: March 2012
Junior Member
Hi,
I am a newbie in the modeling world and I need to define a grammar for a certain DSL. It is necessary to have syntax and type check.
Can anyone recommend a good type system?
I have found XSemantics and Xtext typesystem, and now I am wondering about Xbase.
Which one is good, or maybe someone can point the pro's and cons of them?

Any comment will be appreciated.

Thanks,
Zlatka
Re: Selection for a type system [message #871577 is a reply to message #871576] Mon, 14 May 2012 13:04 Go to previous messageGo to next message
Holger Schill is currently offline Holger Schill
Messages: 69
Registered: July 2009
Member
Hi Zlatka,

could you please give a small example what you want to achieve?

Cheers,
Holger

--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Selection for a type system [message #875435 is a reply to message #871577] Tue, 22 May 2012 18:48 Go to previous messageGo to next message
Zlatka Manas is currently offline Zlatka Manas
Messages: 26
Registered: March 2012
Junior Member
The language that I want to represent is object-oriented, so classes, objects and methods are used throughout.

For example:

data class ChannelInfo extends Object
instance variables
source: Integer, waiting: Boolean, target: Integer

instance methods
setSource(s: Integer): ChannelInfo
source := s;
waiting := 3; //this should not be possible
return self.

or
process class MobileStationSender(Id: Integer)

instance variables
msg:Integer

instance methods
OkSend(c: ChannelInfo)()
ch ! msg (c, msg);
msg := msg+1;
msg:=true; //this should not be possible
bs ! relsend(Id, c).



I am not sure if issues like this can be solved with Xtext only or do I need to use other type systems(mentioned above)?
Any comment or proposal will be helpful.

Thanks,
Zlatka
Re: Selection for a type system [message #875814 is a reply to message #871576] Wed, 23 May 2012 11:10 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1371
Registered: July 2009
Senior Member
On 05/14/2012 03:00 PM, Zlatka Manas wrote:
> Hi,
> I am a newbie in the modeling world and I need to define a grammar for a
> certain DSL. It is necessary to have syntax and type check. Can anyone
> recommend a good type system?
> I have found XSemantics and Xtext typesystem, and now I am wondering
> about Xbase.
> Which one is good, or maybe someone can point the pro's and cons of them?
>
> Any comment will be appreciated.
>
> Thanks,
> Zlatka

Hi

we are working on a comparison about the possible type system frameworks
for Xtext languages.

We have already presented a preliminary version of this work, the slides
can be found here

http://www.rcp-vision.com/?page_id=3902

In general, if your DSL has to be tightly coupled with Java, then you
should really consider to rely on Xbase (and exploit its full
integration with the Java type system). If this is not the case, you
might consider a manual implementation of the type system for your DSL
in plain Java/Xtend2, or rely on the other two frameworks XSemantics
(which provides examples of a type system for Featherweight Java and
type inference of lambda calculus) and Xtext typesystem (XTS); these
frameworks also provide a DSL for specific mechanisms targeted to type
system implementations.

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Re: Selection for a type system [message #892922 is a reply to message #871576] Sun, 01 July 2012 22:49 Go to previous messageGo to next message
Zlatka Manas is currently offline Zlatka Manas
Messages: 26
Registered: March 2012
Junior Member
The language should not be coupled with Java, so Xbase is out.
Out of the remaining two, which one can be learned faster? Or which syntax is simpler? Which criteria can be crucial for one or the other system?
I really need to make a decision on which system to use but for the moment they are equal.
The documentation for XSemantics is better structured and provides good examples, whereas XTS documentations is a bit messy. Also, concerning support, I think that XTS might have a bigger community so more people can help, not to mention the author himself. If I am wrong, I apologize to Lorenzo and the users of XSemantics.
Based on the documentation and examples, I would go for XSemantics but the judgments and premises and rules etc etc are a bit too much formal language.
Is there anyone who has used both of the systems and can provide a good (user) overview of them?
Any comment will be appreciated.

Thanks,
Zlatka
Re: Selection for a type system [message #893146 is a reply to message #892922] Mon, 02 July 2012 21:43 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1371
Registered: July 2009
Senior Member
On 07/02/2012 12:49 AM, Zlatka Manas wrote:
> The language should not be coupled with Java, so Xbase is out.
> Out of the remaining two, which one can be learned faster? Or which
> syntax is simpler? Which criteria can be crucial for one or the other
> system?
> I really need to make a decision on which system to use but for the
> moment they are equal. The documentation for XSemantics is better
> structured and provides good examples, whereas XTS documentations is a
> bit messy. Also, concerning support, I think that XTS might have a
> bigger community so more people can help, not to mention the author
> himself. If I am wrong, I apologize to Lorenzo and the users of
> XSemantics. Based on the documentation and examples, I would go for
> XSemantics but the judgments and premises and rules etc etc are a bit
> too much formal language.
> Is there anyone who has used both of the systems and can provide a good
> (user) overview of them? Any comment will be appreciated.
>
> Thanks,
> Zlatka

Hi Zlatka,
yes Xsemantics targets formal systems (and indeed if you need to develop
an involved type system you have to get into formal systems somehow ;)
I'm more than happy to help you if you need support :)
Xsemantics 1.1.0 (based on Xtext 2.3.0) has just been released with
updated documentation.

hope this helps
cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Re: Selection for a type system [message #894516 is a reply to message #871576] Mon, 09 July 2012 13:55 Go to previous messageGo to next message
Zlatka Manas is currently offline Zlatka Manas
Messages: 26
Registered: March 2012
Junior Member
Has anyone tried the example for XTS? I installed the plugin and I just wanna try the provided example for Expressions. As it is written, this example should be for xtext v2.0, and I have v2.0.1.
I get several errors for missing de.itemis.interpreter.

Thanks,
Zlatka
Re: Selection for a type system [message #984192 is a reply to message #871576] Wed, 14 November 2012 13:36 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Goodevening everyone,
I have a similar problem. I'm working with an existing language (Structured Text) and I have to create an editor for it.
Obviously I use Xtext for grammar definition, but now I have to add a type system and I'm not sure about which instrument is the best for me.

I'm going to use Xbase, but I have some types different by Java Types (eg UDINT or WORD). Can I use Xbase or is it better to use something else?
In the second case, Xsemantics could be a good alternative?

Very thanks for your suggestions.

UPDATE: I see also this one:
Xtext Typesystem
Is it useful?

[Updated on: Wed, 14 November 2012 14:02]

Report message to a moderator

Re: Selection for a type system [message #985397 is a reply to message #984192] Thu, 15 November 2012 11:12 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

UPDATE:
I recently learn how use JavaValidator and I think it is possible to check types also with it. Which disadvantages will introduce this method?

Waiting for replies,
very thank you.
Re: Selection for a type system [message #985736 is a reply to message #985397] Thu, 15 November 2012 21:31 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
I'd only use Xbase if your typesystem is pretty close to Java.

Using the validator is fine, but you may also want to adapt content
assist, such that users are not proposed illegal stuff.

In Xbase, we have an ITypeProvider that gives you the expected type (the
one the context expects) and the actual type of an expression.
Validation makes sure they match.

Am 15.11.12 12:12, schrieb Tommaso De Sica:
> UPDATE:
> I recently learn how use JavaValidator and I think it is possible to
> check types also with it. Which disadvantages will introduce this method?
>
> Waiting for replies,
> very thank you.


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Selection for a type system [message #985857 is a reply to message #985736] Fri, 16 November 2012 12:48 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Very thank you for your suggest.

Here are my types:
"INT""BOOL""REAL""SINT""DINT""UINT""USINT""UDINT""TIME""DATE""TIME_OF_DAY""DATE_AND_TIME""WORD""STRING"

Do you think that Xbase can menage them?

Very thank you!
Re: Selection for a type system [message #985872 is a reply to message #985857] Fri, 16 November 2012 14:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6396
Registered: July 2009
Senior Member
Hi your type system is way to simple for xbase.

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Selection for a type system [message #986071 is a reply to message #984192] Sun, 18 November 2012 09:31 Go to previous message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1371
Registered: July 2009
Senior Member
On 11/14/2012 02:36 PM, Tommaso De Sica wrote:
> Goodevening everyone,
> I have a similar problem. I'm working with an existing language
> (Structured Text) and I have to create an editor for it.
> Obviously I use Xtext for grammar definition, but now I have to add a
> type system and I'm not sure about which instrument is the best for me.
>
> I'm going to use Xbase, but I have some types different by Java Types
> (eg UDINT or WORD). Can I use Xbase or is it better to use something else?
> In the second case, Xsemantics could be a good alternative?
>
> Very thanks for your suggestions.

Dear Tommaso

in Xsemantics I define the type system of Xsemantics in Xsemantics
itself; since Xsemantics itself is based on Xbase, with some additional
small types and a different type rule (e.g., the one for Xbase variable
declaration); when I define the type system I can reuse Xbase classes to
define my typesystem: in most cases I simply delegate to Xbase
(ITypeProvider), in the cases I want to customize I write my own rules.

You can find the definition here:

http://sourceforge.net/p/xsemantics/code/ci/68395a1c0bed6fa2f3cdf7a0220a49d4f27c98ae/tree/plugins/it.xsemantics.dsl/src/it/xsemantics/dsl/typing/XsemanticsTypeSystem.xsemantics

hope this helps
cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Previous Topic:resolving cross-references
Next Topic:Help with simple grammar
Goto Forum:
  


Current Time: Fri Oct 31 09:53:49 GMT 2014

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

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