2
votes

I am building my first DSL with Eclipse Xtext. I would like to be able to split the "main" Xtext file into multiple ones, for "modularity", if you will. Is there an import mechanism in Xtext files so that I can import those little Xtext files in the main one? This is essentially, grammar rules reuse, I want to do for the same language. I am not talking about reusing rules from different DSLs. The same language, but I want to split the big Xtext file to multiple ones and the main one will "orchestrate" the whole grammar by importing the little Xtext files. Can I do that and how?

Thank you

1

1 Answers

1
votes

You can only "mix in" one base grammar. In the example this is the Terminals part:

grammar org.example.domainmodel.Domainmodel
        with org.eclipse.xtext.common.Terminals

The complete documentation is here but basically there is no generic include mechanism.