CN108037913B - Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium - Google Patents

Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium Download PDF

Info

Publication number
CN108037913B
CN108037913B CN201711397443.9A CN201711397443A CN108037913B CN 108037913 B CN108037913 B CN 108037913B CN 201711397443 A CN201711397443 A CN 201711397443A CN 108037913 B CN108037913 B CN 108037913B
Authority
CN
China
Prior art keywords
msvl
class
expression
model
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711397443.9A
Other languages
Chinese (zh)
Other versions
CN108037913A (en
Inventor
舒新峰
王曙燕
王梦楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian University of Posts and Telecommunications
Original Assignee
Xian University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian University of Posts and Telecommunications filed Critical Xian University of Posts and Telecommunications
Priority to CN201711397443.9A priority Critical patent/CN108037913B/en
Publication of CN108037913A publication Critical patent/CN108037913A/en
Application granted granted Critical
Publication of CN108037913B publication Critical patent/CN108037913B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code

Abstract

The invention belongs to the technical field of computer software, and discloses a method for converting an xUML4MC model into an MSVL (modeling, simulation and verification language) language program and a computer program, wherein the method for converting the xUML4MC model into the MSVL comprises the following steps: establishing a class diagram model and an activity diagram model description system; converting the class diagram and the activity diagram into an object-oriented abstract syntax tree; preprocessing the object-oriented abstract syntax tree and converting the object-oriented abstract syntax tree into a process-oriented abstract syntax tree; the process-oriented abstract syntax tree is converted into an MSVL language program. The method is suitable for modeling of a model detection system, the UML-based visual modeling mode is visual and easy to master, and is more convenient and accurate compared with a text language modeling mode, and the MSVL (modeling language) program generated by conversion can be directly used for model detection. The invention realizes the unification of software design modeling and model detection system modeling, and promotes the popularization of the model detection technology in the industry.

Description

Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium
Technical Field
The invention belongs to the technical field of computer software, and particularly relates to a method for converting an xUML4MC model into an MSVL (modeling, simulation and verification language) language program and a computer readable storage medium.
Background
Model detection is an important formal verification technique that detects whether a system to be verified satisfies a desired property by exhaustively traversing the state space of the system. Since the model detection process can be automatically completed by a computer and can also provide a counter example path to facilitate positioning errors and debugging by engineering technicians when the property is not established, the method is highly appreciated in the industry and has been successfully applied to system verification in various fields such as hardware, communication protocols, traffic control and the like. The MSVL is an executable subset of projection sequential logic, is a sequential logic programming language integrating system Modeling (Modeling), Simulation (Simulation) and Verification (Verification), supports rich data types, expressions and statements capable of describing sequence, selection, circulation, concurrency and synchronization features, can unify Modeling and property description of the system in the same logic framework, and verifies the property of the system through a special model detection tool MSV. However, MSVL is a logic programming language of text mode, which is completely different from the common programming language in the industry (such as C language), and the engineer needs to master the language to perform system modeling; secondly, the established model has no visual visibility, and the correctness of the model is difficult to ensure when a complex system is modeled; in addition, the modeling of the model type detection system and the analysis design modeling of the software and hardware system development are independent, and engineering technicians need to use different modeling methods and tools to respectively establish two sets of models in the system development and verification, so that the development difficulty and workload are increased.
The UML language is a universal development modeling language and provides a standard method for visualizing system design in the field of software engineering; the method is widely applied to the aspects of system design and modeling of software engineering, and has the characteristics of unification and visual modeling. UML is a semi-formal language, and the established model can only describe a system design model in a coarse granularity and cannot be directly applied to model detection. The UML language is expanded, a visual modeling language xUML4MC (extension UML for model Checking) is defined, more accurate expressions, formalized definitions of statements and visual modeling symbols are added to the UML activity diagram, and the modeling requirement for accurately describing system behaviors can be met. The formalized definitions of the expressions and statements are shown in table 1; the visual modeling notation of the expansion of the activity graph is shown in table 2.
TABLE 1 expression and statement definitions
Figure GDA0003131592000000021
TABLE 2 visual modeling notation of UML Activity graph extensions by xUML4MC
Figure GDA0003131592000000022
In summary, the main problems of the prior art are as follows: the MSVL is used for modeling the system to be verified, modeling language is difficult to master, a modeling mode is not visual, and modeling requirements of a complex system cannot be met; the UML (unified modeling language) which is widely used in the software development in the industry is not accurate enough in syntax and semantics and cannot be used for model detection.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a method for converting an xUML4MC model into an MSVL (modeling, simulation and verification language) language program and a computer-readable storage medium. According to the method, the analysis and design models of the system to be developed and the system model of model detection are unified into one model through the xUML4MC visual modeling language, and engineering technicians complete modeling during system analysis and design, so that organic unification of software development modeling and model detection modeling is realized, the complexity and difficulty of modeling of a model detection system are reduced, and the software development efficiency is improved; and an automatic conversion method from a system model to an MSVL (modeling, simulation and verification language) program language model is provided, the popularization and application of a model detection technology in the industry are promoted, and the safety and reliability of software products in China are improved.
The invention provides a method for converting an xUML4MC model into an MSVL (modeling, simulation and verification language) language program, which comprises the following steps: establishing a class diagram model and an activity diagram model description system; converting the class diagram and the activity diagram into an object-oriented abstract syntax tree; preprocessing the object-oriented abstract syntax tree and converting the object-oriented abstract syntax tree into a process-oriented abstract syntax tree; and converting the abstract syntax tree oriented to the process into an MSVL language program.
Further, the method for converting the xmll 4MC model into the MSVL language program comprises the following steps:
the first step is as follows: establishing a class diagram model and an active diagram model for a system to be verified, wherein the class diagram model and the active diagram model comprise classes contained in the system and a relation between the classes; the activity graph model comprises a data interaction process between objects in the system;
the second step is that: analyzing the class diagram model and the activity diagram model of the system to be verified, and constructing an object-oriented abstract syntax tree of the system to be verified according to the syntax rule of the xUML4MC, wherein the object-oriented abstract syntax tree comprises all information of the class diagram and the activity diagram;
the third step: converting the object-oriented abstract syntax tree into a process-oriented abstract syntax tree, including object-oriented language to process-oriented language preprocessing rules;
the preprocessing rule is as follows:
rule 1: adding 'struct' before the class name of a class node in the abstract syntax tree as a prefix;
rule 2: and removing the initial value of the class attribute with the initial value, and adding an assignment statement of the class attribute after the initial node of the hierarchical syntax diagram structure to which all the construction methods of the class belong. If the class has no construction method, a parameterless construction method without any statement is created for the class, then a rule 2 is executed, and the structure of the hierarchical syntax diagram is as shown in FIG. 4;
rule 3: if one class has a Parent class, adding a new class attribute of _ Parent to the class, wherein the type of the attribute is the Parent class type of the class;
rule 4: in the content of the initial node of the hierarchical syntax diagram structure of each class method, the class name plus '_' of the class to which the method belongs is added before the method name as a prefix, and a new argument "@ is" is added at the first position of the argument, wherein the type of the argument is the type of the class to which the method belongs. If there is a return value, then at the last position of its argument, a new argument ". times.ret" is added, the type of which is the return value type. If the class has a plurality of reloading methods, adding a ' _ ' plus numerical index ' as a suffix of the method name after the method name of each reloading method.
Rule 5: for each statement containing the direct access class attribute in the hierarchical syntax diagram, adding 'this- >' to the class attribute of the statement;
rule 6: for statements containing method calls in methods of classes, x ═ obj.fun (e1, …, en) and obj.fun (e1, …, en), where obj is an instance of a class, the method call statements are replaced with fun (obj, e1, …, en, & x) and fun (obj, e1, …, en);
rule 7: for the termination state node of the hierarchical syntax graph, if it contains the return statement "return", this statement is replaced with "× Ret ═ e";
the fourth step: data type conversion rules, expression conversion rules, statement conversion rules and graphic element conversion rules between the xUML4MC language and the MSVL language.
Further, the conversion rule from xmll 4MC to MSVL data types is:
(1) the data type is Boolean, and the data type is converted into MSVL (modeling, simulation and verification language) of pool;
(2) the data type is Integer, and the MSVL is converted into int;
(3) the data type is Real, and the MSVL is float;
(4) the data type is Set and Sequence, and the data type is converted into MSVL (modeling, simulation and verification language) as list;
(5) the data type is Array, and the MSVL is converted into Array.
Further, the expression conversion rule is: converting the expression, wherein x is a variable or a constant, obj is an object, attr is an attribute of the class, e and b represent standard symbols, and the reference rule is as follows:
(1) the expression is x, and the MSVL expression is converted into x;
(2) the expression is attr, and the expression is converted into MSVL which is this- > attr;
(3) the expression is obj.attr, and the MSVL expression is transformed into obj.attr;
(4) the expression is true, and the MSVL expression is converted into true;
(5) the expression is false, and the MSVL expression is false;
(6) the expression is e [ + | - |/] b, and the expression is converted into MSVL expression e [ + | - |/] b;
(7) the expression is e [ < | > | < | > ] b, and the conversion is MSVL expression e [ < | > |! B;
(8) the expression is e > -b, and the MSVL expression is e > -b or e > b;
(9) the expression is e < ═ b, and the MSVL expression is e < ═ b or e < b;
(10) the expression is e [ and | or | xor ] b, and the expression is converted into MSVL expression e [ and | or | xor ] b;
(11) the expression is e, b, and the MSVL expression is e, b;
(12) the expression is (e), and the MSVL expression is (e).
Further, the statement conversion rule is as follows: type represents data type, x is a variable, obj is an object, fun represents a method name, Class represents a Class name, e represents an expression, and the reference rule is as follows:
(1) type is x, the MSVL sentence is type x;
(2) the sentence is x, type: ═ e, and the conversion is MSVL, the sentence is type x: ═ e;
(3) the sentence is x: ═ e, and the conversion is MSVL, and the sentence is x: ═ e;
(4) fun (e1, …, en), converted to MSVL sentence fun (obj, e1, …, en, & x);
(5) fun (e1, …, en) with a transition to MSVL statement fun (obj, e1, …, en).
Further, the graphic element conversion rule e is the content in the graphic element, b is the content contained in the graphic element, and the reference rule is:
(1) the graphic element TYPE is TYPE _ IF, and the converted MSVL statement is IF (e) (b);
(2) the graphic element TYPE is TYPE _ LOOP, and the MSVL statement is while (e) (b);
(3) the type of the graphic element is Control flow, and the two graphic elements connected with the element are converted into MSVL (modeling, simulation and verification language) statements e 1; e 2;
(4) the graphic element TYPE is TYPE _ IF, IF the NO branch is contained, the conversion is MSVL, and the statement is IF (e) { b1} else { b2 };
(5) the graphic element TYPE _ IF refers to a branch TYPE, TYPE _ LOOP refers to a LOOP TYPE, and Control flow refers to a Control flow TYPE.
Another object of the present invention is to provide a system for converting an xUML4MC model into an MSVL language program of the method for converting an xUML4MC model into an MSVL language program, wherein the system for converting an xUML4MC model into an MSVL language program comprises:
the system modeling module is used for establishing a class diagram model and an activity diagram model for the system to be verified;
the abstract syntax tree generating module is used for containing the activity diagram information into a hierarchical syntax diagram structure in the object-oriented abstract syntax tree;
and the preprocessing module is used for processing the information contained in the object-oriented abstract syntax tree one by one until the information of all the nodes is processed.
And the MSVL conversion module is used for processing the preprocessed process-oriented abstract syntax tree nodes one by one in the MSVL conversion process until all the nodes are processed.
Further, the construction of the class diagram for the system modeling module includes specifying the entry method for the system, with entries underlined;
the relationships between classes include inheritance, association and aggregation. The association relationship between the classes comprises association role names and association multiplicity.
Further, the abstract syntax tree generating module includes merging the system class diagram and the activity diagram information, wherein the class diagram information is included in the object-oriented abstract syntax tree structure.
Another object of the present invention is to provide a computer-readable storage medium for implementing the method for converting the xml 4MC model into an MSVL language program.
The system modeling module adopts an xUMl4MC visual language to carry out system modeling, the language has detailed syntax semantic definition, the language adopts an object-oriented modeling idea to abstract all components of a system to be verified into classes, the basic contents of all parts of the system are represented by the attributes of the classes, the behaviors of all parts are represented by class methods, and the relationship of all parts is represented by inheritance, association, combination and the like between the classes. In order to express the system behavior more clearly, each behavior of each part is described in detail by using an activity diagram. The interaction between the objects in the system, the data transmission and the like are represented by activity diagrams.
The abstract syntax tree module constructs an object-oriented abstract syntax tree based on an xUML4MC language by adopting a compiling principle idea, wherein the abstract syntax tree contains all information of system classes, including class names, attributes, class relations and class methods. Based on the object-oriented idea, the associated information of the class is directly converted into the attribute information of the class, and the class method and the activity diagram information are combined into an abstract syntax tree to simplify the information of the original system model diagram.
The preprocessing module of the invention provides an object-oriented to process-oriented conversion method. The xmll 4MC language itself is based on object-oriented idea for system modeling, but no technology for directly supporting model detection of graphical system models is available. Therefore, it is proposed to convert this model into a procedure-oriented MSVL program language. By comparing the characteristics of object-oriented and process-oriented, the basic constituent element classes in the object-oriented and process-oriented methods are proposed to be split into structure body plus functions in the process-oriented methods. Converting the class name into a structure name, converting the class attribute into a structure member variable, and converting the activity diagram part into an object-oriented function. The specific conversion rules refer to the pre-processing rules described above. All pre-processing rules are processed on an object-oriented abstract syntax tree.
The MSVL module of the invention provides a comparison conversion rule of the data types, expressions, sentences and graphic elements based on object-oriented to process-oriented processing work which is completed in preprocessing by comparing the difference between the grammar of the xUML4MC and the grammar of the MSVL.
Compared with the prior art, the method can realize visual modeling applied to the field of modeling of a model detection system, provides a conversion rule from an object-oriented model to a process-oriented model, realizes conversion from an xUML4MC model to an MSVL (modeling language) program, obtains a verifiable MSVL model, and further verifies the safety and reliability of the system model. The invention realizes the unification of system design modeling and model detection system modeling, improves the software development efficiency and promotes the popularization of the model detection technology in the industry.
Drawings
Fig. 1 is a flowchart of a method for converting an xmll 4MC model into an MSVL language program according to an embodiment of the present invention.
Fig. 2 is a flowchart of an implementation of a method for converting an xml 4MC model into an MSVL language program according to an embodiment of the present invention.
Fig. 3 is a diagram of an abstract syntax tree structure proposed for the xml 4MC model according to an embodiment of the present invention.
Fig. 4 is a diagram illustrating a hierarchical syntax diagram provided for an activity diagram of an xmll 4MC model according to an embodiment of the present invention.
FIG. 5 is a schematic structural diagram of a system for converting an xUML4MC model into an MSVL (modeling, simulation, verification and verification language) program according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a CSS system class diagram provided by an embodiment of the present invention;
FIG. 7 is a schematic diagram of a CSS system partial activity diagram provided by an embodiment of the present invention;
FIG. 8 is a diagram illustrating a structure of a CSS system abstract syntax tree according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating an abstract syntax tree structure after CSS preprocessing according to an embodiment of the present invention;
in the figure: 1. a system modeling module; 2. an abstract syntax tree generation module; 3. a preprocessing module; 4. and converting the MSVL module.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The xUML4MC is a visual modeling language, and adds more detailed syntax and semantics to the UML activity diagram by extending the UML activity diagram, and has complete symbols, data types, syntax and formal definitions, so that the system modeling requirements of the model detection technology can be met.
The system modeling process in the invention needs to use a proprietary modeling tool based on the xUML4MC language, and the running environment of the tool is as follows:
the system comprises the following steps: windows7 and above
Memory: 2GB
A CPU: intercore i3 and above
Software: JVM, JRE support
The following detailed description of the principles of the invention is provided in connection with the accompanying drawings.
As shown in fig. 1, the method for converting an xmll 4MC model into an MSVL language program provided by the embodiment of the present invention includes the following steps:
s101: performing system modeling on a system to be verified by using an xUML4MC visual modeling language, wherein the system to be verified is established with a class diagram model and an activity diagram model; the class diagram model comprises classes contained in an abstract system and the relationship between the classes, and the activity diagram model comprises a data interaction process between objects in the system;
s102: importing the obtained result into an abstract syntax tree generating module, wherein the abstract syntax tree generating module comprises a class diagram model and an activity diagram model of a system to be verified, and an object-oriented abstract syntax tree of the system to be verified is constructed according to the syntax rule of xUML4MC, and the abstract syntax tree comprises all information of the class diagram and the activity diagram;
s103: importing the constructed abstract syntax tree into a preprocessing module, wherein the preprocessing module converts the object-oriented abstract syntax tree into a process-oriented abstract syntax tree which comprises object-oriented language to process-oriented language preprocessing rules;
s104: inputting the preprocessed process-oriented abstract syntax tree into a conversion MSVL module, wherein the conversion process comprises the following steps: data type conversion rules, expression conversion rules, statement conversion rules and graphic element conversion rules between the xUML4MC language and the MSVL language.
The application of the principles of the present invention will now be described in further detail with reference to the accompanying drawings.
As shown in fig. 2, the method for converting an xmll 4MC model into an MSVL language program provided by the embodiment of the present invention includes the following steps:
the first step is as follows: and performing system modeling on the system to be verified by using an xUML4MC visual modeling language, wherein the system to be verified comprises establishing a class diagram model and an active diagram model. The class diagram model comprises classes contained in an abstract system and the relationship between the classes, and the activity diagram model comprises a data interaction process between objects in the system;
the second step is that: importing the result obtained in the first step into an abstract syntax tree generating module, wherein the abstract syntax tree generating module analyzes a class diagram model and an activity diagram model of a system to be verified, and constructs an object-oriented abstract syntax tree of the system to be verified according to a syntax rule of the xUML4MC, the abstract syntax tree comprises all information of the class diagram and the activity diagram, and the abstract syntax tree structure is shown in FIG. 3 and FIG. 4;
the third step: importing the abstract syntax tree constructed in the second step into a preprocessing module, wherein the preprocessing module converts the object-oriented abstract syntax tree into a process-oriented abstract syntax tree, and comprises preprocessing rules from an object-oriented language to a process-oriented language;
the pre-processing rules are as follows:
rule 1: adding 'struct' before the class name of a class node in the abstract syntax tree as a prefix;
rule 2: and removing the initial value of the class attribute with the initial value, and adding an assignment statement of the class attribute after the initial node of the hierarchical syntax diagram structure to which all the construction methods of the class belong. If the class has no construction method, a parameterless construction method without any statement is created for the class, then a rule 2 is executed, and the structure of the hierarchical syntax diagram is as shown in FIG. 4;
rule 3: if one class has a Parent class, adding a new class attribute of _ Parent to the class, wherein the type of the attribute is the Parent class type of the class;
rule 4: in the content of the initial node of the hierarchical syntax diagram structure of each class method, the class name plus '_' of the class to which the method belongs is added before the method name as a prefix, and a new argument "@ is" is added at the first position of the argument, wherein the type of the argument is the type of the class to which the method belongs. If there is a return value, then at the last position of its argument, a new argument ". times.ret" is added, the type of which is the return value type. If the class has a plurality of reloading methods, adding a ' _ ' plus numerical index ' as a suffix of the method name after the method name of each reloading method.
Rule 5: for each statement containing the direct access class attribute in the hierarchical syntax diagram, adding 'this- >' to the class attribute of the statement;
rule 6: for statements containing method calls in methods of classes, x ═ obj.fun (e1, …, en) and obj.fun (e1, …, en), where obj is an instance of a class, the method call statements are replaced with fun (obj, e1, …, en, & x) and fun (obj, e1, …, en);
rule 7: for the termination state node of the hierarchical syntax graph, if it contains the return statement "return", this statement is replaced with "× Ret ═ e";
the fourth step: inputting the process-oriented abstract syntax tree obtained after the third step of preprocessing into a conversion MSVL module, wherein the conversion process comprises the following steps: data type conversion rules, expression conversion rules, statement conversion rules and graphic element conversion rules between the xUML4MC language and the MSVL (modeling, simulation and verification language);
the data type conversion rules are as follows:
TABLE 3 XUML4MC to MSVL data type conversion rules
Figure GDA0003131592000000111
The expression conversion rule is as follows:
converting the expression, assuming that x is a variable or constant, obj is an object, attr is an attribute of the class, e and b represent a standard symbol, and referring to the following rules:
if the expression is x, converting into an MSVL expression of x;
if the expression is attr, converting the expression into an MSVL expression of this- > attr;
if the expression is obj.attr, converting the expression into an MSVL expression which is obj.attr;
if the expression is true, converting the expression into an MSVL expression which is true;
if the expression is false, converting the MSVL into an MSVL expression which is false;
if the expression is e [ + | - |/] b, converting the expression into MSVL expression of e [ + | - |/] b;
if the expression is e [ < | > | < | > ] b, the conversion is made into an MSVL expression of e [ < | > |! B;
if the expression is e > -b, converting into MSVL expression of e > -b or e > b;
if the expression is e < ═ b, the MSVL expression is converted into the MSVL expression of e < ═ b or e < b;
if the expression is e [ and | or | xor ] b, converting the expression into an MSVL expression of e [ and | or | xor ] b;
if the expression is e, b, converting into MSVL expression e, b;
if the expression is (e), converting into an MSVL expression of (e);
the sentence transformation rules are as follows: assuming that type represents a data type, x is a variable, obj is an object, fun represents a method name, Class represents a Class name, and e represents an expression, the reference rule is as follows:
if the statement is x: type, converting into MSVL statement of type x;
if the statement is x, type: ═ e, converting into MSVL statement type x: ═ e;
if the statement is x: ═ e, the statement is converted into an MSVL statement of x: ═ e;
if the statement is x: (obj. fun) (e1, …, en), the conversion is to MSVL statement fun (obj, e1, …, en, & x);
if the statement is obj.fun (e1, …, en), the conversion is to MSVL statement fun (obj, e1, …, en);
the graphic element conversion rules are as follows: assuming that e is the content in the graphic element and b is the content contained in the graphic element, the reference rule is as follows:
IF the graphic element TYPE is TYPE _ IF, the conversion is carried out to MSVL statement IF (e) b;
if the graphic element TYPE is TYPE _ LOOP, the MSVL statement is while (e) (b);
if the graphic element type is Control flow, the two graphic elements connected with the element are converted into an MSVL statement e 1; e 2;
the graphic element TYPE is TYPE _ IF, IF the NO branch is contained, the conversion is MSVL, and the statement is IF (e) { b1} else { b2 };
the graphic element TYPE _ IF refers to a branch TYPE, TYPE _ LOOP refers to a LOOP TYPE, and Control flow refers to a Control flow TYPE;
as shown in fig. 5, the system for converting an xmll 4MC model into an MSVL according to the embodiment of the present invention includes: the system comprises a system modeling module 1, an abstract syntax tree generating module 2, a preprocessing module 3 and a MSVL converting module 4.
The system modeling module 1, the construction of the class diagram, includes specifying the entry method of the system, which is indicated by double underlining. If static properties and static methods are present in the system, it is marked with a single underline. The relationships between classes include inheritance, association and aggregation. The association relationship between the classes comprises association role names and association multiplicity. The inheritance relationship between classes can only be a single inheritance. The construction of the activity graph includes that each class of method has its corresponding activity graph.
The abstract syntax tree generating module 2 comprises merging the system class diagram and the activity diagram information, wherein the class diagram information is contained in the object-oriented abstract syntax tree structure, and the activity diagram information is contained in the hierarchical syntax tree structure in the abstract syntax tree.
And the preprocessing module 3 is used for processing the information contained in the object-oriented abstract syntax tree one by one until the information of all the nodes is processed.
And the MSVL conversion module 4 is used for processing the preprocessed process-oriented abstract syntax tree nodes one by one in the MSVL conversion process until all the nodes are processed.
The effects of the present invention will be described in detail with reference to examples.
The implementation of the present invention is illustrated by the following examples, which are merely descriptions of the implementation of the present invention, and only the core part of the implementation is given, and the rest of similar processes are not given.
This example is System modeling and model conversion for the "Car Sale System (CSS)". The CSS system implements a car sales process where when a car purchase amount is entered into a car store, the car store exports the car brand that the amount can be purchased.
The system modeling is first performed using the xmll 4MC language, which includes a system class diagram model and an active diagram model. The activity diagram model only gives the description of the core method, and the activity diagram models of the other methods are similar and are not repeated. Class diagram of CSS referring to FIG. 6, activity diagram model of sell vehicle method sellCar referring to FIG. 7.
The class diagram and the activity diagram are then subjected to a transformation of the abstract syntax tree, the result of which is referred to fig. 8, where only the abstract syntax tree transformation results for the class Car and the Car sales method sellCar are given.
This is followed by a preprocessing of the abstract syntax tree, the result of which is referred to in fig. 9, where the content in the dashed box indicated by the arrow is the result of the conversion according to the preprocessing rules.
And finally, MSVL conversion is carried out, the preprocessed abstract syntax tree is converted into MSVL codes, and the codes are as follows:
Figure GDA0003131592000000131
the above examples show the basic process of modeling and model conversion in the model detection system, and the visual modeling mode based on the UML basis is easy to master, intuitive in modeling and more convenient and accurate compared with the mode of modeling by using the scripting language. And provides support for verification of the system model based on the xUML4 MC. The invention realizes the unification of software design modeling and model detection system modeling, and promotes the popularization of the model detection technology in the industry.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (7)

1. A method for converting an xUML4MC model into an MSVL (modeling, simulation and verification language) language program is characterized in that the method for converting the xUML4MC model into the MSVL comprises the following steps: establishing a class diagram model and an activity diagram model description system; converting the class diagram and the activity diagram into an object-oriented abstract syntax tree; preprocessing the object-oriented abstract syntax tree and converting the object-oriented abstract syntax tree into a process-oriented abstract syntax tree; converting the abstract syntax tree facing the process into an MSVL (modeling, simulation and verification language) language program;
the method for converting the xUML4MC model into the MSVL comprises the following steps:
the first step is as follows: establishing a class diagram model and an active diagram model for a system to be verified, wherein the class diagram model and the active diagram model comprise classes contained in the system and a relation between the classes; the activity graph model comprises a data interaction process between objects in the system;
the second step is that: analyzing the class diagram model and the activity diagram model of the system to be verified, and constructing an object-oriented abstract syntax tree of the system to be verified according to the syntax rule of the xUML4MC, wherein the object-oriented abstract syntax tree comprises all information of the class diagram and the activity diagram;
the third step: converting the object-oriented abstract syntax tree into a process-oriented abstract syntax tree, including object-oriented language to process-oriented language preprocessing rules;
the preprocessing rule is as follows:
rule 1: adding 'struct' before the class name of a class node in the abstract syntax tree as a prefix;
rule 2: removing the initial value of the class attribute with the initial value, and adding an assignment statement of the class attribute after the initial node of the hierarchical grammar graph structure to which all the construction methods of the class belong; if the class has no construction method, a non-reference construction method which does not contain any statement is created for the class, and then the rule 2 is executed;
rule 3: if one class has a Parent class, adding a new class attribute of _ Parent to the class, wherein the type of the attribute is the Parent class type of the class;
rule 4: for the content of an initial node of a hierarchical grammar graph structure of each class method, adding a class name plus '_' of a class to which the method belongs as a prefix before the method name, and adding a new argument '@' at the first position of the argument, wherein the type of the argument is the type of the class to which the method belongs; if the return value exists, adding a new shape parameter ". multidot.ret" at the last position of the shape parameter, wherein the type of the new shape parameter is the type of the return value of the method; if the class has a plurality of reloading methods, adding a ' _ ' plus numerical index ' as a suffix of the method name after the method name of each reloading method;
rule 5: for each statement containing the direct access class attribute in the hierarchical syntax diagram, adding 'this- >' to the class attribute of the statement;
rule 6: for statements containing method calls in methods of classes, x ═ obj.fun (e1, …, en) and obj.fun (e1, …, en), where obj is an instance of a class, the method call statements are replaced with fun (obj, e1, …, en, & x) and fun (obj, e1, …, en);
rule 7: for the termination state node of the hierarchical syntax graph, if it contains the return statement "return", this statement is replaced with "× Ret ═ e";
the fourth step: data type conversion rules, expression conversion rules, statement conversion rules and graphic element conversion rules between the xUML4MC language and the MSVL language programs;
the expression conversion rule is as follows: x is a variable or constant, obj is an object, attr is an attribute of the class, e and b represent standard symbols, and the reference rule is as follows:
(1) the expression is x, and the MSVL expression is converted into x;
(2) the expression is attr, and the expression is converted into MSVL which is this- > attr;
(3) the expression is obj.attr, and the MSVL expression is transformed into obj.attr;
(4) the expression is true, and the MSVL expression is converted into true;
(5) the expression is false, and the MSVL expression is false;
(6) the expression is e [ + | - |/] b, and the expression is converted into MSVL expression e [ + | - |/] b;
(7) the expression is e [ < | > | < | > ] b, and the conversion is MSVL expression e [ < | > |! B;
(8) the expression is e > -b, and the MSVL expression is e > -b or e > b;
(9) the expression is e < ═ b, and the MSVL expression is e < ═ b or e < b;
(10) the expression is e [ and | or | xor ] b, and the expression is converted into MSVL expression e [ and | or | xor ] b;
(11) the expression is e, b, and the MSVL expression is e, b;
(12) the expression is (e), and the MSVL expression is (e).
2. The method for converting an xUML4MC model into an MSVL language program as claimed in claim 1, wherein the data type conversion rule is:
(1) the data type is Boolean, and the data type is converted into MSVL (modeling, simulation and verification language) of pool;
(2) the data type is Integer, and the MSVL is converted into int;
(3) the data type is Real, and the MSVL is float;
(4) the data type is String, and the MSVL is converted into String;
(5) the data type is Set and Sequence, and the data type is converted into MSVL (modeling, simulation and verification language) as list;
(6) the data type is Array, and the MSVL is converted into Array.
3. The method for converting an xUML4MC model into an MSVL language program as claimed in claim 1, wherein the sentence conversion rule is: type represents data type, x is a variable, obj is an object, fun represents a method name, Class represents a Class name, e represents an expression, and the reference rule is as follows:
(1) type is x, the MSVL sentence is type x;
(2) the sentence is x, type: ═ e, and the conversion is MSVL, the sentence is type x: ═ e;
(3) the sentence is x: ═ e, and the conversion is MSVL, and the sentence is x: ═ e;
(4) fun (e1, …, en), converted to MSVL sentence fun (obj, e1, …, en, & x);
(5) fun (e1, …, en) with a transition to MSVL statement fun (obj, e1, …, en).
4. The method for converting an xUML4MC model into an MSVL language program as claimed in claim 1, wherein the graphic element conversion rule is: e is the content in the graphic element, b is the content contained in the graphic element, and the reference rule is as follows:
(1) the graphic element TYPE is TYPE _ IF, and the converted MSVL statement is IF (e) (b);
(2) the graphic element TYPE is TYPE _ LOOP, and the MSVL statement is while (e) (b);
(3) the type of the graphic element is Control flow, and the two graphic elements connected with the element are converted into MSVL (modeling, simulation and verification language) statements e 1; e 2;
(4) the graphic element TYPE is TYPE _ IF, IF the NO branch is contained, the conversion is MSVL, and the statement is IF (e) { b1} else { b2 };
(5) the graphic element TYPE _ IF refers to a branch TYPE, TYPE _ LOOP refers to a LOOP TYPE, and Control flow refers to a Control flow TYPE.
5. The system for converting xml 4MC model into MSVL language program of the method for converting xml 4MC model into MSVL language program as claimed in claim 1, wherein said system for converting xml 4MC model into MSVL language program comprises:
the system modeling module is used for establishing a class diagram model and an activity diagram model for the system to be verified;
the abstract syntax tree generating module is used for containing the activity diagram information into a hierarchical syntax diagram structure in the object-oriented abstract syntax tree;
the preprocessing module is used for processing the information contained in the object-oriented abstract syntax tree one by one until the information of all the nodes is processed;
and the MSVL conversion module is used for processing the preprocessed process-oriented abstract syntax tree nodes one by one in the MSVL conversion process until all the nodes are processed.
6. The system for converting an xml 4MC model to an MSVL language program as recited in claim 5, wherein the abstract syntax tree generating module includes merging system class diagram and activity diagram information, wherein the class diagram information is incorporated into an object-oriented abstract syntax tree structure.
7. A computer readable storage medium for implementing the method for converting the xml 4MC model into the MSVL language program as claimed in any one of claims 1 to 4.
CN201711397443.9A 2017-12-21 2017-12-21 Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium Active CN108037913B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711397443.9A CN108037913B (en) 2017-12-21 2017-12-21 Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711397443.9A CN108037913B (en) 2017-12-21 2017-12-21 Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN108037913A CN108037913A (en) 2018-05-15
CN108037913B true CN108037913B (en) 2021-08-17

Family

ID=62100543

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711397443.9A Active CN108037913B (en) 2017-12-21 2017-12-21 Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN108037913B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109885307B (en) * 2019-01-07 2022-03-01 西安邮电大学 Method for converting pthread library multithread C program into MSVL program and computer program
CN111949505A (en) * 2019-05-14 2020-11-17 阿里巴巴集团控股有限公司 Test method, device and equipment
CN111124485B (en) * 2019-12-20 2023-03-10 成都互诚在线科技有限公司 Formalized protocol language simplifying method based on intermediate language
CN112306470B (en) * 2020-10-19 2022-04-08 南京航空航天大学 Method for simplifying, converting and automatically verifying complex synchronous language program
CN112486990B (en) * 2020-11-27 2023-05-02 浪潮通用软件有限公司 Method and equipment for describing synchronous database table structure according to model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101571802A (en) * 2009-06-19 2009-11-04 北京航空航天大学 Visualization automatic generation method of embedded software test data and system thereof
CN103150200A (en) * 2013-04-08 2013-06-12 西安电子科技大学 Computer language transformation system and transformation method from C language to MSVL (Modeling, Simulation and Verification Language)
CN103455362A (en) * 2013-09-27 2013-12-18 西安电子科技大学 Automatic hardware language transformation system
CN106371887A (en) * 2016-11-08 2017-02-01 西安电子科技大学 System and method for MSVL compiling

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9672010B2 (en) * 2015-07-29 2017-06-06 The Boeing Company Unified modeling language (UML) analysis system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101571802A (en) * 2009-06-19 2009-11-04 北京航空航天大学 Visualization automatic generation method of embedded software test data and system thereof
CN103150200A (en) * 2013-04-08 2013-06-12 西安电子科技大学 Computer language transformation system and transformation method from C language to MSVL (Modeling, Simulation and Verification Language)
CN103455362A (en) * 2013-09-27 2013-12-18 西安电子科技大学 Automatic hardware language transformation system
CN106371887A (en) * 2016-11-08 2017-02-01 西安电子科技大学 System and method for MSVL compiling

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Extending UML for Model Checking;Xinfeng Shu等;《SOFL+MSVL 2017: Structured Object-Oriented Formal Language and Method》;20171116;95-103 *
Model Checking Rate-Monotonic Scheduler with TMSVL;Jin Cui等;《2014 19th International Conference on Engineering of Complex Computer Systems》;20141016;202-205 *
Xinfeng Shu等.Extending UML for Model Checking.《SOFL+MSVL 2017: Structured Object-Oriented Formal Language and Method》.2017,95-103. *
基于UML和时序逻辑语言的银行ATM系统描述与求精;李辉;《中国优秀硕士学位论文全文数据库 信息科技辑》;20081115;I138-441 *

Also Published As

Publication number Publication date
CN108037913A (en) 2018-05-15

Similar Documents

Publication Publication Date Title
CN108037913B (en) Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium
Kahani et al. Survey and classification of model transformation tools
Li et al. A formal semantics of UML sequence diagram
Beazley Automated scientific software scripting with SWIG
Jézéquel et al. Mashup of metalanguages and its implementation in the kermeta language workbench
Voelter et al. mbeddr: Instantiating a language workbench in the embedded software domain
US9063672B2 (en) Systems and methods for verifying model equivalence
Gargantini et al. A semantic framework for metamodel-based languages
Julius et al. Transformation of GRAFCET to PLC code including hierarchical structures
CN115639980A (en) Draggable front-end logic arrangement method and device for low-code platform
CN111880784A (en) SIMSCRIPT language-oriented discrete event simulation graphical modeling method
Zhao et al. Towards formal verification of UML diagrams based on graph transformation
CN114756213A (en) Automatic code generation method and device for intelligent control system
Savic et al. Use case specification at different levels of abstraction
CN116755669A (en) Low code development method and tool based on DSL language operation model
Lausdahl et al. Connecting UML and VDM++ with open tool support
Dalibor et al. Mind the gap: lessons learned from translating grammars between MontiCore and Xtext
CN110674355B (en) DSL application system for describing data labeling task and method thereof
Samara A practical approach for detecting logical error in object oriented environment
Barashev Translating semantic networks to UML class diagrams
Zhu et al. A supporting tool for syntactic analysis of sofl formal specifications and automatic generation of functional scenarios
Malavolta Software Architecture Modeling by Reuse, Composition and Customization
Jung Generator-composition for aspect-oriented domain-specific languages
Rahimi et al. Architecture conformance checking of multi-language applications
Nagoya et al. Developing a web dictionary system using the SOFL three-step specification approach

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant