B-OCL: An Object Constraint Language Interpreter in Python

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Haq, Fitash Ul, Cabot, Jordi
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866916639166955520
author Haq, Fitash Ul
Cabot, Jordi
author_facet Haq, Fitash Ul
Cabot, Jordi
contents The Object Constraint Language (OCL) has been widely used in the modeling community to complement software models for precisely defining constraints and business rules for the modeled systems. There is a limited number of tools supporting the definition and interpretation of OCL constraints, even less for a Python-based modelling approaches. In this paper, we introduce an OCL interpreter for Python. The interpreter has two components: parser and evaluator. We implement the OCL metamodel as a set of Python classes and design the grammar for the parser using the state-of-the-art ANTLR parser generator. The parser generates the syntax tree, that conforms with the OCL metamodel, after parsing each part of the OCL constraint. The evaluator then interprets the constraints using this syntax tree and the object diagram. In the end, the interpreter reports the result for all the constraints.
format Preprint
id arxiv_https___arxiv_org_abs_2503_00944
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle B-OCL: An Object Constraint Language Interpreter in Python
Haq, Fitash Ul
Cabot, Jordi
Software Engineering
The Object Constraint Language (OCL) has been widely used in the modeling community to complement software models for precisely defining constraints and business rules for the modeled systems. There is a limited number of tools supporting the definition and interpretation of OCL constraints, even less for a Python-based modelling approaches. In this paper, we introduce an OCL interpreter for Python. The interpreter has two components: parser and evaluator. We implement the OCL metamodel as a set of Python classes and design the grammar for the parser using the state-of-the-art ANTLR parser generator. The parser generates the syntax tree, that conforms with the OCL metamodel, after parsing each part of the OCL constraint. The evaluator then interprets the constraints using this syntax tree and the object diagram. In the end, the interpreter reports the result for all the constraints.
title B-OCL: An Object Constraint Language Interpreter in Python
topic Software Engineering
url https://arxiv.org/abs/2503.00944