Common Concepts and Interfaces
This list explains some common abstract concepts and interfaces that you can use to extend or utilize the functionality of the platforms. Identifiers starting with a capital "I" refer to interfaces.
Mbeddr¶
mbeddr ⧉ only extends interfaces from de.slisson.mps.richtext.
Base¶
All common mbeddr interfaces are located in the namespace com.mbeddr.core.base.
Assessment¶ ⧉
To extend assessments, extend the class AssessmentQuery to create a new query. The result of the query has to extend the class AssessmentResult. Extend the interface AssessmentSummary ⧉ to provide a summary of the results.
Example:
Chunk¶
A node of the class Chunk ⧉ has several properties: it has a name, acts as a scope provider for elements, and can import other elements or vice versa. It also integrates with the tree view and provides a graph of all the chunk hierarchy, including imports. It also detects dependency cycles.
Example:
ICommentable¶
You can comment out concepts or interfaces that implement ICommentable by typing //
or /*
in the editor if the node doesn't implement IEmpty ⧉.
IDocumentable¶
Add support for documenting nodes when implementing the IDocumentable ⧉ interface. The text node uses the language de.slisson.mps.richtext
and supported text and embedded nodes.
ITreeViewable¶
Implement ITreeViewRoot ⧉ to use the Tree tool. It is a tool that can show a tree structure.
Example: IETS3 call tree of functions
IContainerOfUniqueNames¶
IContainerOfUniqueNames checks that the provided names are indeed unique and shows an error otherwise. For qualified names, implement the interface IHasQualifiedName ⧉.
IDetectCycle¶
Implement IDetectCycle ⧉ to detect cyclic dependencies. This feature is used, for example, with chunks that import other chunks.
IEmpty¶
Implement IEmpty ⧉ to support empty lines. It automatically suppresses error messages, and the implementing concept is also not visible in the outline.
Name-Related Interfaces¶
Use IIdentifierNamedConcept for concepts that should have valid identifiers. Check the property constraint ⧉ to understand how it works.
INameAllUpperCase, INameFirstCharLowerCase, and INameFirstCharUpperCase ⧉ can further constrain the identifier name.
IMbeddrIDERoot¶
Concepts that implement the interface IMbeddrIDERoot ⧉ show up in the New Roots menu. It is visible above the regular new menu of the context menu. It adds the following features: a custom name for the menu entry, root concept sorting, and custom categories for the root concepts.
IETS3¶
IETS3 ⧉ builds on mbeddr ⧉ interfaces in de.slisson.mps.richtext.
General¶
The general interfaces deal with integration of solvers and naming concepts. Interfaces for naming are also located in mbeddr ⧉ and can be a valid alternative.
ISolvable¶
Implement ISolvable to create solver tasks, executable by solvers such as Z3. To enable the solver for a node, implement the interface IUseSolver. A solver task must extend the concept AbstractSolverTask. The concept that can be mapped to the solver must implement ICanBeMappedToSolver ⧉.
ICanRunCheckManually¶
Implement ICanRunCheckManually ⧉ to support running checks that are executed through one of the actions (runAllManuallyOnModel, runAllManuallyOnRoot, runManuallyOnContainer) or intentions. User objects of the node can store the result of the checks. The interface also supports updating the editor with the test results, for example, highlighting the background of a test with color and refreshing the editor.
Example:
IOptionallyNamed¶
Use the interface IOptionallyNamed ⧉ for concepts that should support an optional name. You can also use this name in smart references.
IValidNamedConcept¶
As an alternative to the mbeddr interfaces, you can use the interface IValidNamedConcept ⧉ for valid identifiers that are valid in KernelF.
Expressions¶
To add a new expression, extend the concept Expression ⧉. The new concept is commentable and documentable by default.
ICanBeLValue¶
Implement the interface ICanBeLValue when the concept is valid as the left value ⧉ of expressions such as assignments. Variable references, paths, and dot expressions can be left values.
IDotTarget¶
Implement IDotTarget ⧉ to support custom operations for the dot expression. It can be used, for example, to add new operations for collections, enumerations, math, state machines, and many more.
IEmptyLiteral¶
IEmptyLiteral ⧉ is a marker interface used to mark literals that evaluate to an empty value at runtime.
ILiteral¶
Implement ILiteral to add support for a new literal. For primitive types such as integers and strings, extend the concept PrimitiveLiteral instead. Register an extension for the primitiveTypeMapper extension point when using custom primitive literals. The standard implementation is the SimpleTypesPrimitiveTypeMapper ⧉.
Effects¶
Since KernelF is by default immutable, some language extensions allow side effects, such as the language org.iets3.core.expr.mutable. To add custom concepts with effects, implement the interfaces IMayAllowEffect and IMayHaveEffect ⧉.
IOptionallyTyped¶
Use the interface IOptionallyTyped ⧉ to add an optional type to an expression. The expression automatically used the provided type as its type.
ITraceRoot¶
Nodes that want to be the root of tracing should implement the interface ITraceRoot ⧉
Custom Types¶
Custom types must extend the concept Type. If the type supports a default value (e.g., false
for the boolean type and 0
for a numeric type), implement the interface ITypeSupportsDefaultValue ⧉.
IWantNewLine¶
The concepts of expressions that need to be on a new line, such as try expressions, block expressions, and sometimes tables, must implement the interface IWantNewLine ⧉. This interface affects the layout of some expressions, such as if-expressions and function bodies.
Tests¶
To add a new test statement, extend the concept AbstractTestItem. If you need to update the editor after execution of the test item, override the method performAdditionalEditorUpdate ⧉.
Top-level¶
IToplevelExprContent¶
Implement the interface IToplevelExprContent to make expression available at the topmost level, like the ExpressionStatement ⧉ in Base Language.
Collections¶
When implementing custom operations for collections such as maps, lists, and sets, use one of the provided concepts as the base concept (for example NoArgCollectionOp and OneArgCollectionOp). If no suitable concept is available, implement one of the interfaces, such as ICollectionOp and IMapOneArgOp. If this is still not possible, you can still implement IDotTarget ⧉ directly.
MPS Extensions¶
MPS Extensions ⧉ doesn't have many interfaces because it can be mostly customized by extending editor cells.
Richtext¶
IWord¶
Implement IWord ⧉ to add new embeddable nodes to the text.