質問

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

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top