Reputation: 73
I have an Xtext project and a couple of sample DSL files. I can open these files with "Sample Ecore Model Editor" and validate that it conforms to the metamodel generated by Xtext. However, I cannot create an "EMF Project" or an "EMF Generator Model" due to the fact that the DSL file is not recognized as Ecore.
My question is, how can I export an ecore from my example.dsl
file?
P.S. I believe this is possible due to this fact
Upvotes: 3
Views: 3421
Reputation: 8695
You have two ways to get your hands on ecore meta-model for your DSL
In standard wizard-generated Xtext-Project the ecore meta-model get derived from your grammar. The workflow generator saves generated meta-model into
[Project]/src-gen/[your-package]/[grammar-name].ecore
For example:
org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/MyDsl.ecore
You can also write ecore meta-model yourself and use if with your grammar. This is not a simple process, but it provides more flexibility. For more information see: http://blog.efftinge.de/2009/11/xtext-using-existing-ecore-models.html
Upvotes: 2