Search code examples
eclipsextext

Xtext: define 2 DSL's in one project


How do you define two DSL's in one Eclipse project?

The first DSL is used as input syntax where the user specify a design. The design needs to be converted into a different language. The different language is defined by the second DSL. For the transformation I intend to use Epsilon Transformation Language (ETL).


Solution

  • having two dsl in one project is not neccessary for your usecase. if you want to do it anyway you can add multiple language sections to the workflow like

        language = StandardLanguage {
            name = "org.xtext.example.mydsl.MyDsl"
            fileExtensions = "mydsl"
    
            serializer = {
                generateStub = false
            }
            validator = {
                // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
            }
        }
    
        language = StandardLanguage {
            name = "org.xtext.example.otherdsl.OtherDsl"
            fileExtensions = "mydsl2"
    
            serializer = {
                generateStub = false
            }
            validator = {
                // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
            }
        }