Implementation of a Modular OCL Compiler - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Implementation of a Modular OCL Compiler

Description:

{ final OclAnyImpl tudOclNode0=Ocl.toOclAnyImpl( Ocl.getFor(this) ); final OclSet tudOclNode1=Ocl.toOclSet(tudOclNode0.getFeature('cards' ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 19
Provided by: frankf4
Category:

less

Transcript and Presenter's Notes

Title: Implementation of a Modular OCL Compiler


1
Implementation of a Modular OCL Compiler
  • Frank Finger
  • TU Dresden

2
Outline
  • Vision
  • Features of the Compiler
  • Problems with OCL
  • Demonstration
  • Discussion

3
Vision
UML Model
OCL
What happens to the OCL constraints?
4
Vision
UML Model
OCL
5
Role of the Compiler
context Customer inv cards-gtforAll(printedNamese
lf.name)
public boolean assert() final OclAnyImpl
tudOclNode0Ocl.toOclAnyImpl( Ocl.getFor(this)
) final OclSet tudOclNode1Ocl.toOclSet(tudOcl
Node0.getFeature("cards")) final OclIterator
tudOclIter0tudOclNode1.getIterator() final
OclBooleanEvaluatable tudOclEval0new
OclBooleanEvaluatable() public OclBoolean
evaluate() final OclString tudOclNode2
...tudOclIter0.getValue()...getFeature("printedNam
e") final OclString tudOclNode3Ocl.toOclS
tring(tudOclNode0.getFeature("name"))
final OclBoolean tudOclNode4tudOclNode2.isEqualTo
(tudOclNode3) return tudOclNode4
final OclBoolean tudOclNode5tudOclNode1.f
orAll(tudOclIter0, tudOclEval0) return
tudOclNode5.isTrue()
6
Demands
  • modular architecture
  • adaptable for different target languages
  • Java code generator
  • configurable normalization steps
  • close to specification (OCL 1.3)

7
Architecture
parser
OCL
model information
sem. analysis
normalization
target code
code gen.
8
Normalization
  • faciliates code generation
  • no fixed normal form
  • configurable normalization steps
  • expand multiple iterators ("-gtforAll(i1, i2...")
  • insert type information
  • expand shorthand for collect
  • ...
  • configured to suit target language

9
problems with OCL
  • Are keywords reserved? (issue 3138)
  • Can type names begin with a lower-case character?
    (issue posted)
  • Which expressions may contain let expressions?
    (issue 3148)
  • What happens if the value of a constraint is
    undefined? (no issue so far)(true / false /
    malformed constraint)

10
type checking problems
  • empty collections
  • equality is defined on arbitrary operands
  • semantics of qualifiers (7.5.5 vs. 7.5.7)
  • What is the type of "if ... then a else b endif"?

11
resume
  • OCL compiler is availablehttp//www-st.inf.tu-dre
    sden.de/ocl(including Java sources)
  • code generator for SQL integrity conditions is
    being implemented
  • to do CASE tool integration
  • demonstration

12
Demonstration
13
Demonstration
14
Demonstration
15
Demonstration
16
Demonstration
17
Demonstration
18
Role of the Compiler
context Customer inv cards-gtforAll(printedNamese
lf.name)
public boolean assert() final OclAnyImpl
tudOclNode0Ocl.toOclAnyImpl( Ocl.getFor(this)
) final OclSet tudOclNode1Ocl.toOclSet(tudOcl
Node0.getFeature("cards")) final OclIterator
tudOclIter0tudOclNode1.getIterator() final
OclBooleanEvaluatable tudOclEval0new
OclBooleanEvaluatable() public OclBoolean
evaluate() final OclString tudOclNode2
...tudOclIter0.getValue()...getFeature("printedNam
e") final OclString tudOclNode3Ocl.toOclS
tring(tudOclNode0.getFeature("name"))
final OclBoolean tudOclNode4tudOclNode2.isEqualTo
(tudOclNode3) return tudOclNode4
final OclBoolean tudOclNode5tudOclNode1.f
orAll(tudOclIter0, tudOclEval0) return
tudOclNode5.isTrue()
Write a Comment
User Comments (0)
About PowerShow.com