Building a DSL (Domain Specific Language) with XText

Nadeeshaan Gunasinghe
5 min readJun 17, 2024

What is a DSL

As software engineers, we all have used a programming language at one point. Most programming languages are general-purpose languages that we can use to address various use cases. Although general-purpose programming languages can be used to address a variety of use cases, they might not be ideal to address certain scenarios which require domain-specific knowledge.

For example, consider a scenario where we need to develop an application where doctors can configure a treatment routine for a patient. In this case, our objective would be to allow the doctors to program the routine. Imagine, what will happen if the doctor has to write this program with a general-purpose language like Java or C#. This definitely will not be ideal given the complexity of the solution.

Now, imagine that we have a programming language which is simpler to learn, domain knowledge is embedded in the language itself and catered to the specific features of the application. This would be ideal since we do not need software engineers to implement this treatment routine and citizen developers with domain knowledge would be able to easily configure the treatment routine. This is where the Domain Specific Languages (DSLs) come into play. The new DSL contains the domain knowledge and will address only limited and…

--

--

Nadeeshaan Gunasinghe

Autor, Expert Software Engineer at Zuhlke Group - Singapore, Microservices Enthusiast, Full-stack Developer, Hardcore Cricket Fan, Sci-fi Addict ;)