Specifying concrete syntax as text in Sirius [message #1777045] |
Thu, 23 November 2017 23:51  |
Eclipse User |
|
|
|
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 #1777099 is a reply to message #1777088] |
Fri, 24 November 2017 07:42  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06398 seconds