Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » TypeProvider implementation
TypeProvider implementation [message #686439] Wed, 22 June 2011 08:54 Go to next message
Sasi Varnan Sundarakandasamy is currently offline Sasi Varnan SundarakandasamyFriend
Messages: 9
Registered: June 2011
Junior Member
In our expression dsl, we would like to create our own type system. Is there any documentation available on how the ITypeProvider can be implemented? We are not able to find a proper documentation for the ITypeProvider implementation.
Re: TypeProvider implementation [message #686455 is a reply to message #686439] Wed, 22 June 2011 09:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the ITypeProvider is to Provide JvmTypes (Xtext Refs to Java Classes). are you sure that is what you mean if you talk of a typesystem? or do you mean something like http://code.google.com/a/eclipselabs.org/p/xtext-typesystem/?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: TypeProvider implementation [message #688218 is a reply to message #686439] Fri, 24 June 2011 07:32 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 6/22/11 10:54 AM, schrieb Sasi Varnan:
> In our expression dsl, we would like to create our own type system. Is
> there any documentation available on how the ITypeProvider can be
> implemented? We are not able to find a proper documentation for the
> ITypeProvider implementation.

If you want to use Jvm types, than ITypeProvider is the way to go. There
is only the java doc and the implementations and tests to guide you. Of
course you can always ask specific questions here.

If you are going to have your own notion of types, propably a bit
simpler than the Java type system also the problem is becomes really
simple. Typically you only need to implment two functions for your
expressions.

One that computes the type of your expression, which is typcially called
recursivly down an expression tree.

If you want to have type inferenc you will probably have to implment a
second function, which computes an expected type for a certain
expression. That function is typically called on the container of an
expression.

You'll find that these two functions are also the main concepts in
ITypeProvider.

Sven


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: TypeProvider implementation [message #689654 is a reply to message #688218] Tue, 28 June 2011 05:57 Go to previous messageGo to next message
Sasi Varnan Sundarakandasamy is currently offline Sasi Varnan SundarakandasamyFriend
Messages: 9
Registered: June 2011
Junior Member
Thanks Sven and Christian.

Actually I want a type system similar to Java types only. So I am not sure whether the XTypesystem has that support. I will check it anyways.

I have model similar to Entity Model example of XText where you can have fields and methods. The fields and methods uses the JVM types internally. And only those entity models are used in our expression. Generics support also will be added lately. In our expression we cross-refer the entity model fields and methods. For the model feature call scoping and overloaded methods resolving we need this type system. Thanks for your input. I will look into your suggestions.
Re: TypeProvider implementation [message #690374 is a reply to message #689654] Wed, 29 June 2011 12:52 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 6/28/11 7:57 AM, schrieb Sasi Varnan:
> Thanks Sven and Christian.
> Actually I want a type system similar to Java types only. So I am not
> sure whether the XTypesystem has that support. I will check it anyways.
>
> I have model similar to Entity Model example of XText where you can have
> fields and methods. The fields and methods uses the JVM types
> internally. And only those entity models are used in our expression.
> Generics support also will be added lately. In our expression we
> cross-refer the entity model fields and methods. For the model feature
> call scoping and overloaded methods resolving we need this type system.
> Thanks for your input. I will look into your suggestions.

I that case you should definitely reuse the type system provided by Xbase.

Sven


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Previous Topic:Problems with Scoping
Next Topic:Changes in mwe2 files not picked up
Goto Forum:
  


Current Time: Fri Apr 19 12:29:39 GMT 2024

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

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

Back to the top