Use external Metamodel as library [message #1854090] |
Mon, 01 August 2022 08:52 |
|
We're currently defining the grammar for a DSL which uses datatypes. However the DSL language must not be used for defining those datatypes. The set of datatypes is initially fixed (e.g. to Boolean and Integer), however this can be extended in the future (e.g. to add Double, String, etc.).
Our approach to solve this, is to have a metamodel for our datatypes (just an Ecore without Xtext grammar associated) and make our Xtext grammar import it. This so far is fine, our Xtext grammar recognizes the imports and I'm able to define rules with cross-references to EClasses of the datatype metamodel.
Our concerns are more during runtime, as far as we know, the cross reference will accept EObjects already existing. To do so, we've instantiated a datatype model in an XMI file with just 2 datatypes (EObjects called Boolean and Integer). Our idea is to use the "Library" approach to make these 2 datatypes EObjects visible and usable on our textual representation. However, we're a bit lost on whether this is a "valid" approach and in positive case, which are the steps to accomplish this.
So far we've seen how the library approach works in the book "Implementing Domain Specific Languages with Xtext and Xtend" but the SmallJava language just uses one metamodel and does not fit 100% on what we're trying to achieve.
Any suggestions would be really appreciated.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03718 seconds