Skip to content

MontiCore - Expression-Language Modules

MC-Expressions are used to formulate mathematical and programmatic expressions of a set of literals. To achieve this, a system of modular and pluggable grammar parts are developed.

Given Expression languages in MontiCore

Currently, there are five expression languages. These are

Two further expression languages are defined in the OCL project:

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

If you want to use one (or more) of the given expression languages in your language, then all you have to do is extend it (or them) in your grammar. You are free to use any of them now.

Creating your own Expression language

There are some expressions you need desperately and that are not covered in the given expression languages?
Create a new grammar that extends at least ExpressionsBasis. In this grammar, you can add your own expressions. These expressions must implement the interface Expression in the ExpressionsBasis grammar. To include these expressions in your language, just extend the new grammar in your language. See here for an example.

Further Information