{'fraction_non_alphanumeric': 0.02403846153846154, 'fraction_numerical': 0.011217948717948718, 'mean_word_length': 5.063106796116505, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
An ANTLR-based Flattening Framework for AltaRica 3.0 Model

AltaRica is a modeling language that is capable of hierarchical modelling and fault behavior description for industrial safety-critical system design. AltaRica 3.0 is the latest version, and its semantics are based on a formal GTS (Guarded Transition Systems) model. One of the key steps in the process of safety analysis toward AltaRica 3.0 models is that how to flatten a hierarchical AltaRica 3.0 model into a semantically equivalent GTS semantic model. This paper proposes an AltaRica 3.0 model flattening algorithm framework based on ANTLR (Another Tool for Language Recognition). Firstly, considering the different structural features of Block and Class, the AltaRica 3.0 model is sliced carefully in order to obtain the corresponding AST (Abstract Syntax Tree). Secondly, a set of recursive transformation algorithms are designed to extract and transform the AltaRica model elements, which are stored in the AST nodes based on the traversal technique of the AST. Then, a semantically equivalent flattened GTS model can be obtained. Lastly, several case studies show that the algorithms designed in this paper can effectively implement the flattening process of AltaRica 3.0 models.