Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Specifying concrete syntax as text in Sirius
Specifying concrete syntax as text in Sirius [message #1777045] Fri, 24 November 2017 04:51 Go to next message
Rohit Verma is currently offline Rohit VermaFriend
Messages: 21
Registered: August 2017
Junior Member
Hi,
I am new to Modelling in general and Sirius in particular.

I am trying to create a language for defining expressions and already have a metamodel defined in EMF (ecore) which I see as the modelling world equivalent of a grammar file of a parser generator tool (Attached metamodel).

I took the starter tutorial and somewhat understand how I can define the concrete syntax of a language visually. However, I want to know if I can also define a textual syntax. So, in short, my metamodel would have a class "Plus", with two associations : 1) LHS which links to another class called IntegerLiteral, and 2) LHS which links to another class called FloatLiteral. The corresponding concrete syntax should be: "Plus" is represented as "+", IntegerLiteral is represented as "1", FloatLiteral is represented as "1.0". The model itself is therefore, "1+1".

Can I do this in Sirius? If yes, then how? Any links to articles/tutorials will be more than appreciated.

Thanks.
Re: Specifying concrete syntax as text in Sirius [message #1777046 is a reply to message #1777045] Fri, 24 November 2017 04:55 Go to previous messageGo to next message
Rohit Verma is currently offline Rohit VermaFriend
Messages: 21
Registered: August 2017
Junior Member
Forgot to add: I need to eventually do a Model to text transformation as well using Acceleo of the Model I am trying to create.
Re: Specifying concrete syntax as text in Sirius [message #1777062 is a reply to message #1777046] Fri, 24 November 2017 08:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6627
Registered: July 2009
Senior Member
Hi

Sirius is a powerful graphical modeling tool.

Graphics has generally failed to provide good expression visualizations ever since Fortran demonstrated how good textual representations can be. What many textual languages now offer is pretty much Fortran plus a "." operator. Graphical languages therefore tend to offer text box pigeon holes.

Xtext is a powerful textual modeling tool with an underlying Xbase functionality that gives you Java-like functionality almost for free. I strongly recommend that you understand why Xbase is not suitable for your problem before moving on. Xtext can be used within the text box pigeon holes of a graphical editor.

If Xbase is not adequate, you may care to look at OCL which offers a more customized / OMG-standard expression language.

Regards

Ed Willink
Re: Specifying concrete syntax as text in Sirius [message #1777088 is a reply to message #1777062] Fri, 24 November 2017 10:51 Go to previous messageGo to next message
Rohit Verma is currently offline Rohit VermaFriend
Messages: 21
Registered: August 2017
Junior Member
Ed Willink wrote on Fri, 24 November 2017 08:49
Hi

Sirius is a powerful graphical modeling tool.

Graphics has generally failed to provide good expression visualizations ever since Fortran demonstrated how good textual representations can be. What many textual languages now offer is pretty much Fortran plus a "." operator. Graphical languages therefore tend to offer text box pigeon holes.

Xtext is a powerful textual modeling tool with an underlying Xbase functionality that gives you Java-like functionality almost for free. I strongly recommend that you understand why Xbase is not suitable for your problem before moving on. Xtext can be used within the text box pigeon holes of a graphical editor.

If Xbase is not adequate, you may care to look at OCL which offers a more customized / OMG-standard expression language.

Regards

Ed Willink


Hi Ed,

Thanks a lot for your reply. I do understand that Xtext is probably the best modelling environment I could use for the problem at hand. However, this expressions model that I need to define is part of a project @ school and the professor has explicitly barred me from using Xtext. My challenge is to find another suitable environment to A) Define an abstract syntax, concrete syntax and an editor, and B) Convert this model (represented by the concrete syntax) to text using Acceleo (for which I will be writing templates).

Can you suggest another environment/tool which is ecore based and would be better suited for defining the concrete syntax.

Thanks.
Re: Specifying concrete syntax as text in Sirius [message #1777099 is a reply to message #1777088] Fri, 24 November 2017 12:42 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6627
Registered: July 2009
Senior Member
Hi

I use Xtext because it's good. I don't look much further. But I think there are now at least three other tools of broadly similar capabilities. EMFText is one, Spoofax might be another. Perhaps you can find one your professor hasn't heard of.

But providing a Sirius graphical editor should be straightforward so just do it. A graphical editor typically has a 1:1 correspondence with the underlying Abstract Syntax, so the grammar aspects are trivial/non-existent.

In the past I have used LPG for grammar parsing and IMP for editing. It wasn't easy so I moved To Xtext. Presumably your professor has banned Xtext because you won't learn what he's trying to help you learn. You need to understand what she really wants and plan something sensible for the intended timescales.

Regards

Ed Willink
Previous Topic:Dynamically initialize labels in the palette
Next Topic:Radio Button Action
Goto Forum:
  


Current Time: Fri Apr 10 10:43:13 GMT 2020

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

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

Back to the top