Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "MDT/OCL/MDT-OCL 3.0.0 Migration Guide"

< MDT‎ | OCL
(Grammar changes)
(Grammar changes)
Line 58: Line 58:
  
 
== Grammar changes ==
 
== Grammar changes ==
 +
 +
The grammar changes should be invisible to OCL users, except in so far as bugs are fixed.
 +
 +
Implementers of derived languages will find that a creaful review is needed to track the changes that align with the OCL specification. In particular the spelling change of the OclExpressionCS to oclExpressionCS will almost certainbly be required. Careful examination of an LPG report file will often reveal that old names are assumed to be non-terminals.
 +
 +
=== Complete OCL and Essential OCL ===
  
 
The Complete OCL grammar is defined by OCLParser.g, OCLLexer.g, OCLKWLexer.g.
 
The Complete OCL grammar is defined by OCLParser.g, OCLLexer.g, OCLKWLexer.g.
Line 65: Line 71:
 
In MDT/OCL 1.3 EssentialOCL.g included a number of Complete OCL facilities such as reserved words, ^ and ^^ message operators and @pre suffixes. These are not present in MDT/OCL 3.0.0.
 
In MDT/OCL 1.3 EssentialOCL.g included a number of Complete OCL facilities such as reserved words, ^ and ^^ message operators and @pre suffixes. These are not present in MDT/OCL 3.0.0.
  
 
+
=== OCL 2.1 alignment ===
  
 
The MDT/OCL 3.0.0 grammar has been changed to align as closely as possible with the OMG OCL 2.1 concrete syntax and to provide the basis for a comprehensive grammar submitted for incorporation in a future OCL specification via resolution of Issues ...
 
The MDT/OCL 3.0.0 grammar has been changed to align as closely as possible with the OMG OCL 2.1 concrete syntax and to provide the basis for a comprehensive grammar submitted for incorporation in a future OCL specification via resolution of Issues ...
  
 
This alignment causes the following changes.
 
This alignment causes the following changes.
 +
 +
==== Spelling ====
 +
 +
Production names now match the OCL 2.1 specification as a result the following nominally similar productions are very different.
  
 
{| border="1"
 
{| border="1"
 
!MDT/OCL 1.3 production!! MDT/OCL 3.0.0 production
 
!MDT/OCL 1.3 production!! MDT/OCL 3.0.0 production
 
|-
 
|-
| OperationCallExpCS || operationCallExpCS
+
| booleanLiteralExpCS|| BooleanLiteralExpCS
 +
|-
 +
| callExpCS|| CallExpCS
 +
|-
 +
| collectionLiteralExpCS|| CollectionLiteralExpCS
 +
|-
 +
| collectionRangeCS|| CollectionRangeCS
 +
|-
 +
| collectionTypeIdentifierCS|| CollectionTypeIdentifierCS
 +
|-
 +
| dotArrowExpCS || ~ primaryExpCS
 +
|-
 +
| enumLiteralExpCS|| -
 +
|-
 +
| featureCallExpCS|| FeatureCallExpCS
 +
|-
 +
| ifExpCS|| IfExpCS
 +
|-
 +
| integerLiteralExpCS|| IntegerLiteralExpCS
 +
|-
 +
| invalidLiteralExpCS|| InvalidLiteralExpCS
 +
|-
 +
| iterateExpCS|| IterateExpCS
 +
|-
 +
| iteratorExpCS|| IteratorExpCS
 +
|-
 +
| letExpCS|| LetExpCS
 +
|-
 +
| literalExpCS|| LiteralExpCS
 +
|-
 +
| loopExpCS|| LoopExpCS
 +
|-
 +
| nullLiteralExpCS|| NullLiteralExpCS
 +
|-
 +
| oclExpCS || ~ primaryExpCS
 +
|-
 +
| oclExpressionCS|| OclExpressionCS
 +
|-
 +
| oclMessageArgCS|| OclMessageArgCS
 +
|-
 +
| oclMessageArgumentsCS|| OclMessageArgumentsCS
 +
|-
 +
| primitiveLiteralExpCS|| PrimitiveLiteralExpCS
 +
|-
 +
| propertyCallExpCS|| PropertyCallExpCS
 +
|-
 +
| realLiteralExpCS|| RealLiteralExpCS
 +
|-
 +
| stringLiteralExpCS|| StringLiteralExpCS
 +
|-
 +
| tupleLiteralExpCS|| TupleLiteralExpCS
 +
|-
 +
| unlimitedNaturalLiteralExpCS|| UnlimitedNaturalLiteralExpCS
 +
|-
 +
| variableExpCS|| AssociationClassCallExpCS
 +
|-
 +
| variableCS|| VariableDeclarationCS
 +
|-
 +
| variableCS2|| TupleLiteralPartCS
 +
|-
 +
| variableListCS|| variableDeclarationListCS
 +
|-
 +
| variableListCS2|| TupleLiteralPartsCS
 +
|}
 +
 
 +
==== Defactoring ====
 +
 
 +
Productions have been adjusted to match the OCL 2.1 presentation. 
 +
 
 +
{| border="1"
 +
!MDT/OCL 1.3 production!! MDT/OCL 3.0.0 production
 +
|-
 +
| attrOrNavCallExpCS|| AssociationClassCallExpCS
 +
|-
 +
| callExpCS|| CallExpCS
 +
|-
 +
| keywordOperationCallExpCS|| OperationCallExpCS
 +
|-
 +
| messageExpCS|| OclMessageExpCS
 +
|-
 +
| operationCallExpCS || OperationCallExpCS
 +
|-
 +
| stateExpCS|| OperationCallExpCS
 
|}
 
|}

Revision as of 02:16, 16 October 2009

CST changes

The CST forms a largely internal API, so OCL applications should be unaffected by changes.

Implementers of derived languages may notice a number of simplifications and enhancements.

ClassifierContextDecl.invOrDefCS and InvOrDefCS.invOrDefCS

InvOrDefCSis now maintained as an ClassifierContextDecl.constraints array rather than a reverse ordered linked list.

Simplify your code.

EnumLiteralExpCS

This class no longer exists.

"A::b" is now parsed as a PropertyCallExpCS, allowing a trailing @pre.

Change code that disambiguated a PropertyCallExpCS from an EnumLiteralExpCS to disambiguate an EnumLiteralExpCS from a PropertyCallExpCS.

FeatureCallExpCS.pathNameCS

This is a new field to support qualified names. It is also used by static calls.

Change old code that detected an anomalous PathNameCS as the FeatureCallExpCS.source to use the FeatureCallExpCS.pathNameCS.

Write new coded to support qualified names.

IsMarkedPreCS and FeatureCallExpCS.isMarkedPreCS

@pre is now parsed to a null/non-null IsMarkedPreCS, avoiding creating objects for the predominant usage of no @pre.

Change any access to test for isMarkedPreCS.isPre() to test for isMarkedPreCS != null. (Failure to change this will give an NPE).

Any usage of a non-null IsMarkedPreCS can be optimised to exploit it's @pre-always behaviour.

PathNameCS.sequenceOfNames

This new simpleNames field comprising a list of SimpleNameCS replaces the old sequenceOfNames field comprising a list of String. This allows the token context of each path element to be accesses by CST applications.

Change code to invoke SimpleNameCS.getValue() to obtain the old string.

Use the AbstractOCLAnalayzer.createSequenceOfNames() method to create a list of strings from the list of SimpleNameCS.

PropertyContextCS.initOrDerValueCS and InitOrDerValueCS.initOrDerValueCS

InitOrDerValueCS is now maintained as an PropertyContextCS.constraints array rather than a reverse ordered linked list.

Simplify your code.

StateExpCS

This class no longer exists.

An oclIsInState call is now parsed as an ordinary operation call.

The AbstractOCLAnalyzer invokes oclIsInStateOperationCallExpCS().

Grammar changes

The grammar changes should be invisible to OCL users, except in so far as bugs are fixed.

Implementers of derived languages will find that a creaful review is needed to track the changes that align with the OCL specification. In particular the spelling change of the OclExpressionCS to oclExpressionCS will almost certainbly be required. Careful examination of an LPG report file will often reveal that old names are assumed to be non-terminals.

Complete OCL and Essential OCL

The Complete OCL grammar is defined by OCLParser.g, OCLLexer.g, OCLKWLexer.g.

The Essential OCL grammar is now defined by EssentialOCL.g, EssentialOCLLexer.g, EssentialOCLKWLexer.g.

In MDT/OCL 1.3 EssentialOCL.g included a number of Complete OCL facilities such as reserved words, ^ and ^^ message operators and @pre suffixes. These are not present in MDT/OCL 3.0.0.

OCL 2.1 alignment

The MDT/OCL 3.0.0 grammar has been changed to align as closely as possible with the OMG OCL 2.1 concrete syntax and to provide the basis for a comprehensive grammar submitted for incorporation in a future OCL specification via resolution of Issues ...

This alignment causes the following changes.

Spelling

Production names now match the OCL 2.1 specification as a result the following nominally similar productions are very different.

MDT/OCL 1.3 production MDT/OCL 3.0.0 production
booleanLiteralExpCS BooleanLiteralExpCS
callExpCS CallExpCS
collectionLiteralExpCS CollectionLiteralExpCS
collectionRangeCS CollectionRangeCS
collectionTypeIdentifierCS CollectionTypeIdentifierCS
dotArrowExpCS ~ primaryExpCS
enumLiteralExpCS -
featureCallExpCS FeatureCallExpCS
ifExpCS IfExpCS
integerLiteralExpCS IntegerLiteralExpCS
invalidLiteralExpCS InvalidLiteralExpCS
iterateExpCS IterateExpCS
iteratorExpCS IteratorExpCS
letExpCS LetExpCS
literalExpCS LiteralExpCS
loopExpCS LoopExpCS
nullLiteralExpCS NullLiteralExpCS
oclExpCS ~ primaryExpCS
oclExpressionCS OclExpressionCS
oclMessageArgCS OclMessageArgCS
oclMessageArgumentsCS OclMessageArgumentsCS
primitiveLiteralExpCS PrimitiveLiteralExpCS
propertyCallExpCS PropertyCallExpCS
realLiteralExpCS RealLiteralExpCS
stringLiteralExpCS StringLiteralExpCS
tupleLiteralExpCS TupleLiteralExpCS
unlimitedNaturalLiteralExpCS UnlimitedNaturalLiteralExpCS
variableExpCS AssociationClassCallExpCS
variableCS VariableDeclarationCS
variableCS2 TupleLiteralPartCS
variableListCS variableDeclarationListCS
variableListCS2 TupleLiteralPartsCS

Defactoring

Productions have been adjusted to match the OCL 2.1 presentation.

MDT/OCL 1.3 production MDT/OCL 3.0.0 production
attrOrNavCallExpCS AssociationClassCallExpCS
callExpCS CallExpCS
keywordOperationCallExpCS OperationCallExpCS
messageExpCS OclMessageExpCS
operationCallExpCS OperationCallExpCS
stateExpCS OperationCallExpCS

Back to the top