Introduction to Domain
Specific Languages
(DSLs)
Pedro Mendes da Silva
Computer Scientist
Linked-in: https://pt.linkedin.com/pub/pedro-mendes-da-silva/0/505/483
SlideShare: http://www.slideshare.net/PedroSilva404/
DSLs: Introduction
Domain Specific Languages (DSLs) are special-purpose programming
languages developed for a specific domain.
Some of its most interesting benefits include:
● increasing productivity
○ by reducing
■ the lines of code that have to be written manually
■ the number of coding errors
● (due to automatic domain restrictions)
● test generation
● formal verification
DSL view types
● DSLs work by using higher-level constructions and
restrictions
○ which are automatically converted to a lower level
programming language at a later time
● DSLs can be
○ textual (declarative or imperative)
○ graphical
● DSLs can include multiple views for the same domain.
○ example: state machine in graphical or XML format
DSLs: Preprocessing
● I’ve used DSLs extensively in my work and it saves a lot
of time
○ I strongly recomend using them
● “Preprocessing” is one of the tyipcal ways to implement
DSLs
○ Some subtypes include:
■ Macro processing
■ Source-to-source transformation
● (conversion between languages)
■ Pipeline
■ Lexical processing
DSL usage types
● You can use these languages for many
purposes, including:
○ Defining an entity model
■ example: UML
○ Protocol definition
■ example: Google Protobuf Interface Definition
○ High-level user interface description
■ example: Mozilla XUL
○ Automated test case description
○ Software architecture description
DSL Development and Usage
● DSL usage includes 2 separate stages
○ 1) DSL Development
■ a new language must be specified
■ a module to convert from the new language to an
existing one must be implemented
■ the new language should tested and refined
○ 2)Programming using the new DSL
■ the new DSL should be imported in the projects
that need it
■ new code can then be produced using the DSL
DSLs: Microsoft Visual Studio
● Microsoft has some easy to use DSL editor
tools in Visual Studio
● Check the “Modeling SDK for Visual Studio –
Domain-Specific Languages” at http://msdn.
microsoft.com/en-us/library/bb126288.aspx
DSLs: References
Check additional information and examples in these references:
● When and How to Develop Domain-Specific Languages (2005) – http://www.rose-hulman.
edu/Users/faculty/young/OldFiles/CS-Classes/OldFiles/csse490-mbse/Readings/DSL-Survey-WhenHow.pdf
● AN APPROACH FOR THE SYSTEMATIC DEVELOPMENT OF DSLS (2009) – http://nm.wu-wien.ac.
at/home/mark/publications/spe-v39i15-oct09.pdf
● Guidance for Domain Specific Modeling in Small and Medium Enterprises (2011) – http://www.dima.tu-berlin.
de/fileadmin/fg131/Publikation/Papers/henning-agt-bizware-guidance-domain-specific-modeling-dsm-splash-2011.pdf
● Evaluating the Benefits of Using Domain-Specific Modeling Languages – an Experience Report (2013) – http://www.
dsmforum.org/events/dsm13/Papers/Wegeler.pdf

Domain Specific Languages: An introduction (DSLs)

  • 1.
    Introduction to Domain SpecificLanguages (DSLs) Pedro Mendes da Silva Computer Scientist Linked-in: https://pt.linkedin.com/pub/pedro-mendes-da-silva/0/505/483 SlideShare: http://www.slideshare.net/PedroSilva404/
  • 2.
    DSLs: Introduction Domain SpecificLanguages (DSLs) are special-purpose programming languages developed for a specific domain. Some of its most interesting benefits include: ● increasing productivity ○ by reducing ■ the lines of code that have to be written manually ■ the number of coding errors ● (due to automatic domain restrictions) ● test generation ● formal verification
  • 3.
    DSL view types ●DSLs work by using higher-level constructions and restrictions ○ which are automatically converted to a lower level programming language at a later time ● DSLs can be ○ textual (declarative or imperative) ○ graphical ● DSLs can include multiple views for the same domain. ○ example: state machine in graphical or XML format
  • 4.
    DSLs: Preprocessing ● I’veused DSLs extensively in my work and it saves a lot of time ○ I strongly recomend using them ● “Preprocessing” is one of the tyipcal ways to implement DSLs ○ Some subtypes include: ■ Macro processing ■ Source-to-source transformation ● (conversion between languages) ■ Pipeline ■ Lexical processing
  • 5.
    DSL usage types ●You can use these languages for many purposes, including: ○ Defining an entity model ■ example: UML ○ Protocol definition ■ example: Google Protobuf Interface Definition ○ High-level user interface description ■ example: Mozilla XUL ○ Automated test case description ○ Software architecture description
  • 6.
    DSL Development andUsage ● DSL usage includes 2 separate stages ○ 1) DSL Development ■ a new language must be specified ■ a module to convert from the new language to an existing one must be implemented ■ the new language should tested and refined ○ 2)Programming using the new DSL ■ the new DSL should be imported in the projects that need it ■ new code can then be produced using the DSL
  • 7.
    DSLs: Microsoft VisualStudio ● Microsoft has some easy to use DSL editor tools in Visual Studio ● Check the “Modeling SDK for Visual Studio – Domain-Specific Languages” at http://msdn. microsoft.com/en-us/library/bb126288.aspx
  • 8.
    DSLs: References Check additionalinformation and examples in these references: ● When and How to Develop Domain-Specific Languages (2005) – http://www.rose-hulman. edu/Users/faculty/young/OldFiles/CS-Classes/OldFiles/csse490-mbse/Readings/DSL-Survey-WhenHow.pdf ● AN APPROACH FOR THE SYSTEMATIC DEVELOPMENT OF DSLS (2009) – http://nm.wu-wien.ac. at/home/mark/publications/spe-v39i15-oct09.pdf ● Guidance for Domain Specific Modeling in Small and Medium Enterprises (2011) – http://www.dima.tu-berlin. de/fileadmin/fg131/Publikation/Papers/henning-agt-bizware-guidance-domain-specific-modeling-dsm-splash-2011.pdf ● Evaluating the Benefits of Using Domain-Specific Modeling Languages – an Experience Report (2013) – http://www. dsmforum.org/events/dsm13/Papers/Wegeler.pdf