Custom Aspect

Last modified: 18 June 2020

Alongside the usual language aspects, such as StructureEditorType-system, etc., it is possible for language authors to create custom language aspects (e.g. interpreter, alternative type-system, etc.), have them generated into a language runtime and then use these generated aspects from code.

 

What is a custom aspect?

Screen Shot 2015 09 30 at 20 37 45

Language definitions in MPS can be thought of as a collection of aspects: structure, editor, type-system, generator (1)

Each aspect of a language is defined in a separate aspect model. For example, the editor aspect of language L is defined in the L.editor model.

The aspect can be generated into a language's aspect runtime (2), which represents this aspect at runtime, in other words, when the language is being used inside MPS. The generated classes are then obtained by the corresponding subsystem through (3)  LanguageRuntime.getAspect() and can be used further (4).

Custom Aspect Descriptor

The IDE part of a language aspect is described by a SimpleLanguageAspectDescriptor, which can be created in the plugin model of a language.

Cookbook 

The SimpleLanguageAspectDescriptor concept covers only the IDE integration of this aspect. Please refer to Custom language aspect cookbook to learn how to implement the generator part to generate a runtime for your aspects and how to use the generated code from the corresponding subsystems.