Skip to content

MontiCore - Expression-Language Modules

MC Expressions can be used to formulate mathematical and programmatic expressions from a set of literals. MC Expressions are based on a system of modular and pluggable grammar parts.

Given Expression languages in MontiCore

Currently, MontiCore comprises the following expression languages:

The OCL project defines additional expression languages:

Furthermore, composite SI unit expressions are defined in the SI Units project:

  • SI Units (can be used to parse primitive units as well as their products, quotients, and powers)

Using Expressions

To use one or more of the existing expression languages in your MontiCore-based language its grammar needs to extend those expression languages.

Creating your own Expression language

There are some expressions you need desperately and that are not covered by the existing expression languages?
In this case, you can create a new grammar that extends at least ExpressionsBasis. In the extending grammar, you are now free to add your own expressions which however must implement the Expression interface from ExpressionsBasis grammar. To then include the new expressions in a language let it extend the corresponding grammar. See here for an example.

Further Information