MPS
concept notion of a language
aspects structure
editor
constraints
behavior
typesystem
for example, Entity
generator
actions
intentions
concepts of a language
and more
describes abstract structure
of a syntax element
visual representation of concepts
restrictions on concepts and their relationships
methods of concepts
inference and validation of types of concepts
translation of concepts into another language
advanced editor behavior
quickfixes
Creating a new language
Aspects of the language
creating concept
Entity
Structure Aspect creating concept “Entity” Entity has name
reference to the super-concept
reference to interface concepts that current concept implements
whether the concept can be used at AST root node
text in the right of the auto-completion menu – helps users
distinguish among concepts that share the same alias
properties are values owned by the concept
children define aggregation relationships between the concept and its possible parts
references can point to AST nodes that are not connected the concept via aggregation
string that it would be natural
to type when trying to create
an instance of the concept
“trigger”
Building the language playing with sandbox solution
keyword entity can’t be edited
editor in use
“compiling” the language
creating an instance of entity
in the sandbox solution
Structure Aspect creating concept “Field” Field has name
typing “field” in the projectional editor
will create an instance of concept Field
and show its projection
can have fieldsentity
Editor Aspect creating editors for concepts “Entity”, “Field”
creating editor for a concept
intentions
editor definition for Entity (statement-like)
editor definition for Field (statement-like)
editor in use
1 2
Editor Aspect
horizontal collection
vertical collection
Concepts interface implementation
INamedConcept is an interface concept
that has property name of type string
INamedConcept is an interface concept
that has property name of type string
explicit declaration of property name is removed
Subconcepts inheritance
number fieldfield
text field
toggle field
make concept Field abstractvia intentions menu
alias of abstract concept – removed
number field text field toggle field
extend concept Field
make
abstract concepts cannot be instantiated
1
2
Subconcepts inheritance
concept NumberField extends
abstract concept Field
concept TextField extends Field concept ToggleField extends Field
statement-like editor
editor in use
autocompletion menu provided by MPS
1 3 5
2 4 6
Structure Aspect concepts for statements
print statementstatement
assignment statement
Statement – abstract concept
Entity can have Statement’s
can be made an interface conceptStatement
Structure Aspect concepts for statements
editor in use
temporary solution
(will be replaced by
concept Expression)
concept PrintableValue
encapsulates a string value
PrintStatement extends
abstract concept Statement
projection of PrintableValue
is value itself
value is “hi”
3
4
1
2

JetBrains MPS: Structure Aspect

  • 1.
    MPS concept notion ofa language aspects structure editor constraints behavior typesystem for example, Entity generator actions intentions concepts of a language and more describes abstract structure of a syntax element visual representation of concepts restrictions on concepts and their relationships methods of concepts inference and validation of types of concepts translation of concepts into another language advanced editor behavior quickfixes
  • 2.
  • 3.
    Aspects of thelanguage creating concept Entity
  • 4.
    Structure Aspect creatingconcept “Entity” Entity has name reference to the super-concept reference to interface concepts that current concept implements whether the concept can be used at AST root node text in the right of the auto-completion menu – helps users distinguish among concepts that share the same alias properties are values owned by the concept children define aggregation relationships between the concept and its possible parts references can point to AST nodes that are not connected the concept via aggregation string that it would be natural to type when trying to create an instance of the concept “trigger”
  • 5.
    Building the languageplaying with sandbox solution keyword entity can’t be edited editor in use “compiling” the language creating an instance of entity in the sandbox solution
  • 6.
    Structure Aspect creatingconcept “Field” Field has name typing “field” in the projectional editor will create an instance of concept Field and show its projection can have fieldsentity
  • 7.
    Editor Aspect creatingeditors for concepts “Entity”, “Field” creating editor for a concept intentions editor definition for Entity (statement-like) editor definition for Field (statement-like) editor in use 1 2
  • 8.
  • 9.
    Concepts interface implementation INamedConceptis an interface concept that has property name of type string INamedConcept is an interface concept that has property name of type string explicit declaration of property name is removed
  • 10.
    Subconcepts inheritance number fieldfield textfield toggle field make concept Field abstractvia intentions menu alias of abstract concept – removed number field text field toggle field extend concept Field make abstract concepts cannot be instantiated 1 2
  • 11.
    Subconcepts inheritance concept NumberFieldextends abstract concept Field concept TextField extends Field concept ToggleField extends Field statement-like editor editor in use autocompletion menu provided by MPS 1 3 5 2 4 6
  • 12.
    Structure Aspect conceptsfor statements print statementstatement assignment statement Statement – abstract concept Entity can have Statement’s can be made an interface conceptStatement
  • 13.
    Structure Aspect conceptsfor statements editor in use temporary solution (will be replaced by concept Expression) concept PrintableValue encapsulates a string value PrintStatement extends abstract concept Statement projection of PrintableValue is value itself value is “hi” 3 4 1 2