Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to implement function calls
How to implement function calls [message #673242] Mon, 23 May 2011 01:15 Go to next message
Lucy Sakhnenko is currently offline Lucy SakhnenkoFriend
Messages: 41
Registered: March 2011
Member
Hi!

I would like to have a language that supports something like:

MyDataType myVariable

myVariable.function()


This "function()" depends on the type of myVariable. In this example myVariable is of MyDataType type.

I don't have a deep knowledge of Xtext.

What way would you guys recommend me to implement this?




Re: How to implement function calls [message #673251 is a reply to message #673242] Mon, 23 May 2011 02:47 Go to previous messageGo to next message
Lex  is currently offline Lex Friend
Messages: 4
Registered: May 2011
Junior Member
Write the grammar for your language.

Write a compiler (generate code for an existing language such as Java) or an interpreter (evaluate/execute EMF model directly); in both cases you will be working with the EMF model created by Xtext from parsing code written in your language.
Re: How to implement function calls [message #673324 is a reply to message #673242] Mon, 23 May 2011 09:06 Go to previous messageGo to next message
Luong  is currently offline Luong Friend
Messages: 8
Registered: March 2011
Junior Member
Do you mean "support" syntactically?

Then I think that you have to write a dot notation in your grammar and customize eventually the scope provider.

In the forum there are old posts for the dot notation like here or here.

[Updated on: Mon, 23 May 2011 09:07]

Report message to a moderator

Re: How to implement function calls [message #673343 is a reply to message #673242] Mon, 23 May 2011 09:51 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

this is something that is excessively used in Xtend2. So you might want to have a look at its grammar and infrastructure (I guess that will be a bit overwhelming, though).

Another recent post dealing with this question is this one. The grammar and scoping samples may give you an idea how to start.

Alex
Re: How to implement function calls [message #674097 is a reply to message #673343] Wed, 25 May 2011 20:03 Go to previous message
Lucy Sakhnenko is currently offline Lucy SakhnenkoFriend
Messages: 41
Registered: March 2011
Member
Thank you all for your help.

I would like to have a look to complex grammars to learn more. Where I can download the Xtent2 source code? or maybe another grammar I can have a look at?

Thank you!
Previous Topic:Syntax Graph formatting
Next Topic:Using templates
Goto Forum:
  


Current Time: Fri Apr 19 05:45:51 GMT 2024

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

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

Back to the top