Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

MDT/OCL/1.X Architecture

< MDT‎ | OCL

The Architecture for MDT/OCL 1.2 and 1.3 is based on an LPG parser as shown in


A CompleteOCL document (or an individual OCL expression) may be parsed to produce a Concrete Syntax Tree (CST). The CST is processed by the anayzer to produce an Abstract Syntax Tree (AST). The validator checks the well-formedness of the AST. The evaluator uses the AST to evaluate OCL expressions on externally supplied models.

The CST is an MDT/OCL-specific model that has similarities to, but also significant differences from, the CS suggestions in the OMG OCL specification. The differences arise from practicalities of resolving ambiguous syntaxes, and the incomplete nature of Section 12 of the specfication.

Two forms of AST are provided that nominally conform to the OMG OCL specification. In practice there are minor spelling differences such as OCLExpression rather than OclExpression, and major discrepancies with respect to the underlying structural meta-model. The OMG specification is based on EMOF, whereas MDT/OCL 1.x supports either EMF/Ecore or MDT/UML2 based meta-models.

The dual support for Ecore or UML is supported by a UMLReflection class that ensures that the appropriately derived parameterisation of the AST model is used. Mixing and matching Ecore and UML2 meta-models is not supported.

As of MDT/OCL 1.3, the LPG grammar is modularized allowing derived languages such as QVT to re-use the OCL grammar, parser and analyzer.

The OCL standard library is realised by models and built-in code functionality making it very difficult for languages that extend OCL to extend or modify the OCL Standard Library.

MDT/OCL/4.X_Architecture shows how it is planned to alleviate these limitations. The Xtext editor parts of the 4.X plans are in place in MDT/OCL 3.0, but only as Examples which are not fully integrated with the whole.

Back to the top