本文介绍了Xtext:在一个项目中定义2个DSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在一个Eclipse项目中定义两个DSL?

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

第一个DSL用作用户指定设计的输入语法。设计需要转换为不同的语言。不同的语言由第二DSL定义。对于转换,我打算使用Epsilon Transformation Language(ETL)。

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).

推荐答案

在一个项目中有两个dsl不是你的必需条件用例。如果你想要这样做,你可以在工作流程中添加多个语言部分,如

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"
        }
    }

这篇关于Xtext:在一个项目中定义2个DSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 17:11