Domain Specific Languages and C++ Code Generation
Florentin Picioroaga
IDS GmbH, Ettlingen, Germany
filo.rom@gmail.com
February 23, 2017
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 1 / 11
Overview
1 Motivation
2 DSL
What is a DSL?
Why using a DSL?
When using a DSL?
3 Xtext, the DSL engine
4 Xtext, workshop
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 2 / 11
Motivation
Increase productivity, combine C++ system performance with new
technologies with high developing productivity
challenge you to share similar interoperabilities between technologies
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 3 / 11
What is a DSL?
DSL
Domain Specific Language: a language created to solve a specific category
of problems. It contrasts with a GPL which is a General Programming
Language.
Examples:
GPL: C++, Java, Ruby, etc.
DSL: IDL, HTML, CSS, GraphViz, make, ant, SQL, LaTex, lexx,
yacc, etc.
This presentation focuses on a sub-category of DSL the domain-specific
modeling.
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 4 / 11
What is a DSL?
Characteristics:
it does not support any of the programming paradigms found in
GPLs: procedural programming, OOP, generic programming or
functional programming
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 5 / 11
What is a DSL?
Characteristics:
it does not support any of the programming paradigms found in
GPLs: procedural programming, OOP, generic programming or
functional programming
almost no support for implementing algorithms
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 5 / 11
What is a DSL?
Characteristics:
it does not support any of the programming paradigms found in
GPLs: procedural programming, OOP, generic programming or
functional programming
almost no support for implementing algorithms
it implies code-generation, the DSL code is the source for the
generated code
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 5 / 11
Why using a DSL?
low programming complexity. Interactions in DSL between
different elements is low.
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 6 / 11
Why using a DSL?
low programming complexity. Interactions in DSL between
different elements is low.
fast development. Implementing the DSL core done by domain and
DSL experts → less bugs, higher quality for the generated code. The
DSL can be then used efficiently by domain users.
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 6 / 11
Why using a DSL?
low programming complexity. Interactions in DSL between
different elements is low.
fast development. Implementing the DSL core done by domain and
DSL experts → less bugs, higher quality for the generated code. The
DSL can be then used efficiently by domain users.
strong decoupling business-logic from implementation. A DSL
provides a higher abstraction level. Implementation details 100% for
programming experts.
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 6 / 11
When using a DSL?
an entity model/meta-model exists. Example: the application works
with a database, a XML data model, EMF (Eclipse Modeling
Framework) model.
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 7 / 11
When using a DSL?
an entity model/meta-model exists. Example: the application works
with a database, a XML data model, EMF (Eclipse Modeling
Framework) model.
eventually the entities support operations
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 7 / 11
When using a DSL?
an entity model/meta-model exists. Example: the application works
with a database, a XML data model, EMF (Eclipse Modeling
Framework) model.
eventually the entities support operations
the entity model is used repetitively
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 7 / 11
Xtext, the DSL engine
Xtext is an Eclipse framework for developing DSLs.
Features:
easy to learn
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
Xtext, the DSL engine
Xtext is an Eclipse framework for developing DSLs.
Features:
easy to learn
mature and with very good community support
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
Xtext, the DSL engine
Xtext is an Eclipse framework for developing DSLs.
Features:
easy to learn
mature and with very good community support
easy to integrate with other technologies
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
Xtext, the DSL engine
Xtext is an Eclipse framework for developing DSLs.
Features:
easy to learn
mature and with very good community support
easy to integrate with other technologies
IDE support for grammar definition
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
Xtext, the DSL engine
Xtext is an Eclipse framework for developing DSLs.
Features:
easy to learn
mature and with very good community support
easy to integrate with other technologies
IDE support for grammar definition
auto-generated DSL editor with: syntax highlighting, jump to
definition, find references, etc.
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
Xtext, the DSL engine
Xtext is an Eclipse framework for developing DSLs.
Features:
easy to learn
mature and with very good community support
easy to integrate with other technologies
IDE support for grammar definition
auto-generated DSL editor with: syntax highlighting, jump to
definition, find references, etc.
powerful code generation engine, Xtend, with: syntax highlighting,
debug support
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
Enjoy live demo with Xtext!
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 9 / 11
References
Wikipedia: DSL
Wikipedia: DSM
Xtext
Xtend
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 10 / 11
Hope you enjoyed!
Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 11 / 11

Domain Specific Languages and C++ Code Generation

  • 1.
    Domain Specific Languagesand C++ Code Generation Florentin Picioroaga IDS GmbH, Ettlingen, Germany filo.rom@gmail.com February 23, 2017 Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 1 / 11
  • 2.
    Overview 1 Motivation 2 DSL Whatis a DSL? Why using a DSL? When using a DSL? 3 Xtext, the DSL engine 4 Xtext, workshop Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 2 / 11
  • 3.
    Motivation Increase productivity, combineC++ system performance with new technologies with high developing productivity challenge you to share similar interoperabilities between technologies Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 3 / 11
  • 4.
    What is aDSL? DSL Domain Specific Language: a language created to solve a specific category of problems. It contrasts with a GPL which is a General Programming Language. Examples: GPL: C++, Java, Ruby, etc. DSL: IDL, HTML, CSS, GraphViz, make, ant, SQL, LaTex, lexx, yacc, etc. This presentation focuses on a sub-category of DSL the domain-specific modeling. Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 4 / 11
  • 5.
    What is aDSL? Characteristics: it does not support any of the programming paradigms found in GPLs: procedural programming, OOP, generic programming or functional programming Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 5 / 11
  • 6.
    What is aDSL? Characteristics: it does not support any of the programming paradigms found in GPLs: procedural programming, OOP, generic programming or functional programming almost no support for implementing algorithms Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 5 / 11
  • 7.
    What is aDSL? Characteristics: it does not support any of the programming paradigms found in GPLs: procedural programming, OOP, generic programming or functional programming almost no support for implementing algorithms it implies code-generation, the DSL code is the source for the generated code Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 5 / 11
  • 8.
    Why using aDSL? low programming complexity. Interactions in DSL between different elements is low. Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 6 / 11
  • 9.
    Why using aDSL? low programming complexity. Interactions in DSL between different elements is low. fast development. Implementing the DSL core done by domain and DSL experts → less bugs, higher quality for the generated code. The DSL can be then used efficiently by domain users. Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 6 / 11
  • 10.
    Why using aDSL? low programming complexity. Interactions in DSL between different elements is low. fast development. Implementing the DSL core done by domain and DSL experts → less bugs, higher quality for the generated code. The DSL can be then used efficiently by domain users. strong decoupling business-logic from implementation. A DSL provides a higher abstraction level. Implementation details 100% for programming experts. Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 6 / 11
  • 11.
    When using aDSL? an entity model/meta-model exists. Example: the application works with a database, a XML data model, EMF (Eclipse Modeling Framework) model. Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 7 / 11
  • 12.
    When using aDSL? an entity model/meta-model exists. Example: the application works with a database, a XML data model, EMF (Eclipse Modeling Framework) model. eventually the entities support operations Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 7 / 11
  • 13.
    When using aDSL? an entity model/meta-model exists. Example: the application works with a database, a XML data model, EMF (Eclipse Modeling Framework) model. eventually the entities support operations the entity model is used repetitively Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 7 / 11
  • 14.
    Xtext, the DSLengine Xtext is an Eclipse framework for developing DSLs. Features: easy to learn Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
  • 15.
    Xtext, the DSLengine Xtext is an Eclipse framework for developing DSLs. Features: easy to learn mature and with very good community support Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
  • 16.
    Xtext, the DSLengine Xtext is an Eclipse framework for developing DSLs. Features: easy to learn mature and with very good community support easy to integrate with other technologies Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
  • 17.
    Xtext, the DSLengine Xtext is an Eclipse framework for developing DSLs. Features: easy to learn mature and with very good community support easy to integrate with other technologies IDE support for grammar definition Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
  • 18.
    Xtext, the DSLengine Xtext is an Eclipse framework for developing DSLs. Features: easy to learn mature and with very good community support easy to integrate with other technologies IDE support for grammar definition auto-generated DSL editor with: syntax highlighting, jump to definition, find references, etc. Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
  • 19.
    Xtext, the DSLengine Xtext is an Eclipse framework for developing DSLs. Features: easy to learn mature and with very good community support easy to integrate with other technologies IDE support for grammar definition auto-generated DSL editor with: syntax highlighting, jump to definition, find references, etc. powerful code generation engine, Xtend, with: syntax highlighting, debug support Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 8 / 11
  • 20.
    Enjoy live demowith Xtext! Florentin Picioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 9 / 11
  • 21.
    References Wikipedia: DSL Wikipedia: DSM Xtext Xtend FlorentinPicioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 10 / 11
  • 22.
    Hope you enjoyed! FlorentinPicioroaga (IDS GmbH) DSL & C++ Code Generation February 23, 2017 11 / 11