Nesrinekh / OpenPME

ISC License
4 stars 0 forks source link

The model of math expressions must follow operator precedence #85

Open lschuetze opened 3 years ago

lschuetze commented 3 years ago

There is no way in order to write a math expression from left-to-right while the model that is created will follow the operator precedence for the complete expression.

A parser-based approach would read the expression while the lexer would create the CST (Concrete Syntax Tree) according to the grammar where the operator precedence would be incorporated. MPS uses a model-based approach, such that the user is instantiating models directly while writing. Even worse, the user has to select the model element first, then fill its children. This means, a math expression must be started with the operator that has the highest precedence (as noted in Issue #78).

The instantiation is completely user-driven without checking the resulting model for inconsistencies. That is a problem of missing well-formednes rules.

A solution could be (according to the empty line statements) to create empty expressions that are transformed into their corresponding model element.

To be investigated is whether the resulting expression tree needs a processing step that shapes it according to the operator precedence that a user would perceive from looking at the whole expression.