Thanks for the answer. To clarify - I'm using OCL as an input for a custom Java code generation.
User specify expressions in OCL against their UML model, OCL then parsed to AST, then custom code generator emmits Java (and Typescript) code from it.
I'm not extremely familiar with Pivot OCL - can I use it's parser to build AST Syntax Tree? Will it use classes from org.eclipse.ocl.uml for it's AST representation?
Good luck writing an OCL to Java code generator; it's hard. You would do better to re-use the Eclipse OCL code generator that is integrated with EMF genmodel. In principle you just embed your OCL in UML and the normal UML2ECore2Java genmodeling will give you a Java equivalent.
The Pivot OCL uses NO classes from org.eclipse.ocl.ecotre or org.eclipse.ocl.uml. Instead there is a unified representation that avods template parameterization and supports many new activities and fixes.
I suggest you at least scim the code generation aspects of the OCL tutorials.
The OCL2Java CG is complete but still evolving. It is intended to be extensible to other languages and I'm beginning to think harder about C/C++, but realistically another target will require non-trivial work.
Thanks again for a quick answer. Indeed, writing CG for OCL is a lot of... fun. But we're working with quite specific requirements. In general we need to support like 20% of OCL, but with Java, Typescript and SQL as target platform.
It can be said that we're actually working with DSL, reusing part of OCL syntax.
As far as I understand to parse let without types we need a major refactoring to the whole 'compiler' as we're using types and visitors from ocl.uml A LOT. Basically switch the underlying OCL model to Pivot implementation.
We will re-evaluate our requirements with this information.
The ocl.pivot model includes 100% of itse classes. The ocl.uml has only the OCL classes, so the ocl.uml visitors only work half the time; you have to use a Switch for UML. The pivot visitors are extensible, work all the time and have some useful default implementations.