mbeddr meets IncQuer - Combining the Best Features of Two Modeling Worlds
MBEDDR MEETS INCQUERY:
COMBINING THE BEST FEATURES OF
TWO MODELING WORLDS
István Ráth Tamás Szabó
Budapest University of
Technology and Economics
Fault Tolerant Systems
Research Group
Overview of the talk
Introduction
o INCQUERY
o mbeddr and MPS
MPS-INCQUERY
o A unique integration between Eclipse and non-Eclipse
modeling worlds
o Adapting a complex Xtext language to a different DSL
paradigm
Demo
Lessons learned
Conclusion
Model queries
Model queries:
“code that retrieves a piece of the model”
Queries are at the heart of MDE
o Every model access/read is a (simple) query
o More complex: Views, content providers
o Most complex: Model transformations, code
generators, …
EMF-INCQUERY Overview
A model query engine for batch and live queries
http://eclipse.org/incquery
• Expressive
graph pattern-based
language
• Built on Xtext and Xbase
• Focus on reusability:
query libraries, query
composition
Language
• Incremental
evaluation based on
the Rete algorithm
• Instantaneous
response for
complex queries
over large models
Execution
• Query and Change
APIs
• Validation
• View maintenance
• Maven builder for CI
Features
Available from the Eclipse Marketplace
Our mission to Mars: 1.0
How INCQUERY works
Your tool APIs Features
EMF
instance
model
Query
specifications
Query
results
Query result
delta stream
Model
modifications
Change notifications
On-the-fly
validation
Live views
Incremental
transformations and
code generation
Derived features
with notifications
(Xcore)
Incrementality:
cost is proportional
to change size,
rather than model
size
An extensible set of
integrated languages for
embedded software
development.
mbeddr
Integrated Languages
o Code C language implementation
o Higher-level abstractions for C
o Tight integration with formal verifications
Extensible Languages
o Extend and compose the existing languages
easily
o Without invasive changes
o Use only the set of languages that you need
MPS
Meta Programming System (JetBrains)
Language workbench
o A tool that supports the creation, extension and
composition of GPLs and DSLs + their IDEs
Development tools are centered around
languages
o Domain specific tools Domain specific
languages
“Interactive” / Aided AST building
Motivation
Computing scoping information for content
assist
Constraints: restricting containment, scope,
referencing
Live view maintenance to support projectional
editing
o Component diagrams in mbeddr
o Block diagrams in a commercial project
The Integration Challenge
EMF-INCQUERY has a very complex Xtext DSL
o Xbase (embedded in the language)
o Custom type system and inferencer
o Strong reliance on cross references for reusability
o Lots of non-trivial syntactic and semantic validators
Implementing the INCQUERY language in MPS
o Concepts, editors, type system, etc.
o Substitute MPS Base Language for Xbase
o MPS-style Code generator
o Same syntax and same expressive power
Goal: reuse the INCQUERY runtime
o As much as possible
Overview of the approach
Instance models
Languages
(meta)
Platform
(meta meta)
IncQuery
extensions
Java Base
Language
Queries
Derived
features
Query
Explorer
IDE content as
MPS model
MPS-IncQuery
Goal 2:
Language
Notifications
Goal 3: Type
safe API
extensions for
INCQUERY
features
Goal 4: UI
extension for
visualizing
query results
(debugging)
Goal 1: Queries
evaluated
directly over
MPS models
(C code)
DEMO
Requirements engineering and tracing in mbeddr
Real world example
Language extensions
oWorkpackages (tracking of efforts, required time)
o Assessments: small queries on various model
elements (reports)
Xtext MPS
Notation Textual
Arbitrary
(projectional editing)
File Content
Readability
Simple text
Workbench is
needed (XML)
Version control Usual workflow
Workbench is
needed for effective
version control
(Language)
Extensibility
One linear
customization chain
Non-trivial
customization is
hard
Easy and flexible
(by design)
Everything is
customizable
Grammar
ambiguity?
Possible
Not possible
(arbitrary
composition)
Xtext MPS
Documentation
Fundamental concepts are well
documented, advanced features are not
Editor usability Eclipse text editors
Getting used to
projectional editing
needs time
IDE functionality
Similar; code completion, type checking,
etc.
UI extensions (tool)
Tightly integrated
into Eclipse
Swing
Combining Eclipse technologies with MPS
Dual licensing (Apache and EPL)
Building / continuous integration
o Build language in MPS for building languages, running
tests (ant scripts)
o Executable and editor tests
o Build artifacts are JARs
Interoperability between Eclipse tools and MPS
o Through the generated artifacts (both directions)
o Direct MPS code modification is not possible (abstraction
gap)
On the end-user side
o MPS EMF exporter is available
o importer is not implemented yet
Progress
Obtaining / using MPS-INCQUERY?
ohttps://github.com/szabta89/MPS-IncQuery
oGlobal library (modules pool) of MPS
Ongoing/Future work
oSupport for graphical viewers in MPS
oReleases
• MPS-INCQUERY will be a fully featured and
maintained port
• Will be integrated into mbeddr releases
(product build)