CN104281480B - A kind of function calling method based on temporal logic language MSVL - Google Patents

A kind of function calling method based on temporal logic language MSVL Download PDF

Info

Publication number
CN104281480B
CN104281480B CN201410531029.2A CN201410531029A CN104281480B CN 104281480 B CN104281480 B CN 104281480B CN 201410531029 A CN201410531029 A CN 201410531029A CN 104281480 B CN104281480 B CN 104281480B
Authority
CN
China
Prior art keywords
function
msvl
type
programs
called
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
CN201410531029.2A
Other languages
Chinese (zh)
Other versions
CN104281480A (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.)
Xidian University
Original Assignee
Xidian University
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 Xidian University filed Critical Xidian University
Priority to CN201410531029.2A priority Critical patent/CN104281480B/en
Publication of CN104281480A publication Critical patent/CN104281480A/en
Application granted granted Critical
Publication of CN104281480B publication Critical patent/CN104281480B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Executing Machine-Instructions (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a kind of function calling method based on temporal logic language MSVL, the type for first determining whether called function is MSVL functions, has the external function or the external function without return value of return value, and being defined or change its to called function according to different type function defines;Then the position that discriminant function is called, according to different function call positions and the type function that is called accordingly, is called in a different manner.The present invention can be explained to called function in a different manner in same program;And the function write by C language and Java language can be called in MSVL programs, is conducive to the integrated of various different programming language programs, effectively reduce the difficulty of program development, improve rate of code reuse.

Description

A kind of function calling method based on temporal logic language MSVL
Technical field
The invention belongs to computer system Formal Modeling and verification technique field, logic programming is primarily related to The realization of language, particularly a kind of function calling method based on temporal logic language MSVL can be used to be adjusted in MSVL programs With other various different language programs, be conducive to the multiplexing of code and integrated, simplified programming.
Background technology
1977, sequential logic was incorporated into computer science by A.Pnueli, was mainly used in real-time, concurrent system It is modeled and verifies.By the research of nearly 40 years, sequential logic field had been obtained for very big development, formd three big points Branch:Linear time temporal logic (Linear Temporal Logic), branching temporal logic logic (Branching Temporal Logic) With Interval temporal logic (Interval Temporal Logic).
Projection temporal logic (Projection Temporal Logic) is a kind of Interval temporal logic, interval implication It is finite or infinite status switch, it is siding-to-siding block length that the state number in sequence subtracts 1, it is interval when for infinite status switch Length is defined as infinity, i.e. ω.PTL as characteristic, can be used to describe to perform in different grain size area with projection operation's symbol (prj) Between on concurrent process executed in parallel.
PROLOG (MSVL) is an executable subset of projection temporal logic, be can be used for concurrent, real When system be modeled (Modeling), emulation (Simulation) and verify (Verification).MSVL is contained mostly Common expressions and programming structure in the injunctive programming language (such as C language) of number, such as assignment statement (:=), order tie Structure (;), branched structure (if-then-else) and loop structure (while), therefore it can realize that general orders formula program sets Most of functions that meter language can be realized.Also include some concurrent class programming structures in MSVL, such as conjunction (and), parallel (| |) and projection (prj), wherein conjunction structure P1 and P2 represent process P1 and P2 executed in parallel same length interval on, And it is stateful to share the institute on interval;Parallel organization P1 | | P2 represents that process P1 and P2 can voluntarily specify that the interval of respective execution is long Institute on degree, and shared shorter interval is stateful;Projection structure (P1 ..., Pm) prj Q represent process Pi (i=1 ..., m) Order is performed, and the projection compared with coarseness that the endpoint status order for performing interval by each Pi is arranged to make up is interval, or should Certain interval prefix is projected, or interval is performed as process Q using interval certain interval as prefix of the projection.Projection knot Structure embodies the concurrency and autonomy between multiple processes.Further, since in sequential logic programming, the value of variable is not Can it is automatic from current state be delivered to NextState, therefore MSVL in frame structure (frame) be used for variate-value in adjacent shape Transmission between state.Except this, in MSVL also include asynchronous communication structure (await), can be used to be modeled distributed system and Checking.Data type in MSVL includes integer type, floating point type, character types, character string type, pointer type and structure Type.Type system based on MSVL, can be with defined function and predicate.Function is a kind of particularly useful structure in programming Module, function can effectively be encapsulated to data and operation, externally only provide a simple function interface, when program needs When performing a same function, the function finished writing can be directly invoked, and without writing code again, so as to improve code answer With rate, simplify programming, program is more succinctly refined, but do not provide function definition and the realization side called in MSVL also Method, this defect is made troubles to MSVL programmings, and it is tediously long to also result in MSVL programs, not readily understood.
The content of the invention
In view of the shortcomings of the prior art, the present invention is intended to provide a kind of function call side based on temporal logic language MSVL Method, with it, can be explained to called function in a different manner in same program;And in MSVL programs In can call the function write by C language and Java language, be conducive to the integrated of various different programming language programs, effectively drop The difficulty of low program development, improves rate of code reuse.
To achieve these goals, the present invention is adopted the following technical scheme that:
A kind of function calling method based on temporal logic language MSVL is comprised the following steps:
Step 1, judges whether called function is MSVL functions, if it is, defining the function;If it is not, judging quilt Whether call function is the external function for having return value, if it is, step 2 is performed, if called function is without return value External function, then perform step 3;
When the called function is MSVL functions, according to the difference of form, point four kinds of situations are determined the function Justice:
1) having parameter has return value, then definition format is as follows:
Def ine f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym, Return_type RV []) { MSVL programs };
2) there is Parameters none Return, then definition format is as follows:
Def ine f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym) { MSVL programs };
3) printenv has return value, then definition format is as follows:
Def ine f (return_type RV []) { MSVL programs };
4) without return value, then definition format is as follows for printenv:
Def ine f () { MSVL programs };
After defining the function, define one and call the MSVL programs of the function and perform step 3;
Step 2, modification described in have return value external function definition, specifically modify in two kinds of situation:
If the external function for having return value has parameter, i.e. original to be defined as:
Return_type f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym) { C/Java programs };
Then need to make following 2 points of modifications:
(1) head of function definition is changed to:
Void f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym, return_ type RV[]);
(2) all " return value " sentences that function is defined in body are replaced by " RV [0]=value ";
If the external function printenv for having a return value, i.e. original is defined as:
Return_type f () { C/Java programs };
Then need to make following 2 points of modifications:
(1) head of function definition is changed to:void f(return_type RV[])
(2) all " return value " sentences that function is defined in body are replaced by " RV [0]=value ";
After modification has the external function definition of return value, define one and call the MSVL programs of the function and perform step 3;
Step 3, it is stipulated that all function calls occurred in MSVL expression formulas belong to black box and call, wherein using keyword Ext modifications are called for the black box of external function, and no ext modifications are called for the black box of MSVL functions;Occur in sentence Function call do not have keyword ext modify for the whitepack of MSVL functions is called, have ext modify be MSVL or external function Black box call, existing discriminant function calls the position of appearance:
If function call is appeared in MSVL expression formulas and without keyword ext modifications, that is, belong to the black box of MSVL functions Call, then perform step 4;If the function call in MSVL expression formulas has keyword ext to modify, that is, belong to the black box of external function Call, then perform step 5;If function call occurs with independent sentence and without keyword ext modifications, that is, belongs to MSVL functions Whitepack is called, then perform step 6;If function call occurs with independent sentence and has keyword ext to modify, that is, belong to MSVL functions Or the black box of external function is called, then step 7 is performed;
Step 4, all argument variables are under caller current state in obtaining called MSVL function argument lists Value, and to defining the MSVL program initializations of the function, while preserve the performing environment of former caller, now, if definition The MSVL programs of function are simple structure, perform step 8, if the MSVL programs of defined function are labyrinth, the program is entered Row recursive structure is converted, i.e., carry out equivalence transformation to program, is converted into a simple structured program, then performs step 8;
Step 5, all argument variables are under caller current state in obtaining called external function argument list Value, then by these parameter values pass to C or Java functions perform, function return value is as external function in MSVL expression formulas In value;
Step 6, obtains value of all argument variables under program current state in called MSVL function argument lists, Now, if the MSVL programs of defined function are simple structure, step 9 is performed, if the MSVL programs of defined function are labyrinth, Recursive structure conversion then is carried out to the program, simple structure is converted to, step 9 is then performed;
Step 7, if called function is MSVL functions, performs step 4;If external function, step 5 is performed;
Step 8, simple structure is divided into current state collection of programs and NextState collection of programs in current state;This step Specifically comprise the following steps:
Step 8.1, is once explained simple structure in current state, that is, perform the language in current state collection of programs Sentence, implementation effect is reflected in the renewal of program variable and the change of program structure;Then step 8.2 is performed;
Step 8.2, judges whether NextState collection of programs is empty:If NextState collection of programs is not sky, will Then NextState collection of programs changes the time sequence status of function program, from current time sequence status as new pending program Next time sequence status are jumped to, now, if new pending program is simple structure, is returned and is performed step 8.1, if new treats Configuration processor is labyrinth, then carry out recursive structure conversion to the program, is converted to a simple structure, is then back to perform Step 8.1;If NextState collection of programs is sky, recover the performing environment of caller, the function that is then called will be controlled Power processed gives back caller, and the calculating process of function call terminates, and the return value of the function that is now called has passed through variable R V [0] transmission gives caller, if the execution siding-to-siding block length of function is more than 0, the final state that function is performed is used as calling The NextState of program current state, and caller is jumped into next time sequence status from current state, then caller Continue executing with, if the execution of function is interval to be equal to 0, i.e. function of state, then caller is continued executing with from current state;
Step 9, simple structure is divided into current state collection of programs and NextState collection of programs in current state;This step Specifically comprise the following steps:
Step 9.1, is once explained simple structure in current state, that is, perform the language in current state collection of programs Sentence, implementation effect is reflected in the renewal of program variable and the change of program structure;Then step 9.2 is performed;
Step 9.2, judges whether NextState collection of programs is empty:If NextState collection of programs is not sky, will Then NextState collection of programs changes the time sequence status of function program, from current time sequence status as new pending program Next time sequence status are jumped to, now, if new pending program is simple structure, is returned and is performed step 9.1, if new treats Configuration processor is labyrinth, then carry out recursive structure conversion to the program, is converted to a simple structure, is then back to perform Step 9.1;If NextState collection of programs is sky, recover the execution step of caller, and function call is produced Status switch counts on the interval that performs of call function, and control is given back caller by the function that is then called, now letter The calculating process that number is called terminates, and the done state that caller is then performed from called function is continued executing with.
It should be noted that the syntactic definition that function black box is called is as follows:
The black box of MSVL functions calls grammer:Ext MSVL function names (argument list, RV);
The black box of external function calls grammer:Ext external function names (argument list, RV).
It should be noted that in step 3, the syntactic definition of described MSVL expression formulas is:
To the constant of single belt type:A, b, c ... ∈ D are basic representations, and wherein basic representation can contain subscript;
To the static variable and dynamic variable of single belt type:U, v, x, y, z ... ∈ V are basic representations, wherein base This expression formula can contain subscript;
If x is variable, Ox and Θ x are expression formulas;
If op is n-ary operation symbol (n > 0) in MSVL, e1 ..., en is n type mutually compatible with the parameter type of op Expression formula, then op (e1 ..., en) is expression formula;
If h is n unit MSVL function of states (n > 0), e1 ..., en is the expression mutually compatible with h parameter types of n type Formula, then h (e1 ..., en, RV) is expression formula;
If f is n unit MSVL sequential functions (n > 0), e1 ..., en is the expression mutually compatible with f parameter types of n type Formula, then f (e1 ..., en, RV) is expression formula;
If g is n units' external function (n > 0), e1 ..., en is the n type expression formula mutually compatible with g parameter types, then Ext g (e1 ..., en, RV) are expression formulas.
It should be further stated that, in step 3, the semantic interpretation of described MSVL expression formulas e exists for MSVL expression formulas e Value at the interval current state of given state, it is by explaining I=(σ, i, k, j) come what is defined:
The values that is construed to the constant of the I to belt type constant;
I is construed to value of the variable at the indictment state of the state interval to static variable;
I is construed to value of the variable at the current state of the state interval to dynamic variable;
I is construed to Ox:If k < j, result is with Sk+1It is new interpretation (σ, i, the k+1, j) to x's of current state Explain;Otherwise, explanation results are nil;
I is construed to Θ x:If i < k, result is with Sk-1It is new interpretation (σ, i, the k-1, j) to x's of current state Explain;Otherwise, explanation results are nil;
I is construed to op (e1 ..., en):Operation op is applied to expression formula e1 ..., en is under the explanation of I The result of gained;
I is construed to h (e1 ..., en, RV's):With expression formula e1 ..., explanations of the en under I is to function of state h Argument initialization of variable after, program perform at the end of RV [0] value;
I is construed to f (e1 ..., en, RV's):With expression formula e1 ..., explanations of the en under I is to sequential function f Argument initialization of variable after, program perform at the end of RV [0] value;
I is construed to ext g (e1 ..., en, RV's):With expression formula e1 ..., explanations of the en under I is to outside After the argument initialization of variable of function g, the value of RV [0] at the end of program execution.
Need further to illustrate, in step 3, the semantical definition that described black box is called for explain I=(σ, i, k, J) the satisfiability relation and between the external call sentence of MSVL functions:
Explain and meet ext g (e1 ..., en, z1 ..., zm, RV) by I=(σ, i, k, j) and if only if j=k+1, and In the presence of one with SkHeaded by state SjFor the interval of last current state is suffix, with σ(0..k)It is prefix, with SkIt is the explanation of current state Meet the projection formula Q produced by external call, wherein:
E1 ..., en are the input arguments of function g, can be expression formula;
Z1 ..., zm are the output arguments of function g, it is necessary to be variable, the parameter y1 in and function definition ..., ym pairs Should;
The beneficial effects of the present invention are:The present invention is realized can be in same program in a different manner to called Function is explained, and the function write by C language and Java language can be called in MSVL programs, be conducive to it is various not With the integrated of programming language program, the difficulty of program development is effectively reduced, improve rate of code reuse.
Brief description of the drawings
Fig. 1 is the general flow chart that the present invention is implemented.
Specific embodiment
Below with reference to accompanying drawing, the invention will be further described, it is necessary to explanation, the present embodiment is with this technology side Premised on case, detailed implementation method and operating process is provided, but protection scope of the present invention is not limited to the present embodiment.
As shown in figure 1, a kind of function calling method based on temporal logic language MSVL is comprised the following steps:
Step 1, judges whether called function is MSVL functions, if it is, defining the function;If it is not, judging quilt Whether call function is the external function for having return value, if it is, step 2 is performed, if called function is without return value External function, then perform step 3;
When the called function is MSVL functions, according to the difference of form, point four kinds of situations are determined the function Justice:
1) having parameter has return value, then definition format is as follows:
Def ine f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym, Return_type RV []) { MSVL programs };
2) there is Parameters none Return, then definition format is as follows:
Def ine f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym) { MSVL Program };
3) printenv has return value, then definition format is as follows:
Def ine f (return_type RV []) { MSVL programs };
4) without return value, then definition format is as follows for printenv:
Def ine f () { MSVL programs };
After defining the function, define one and call the MSVL programs of the function and perform step 3;
Step 2, modification described in have return value external function definition, specifically modify in two kinds of situation:
If the external function for having return value has parameter, i.e. original to be defined as:
Return_type f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym) { C/Java programs };
Then need to make following 2 points of modifications:
(1) head of function definition is changed to:
Void f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym, return_ type RV[]);
(2) all " return value " sentences that function is defined in body are replaced by " RV [0]=value ";
If the external function printenv for having a return value, i.e. original is defined as:
Return_type f () { C/Java programs };
Then need to make following 2 points of modifications:
(1) head of function definition is changed to:void f(return_type RV[])
(2) all " return value " sentences that function is defined in body are replaced by " RV [0]=value ";
After modification has the external function definition of return value, define one and call the MSVL programs of the function and perform step 3;
Step 3, explanation of the present invention to function uses two ways:Black box is called and called with whitepack.Black box is called, as Caller be only concerned function execution result be indifferent to function execution pilot process, i.e., function perform intermediateness for Caller is invisible;And whitepack is called, as caller is not only concerned about the result that function is performed, and is also concerned about function execution The intermediateness that pilot process, i.e. function are performed is visible to caller.
The all function calls occurred in MSVL expression formulas of regulation belong to black box and call, wherein being modified with keyword ext Call for the black box of external function, no ext modifications are called for the black box of MSVL functions;The letter occurred in independent sentence Number call no keyword ext modification for the whitepack of MSVL functions is called, have that ext modifies is black for MSVL or external function Box is called;
Existing discriminant function calls the position of appearance:
If function call is appeared in MSVL expression formulas and without keyword ext modifications, that is, belong to the black box of MSVL functions Call, then perform step 4;If the function call in MSVL expression formulas has keyword ext to modify, that is, belong to the black box of external function Call, then perform step 5;If function call occurs with independent sentence and without keyword ext modifications, that is, belongs to MSVL functions Whitepack is called, then perform step 6;If function call occurs with independent sentence and has keyword ext to modify, that is, belong to MSVL functions Or the black box of external function is called, then step 7 is performed;
The syntactic definition that function black box is called is as follows:
The black box of MSVL functions calls grammer:Ext MSVL function names (argument list, RV);
The black box of external function calls grammer:Ext external function names (argument list, RV).
The syntactic definition of described MSVL expression formulas is as follows:
To the constant of single belt type:A, b, c ... ∈ D are basic representations, and wherein basic representation can contain subscript;
To the static variable and dynamic variable of single belt type:U, v, x, y, z ... ∈ V are basic representations, wherein base This expression formula can contain subscript;
If x is variable, Ox and Θ x are expression formulas;
If op is n-ary operation symbol (n > 0) in MSVL, e1 ..., en is n type mutually compatible with the parameter type of op Expression formula, then op (e1 ..., en) is expression formula;
If h is n unit MSVL function of states (n > 0), e1 ..., en is the expression mutually compatible with h parameter types of n type Formula, then h (e1 ..., en, RV) is expression formula;
If f is n unit MSVL sequential functions (n > 0), e1 ..., en is the expression mutually compatible with f parameter types of n type Formula, then f (e1 ..., en, RV) is expression formula;
If g is n units' external function (n > 0), e1 ..., en is the n type expression formula mutually compatible with g parameter types, then Ext g (e1 ..., en, RV) are expression formulas.
The operator that MSVL is included is as shown in table 1:
Table 1
The semantic interpretation of described MSVL expression formulas e is MSVL expression formulas e at the interval current state of given state Value, it is by explaining I=(σ, i, k, j) come what is defined:
The values that is construed to the constant of the I to belt type constant;
I is construed to value of the variable at the indictment state of the state interval to static variable;
I is construed to value of the variable at the current state of the state interval to dynamic variable;
I is construed to Ox:If k < j, result is with Sk+1It is new interpretation (σ, i, the k+1, j) to x's of current state Explain;Otherwise, explanation results are nil;
I is construed to Θ x:If i < k, result is with Sk-1It is new interpretation (σ, i, the k-1, j) to x's of current state Explain;Otherwise, explanation results are nil;
I is construed to op (e1 ..., en):Operation op is applied to expression formula e1 ..., en is under the explanation of I The result of gained;
I is construed to h (e1 ..., en, RV's):With expression formula e1 ..., explanations of the en under I is to function of state h Argument initialization of variable after, program perform at the end of RV [0] value;
I is construed to f (e1 ..., en, RV's):With expression formula e1 ..., explanations of the en under I is to sequential function f Argument initialization of variable after, program perform at the end of RV [0] value;
I is construed to ext g (e1 ..., en, RV's):With expression formula e1 ..., explanations of the en under I is to outside After the argument initialization of variable of function g, the value of RV [0] at the end of program execution.
On this basis, the semantical definition that black box is called is explanation I=(σ, i, k, j) and the external call language of MSVL functions Satisfiability relation between sentence:
Explain and meet ext g (e1 ..., en, z1 ..., zm, RV) by I=(σ, i, k, j) and if only if j=k+1, and In the presence of one with SkHeaded by state SjFor the interval of last current state is suffix, with σ(0..k)It is prefix, with SkIt is the explanation of current state Meet the projection formula Q produced by external call, wherein:
E1 ..., en are the input arguments of function g, can be expression formula;
Z1 ..., zm are the output arguments of function g, it is necessary to be variable, the parameter y1 in and function definition ..., ym pairs Should;
Step 4, all argument variables are under caller current state in obtaining called MSVL function argument lists Value, and to defining the MSVL program initializations of the function, while preserve the performing environment of former caller, now, if definition The MSVL programs of function are simple structure, perform step 8, if the MSVL programs of defined function are labyrinth, the program is entered Row recursive structure is converted, i.e., carry out equivalence transformation to program, is converted into a simple structured program, then performs step 8;
Step 5, all argument variables are under caller current state in obtaining called external function argument list Value, then by these parameter values pass to C or Java functions perform, function return value is as external function in MSVL expression formulas In value;
Step 6, all argument variables are under caller current state in obtaining called MSVL function argument lists Value, now, if the MSVL programs of defined function be simple structure, perform step 9;If the MSVL programs of defined function are complexity Structure, then carry out recursive structure conversion to the program, is converted to simple structure, then performs step 9;
Step 7, if called function is MSVL functions, performs step 4;If external function, step 5 is performed;
Step 8, simple structure is divided into current state collection of programs and NextState collection of programs in current state;This step Specifically comprise the following steps:
Step 8.1, is once explained simple structure in current state, that is, perform the language in current state collection of programs Sentence, implementation effect is reflected in the renewal of program variable and the change of program structure;Then step 8.2 is performed;
Step 8.2, judges whether NextState collection of programs is empty:If NextState collection of programs is not sky, will Then NextState collection of programs changes the time sequence status of function program, from current time sequence status as new pending program Next time sequence status are jumped to, now, if new pending program is simple structure, is returned and is performed step 8.1, if new treats Configuration processor is labyrinth, then carry out recursive structure conversion to the program, is converted to a simple structure, is then back to perform Step 8.1;If NextState collection of programs is sky, recover the performing environment of caller, the function that is then called will be controlled Power processed gives back caller, and the calculating process of function call terminates, and the return value of the function that is now called has passed through variable R V [0] transmission gives caller, if the execution siding-to-siding block length of function is more than 0, the final state that function is performed is used as calling The NextState of program current state, and caller is jumped into next time sequence status from current state, then caller Continue executing with, if the execution of function is interval to be equal to 0, i.e. function of state, then caller is continued executing with from current state;
Step 9, simple structure is divided into current state collection of programs and NextState collection of programs in current state;This step Specifically comprise the following steps:
Step 9.1, is once explained simple structure in current state, that is, perform the language in current state collection of programs Sentence, implementation effect is reflected in the renewal of program variable and the change of program structure;Then step 9.2 is performed;
Step 9.2, judges whether NextState collection of programs is empty:If NextState collection of programs is not sky, will Then NextState collection of programs changes the time sequence status of function program, from current time sequence status as new pending program Next time sequence status are jumped to, now, if new pending program is simple structure, is returned and is performed step 9.1, if new treats Configuration processor is labyrinth, then carry out recursive structure conversion to the program, is converted to a simple structure, is then back to perform Step 9.1;If NextState collection of programs is sky, recover the execution step of caller, and function call is produced Status switch counts on the interval that performs of call function, and control is given back caller by the function that is then called, now letter The calculating process that number is called terminates, and the done state that caller is then performed from called function is continued executing with.
For a person skilled in the art, technical scheme that can be according to more than and design, provide various corresponding Change and deform, and all these changes and deformation should be construed as being included within the protection domain of the claims in the present invention.

Claims (5)

1. a kind of function calling method based on temporal logic language MSVL, it is characterised in that methods described is comprised the following steps:
Step 1, judges whether called function is MSVL functions, if it is, defining the function;If it is not, judging called Whether function is the external function for having return value, if it is, step 2 is performed, if called function is outer without return value Portion's function, then perform step 3;
When the called function is MSVL functions, according to the difference of form, point four kinds of situations are defined to the function:
1) having parameter has return value, then definition format is as follows:
define f(in_type x1,…,in_type xn,out_type y1,…, out_type ym,return_type RV []) { MSVL programs };
2) there is Parameters none Return, then definition format is as follows:
Define f (in_type x1 ..., in_type xn, out_type y1 ..., out_type ym) { MSVL programs };
3) printenv has return value, then definition format is as follows:
Define f (return_type RV []) { MSVL programs };
4) without return value, then definition format is as follows for printenv:
Define f () { MSVL programs };
After defining the function, define one and call the MSVL programs of the function and perform step 3;
Step 2, modification described in have return value external function definition, specifically modify in two kinds of situation:
If the external function for having return value has parameter, i.e. original to be defined as:
return_type f(in_type x1,…,in_type xn,out_type y1,…, out_type ym){C/ Java applet };
Then need to make following 2 points of modifications:
(1) head of function definition is changed to:
void f(in_type x1,…,in_type xn,out_type y1,…,out_type ym,return_type RV []);
(2) all " return value " sentences that function is defined in body are replaced by " RV [0]=value ";
If the external function printenv for having a return value, i.e. original is defined as:
Return_type f () { C/Java programs };
Then need to make following 2 points of modifications:
(1) head of function definition is changed to:void f(return_type RV[])
(2) all " return value " sentences that function is defined in body are replaced by " RV [0]=value ";
After the external function definition modification for having return value is finished, define one and call the MSVL programs of the function and perform step 3;
Step 3, it is stipulated that all function calls occurred in MSVL expression formulas belong to black box and call, wherein being repaiied with keyword ext Decorations are called for the black box of external function, and no ext modifications are called for the black box of MSVL functions;Occur in independent sentence Function call there is no that keyword ext modifies for the whitepack of MSVL functions is called, have that ext modifies for MSVL or external function Black box is called, and existing discriminant function calls the position of appearance:
If function call is appeared in MSVL expression formulas and without keyword ext modifications, that is, the black box for belonging to MSVL functions is called, Then perform step 4;If the function call in MSVL expression formulas has keyword ext to modify, that is, the black box for belonging to external function is called, Then perform step 5;If function call occurs with independent sentence and without keyword ext modifications, that is, belongs to the whitepack of MSVL functions Call, then perform step 6;If function call occurs with independent sentence and has keyword ext to modify, that is, belong to MSVL functions or outer The black box of portion's function is called, then perform step 7;
Step 4, obtains value of all argument variables under caller current state in called MSVL function argument lists, And to defining the MSVL program initializations of the function, while the performing environment of former caller is preserved, now, if defined function MSVL programs are simple structure, perform step 8, if the MSVL programs of defined function are labyrinth, the program carries out recurrence Structural Transformation, i.e., carry out equivalence transformation to program, is converted into a simple structured program, then performs step 8;
Step 5, obtains value of all argument variables under caller current state in called external function argument list, Then these parameter values are passed into C or Java functions to perform, function return value is as external function in MSVL expression formulas Value;
Step 6, obtains value of all argument variables under caller current state in called MSVL function argument lists, Now, if the MSVL programs of defined function are simple structure, step 9 is performed, if the MSVL programs of defined function are labyrinth, Recursive structure conversion then is carried out to the program, simple structure is converted to, step 9 is then performed;
Step 7, if called function is MSVL functions, performs step 4;If external function, step 5 is performed;
Step 8, simple structure is divided into current state collection of programs and NextState collection of programs in current state;This step is specific Comprise the following steps:
Step 8.1, is once explained simple structure in current state, that is, perform the sentence in current state collection of programs, Implementation effect is reflected in the renewal of program variable and the change of program structure;Then step 8.2 is performed;
Step 8.2, judges whether NextState collection of programs is empty:If NextState collection of programs is not sky, will be next Then status routine set changes the time sequence status of function program as new pending program, is redirected from current time sequence status To next time sequence status, now, if new pending program is simple structure, returns and perform step 8.1, if new is pending Program is labyrinth, then carry out recursive structure conversion to the program, is converted to a simple structure, is then back to perform step 8.1;If NextState collection of programs is sky, recover the performing environment of caller, the function that is then called is by control Caller is given back, the calculating process of function call terminates, the return value of the function that is now called has passed through variable R V [0] biographies Caller is passed, if the execution siding-to-siding block length of function is more than 0, the final state that function is performed is worked as caller The NextState of preceding state, and caller is jumped into next time sequence status from current state, then caller continues to hold OK, if the execution of function is interval to be equal to 0, i.e. function of state, then caller is continued executing with from current state;
Step 9, simple structure is divided into current state collection of programs and NextState collection of programs in current state;This step is specific Comprise the following steps:
Step 9.1, is once explained simple structure in current state, that is, perform the sentence in current state collection of programs, Implementation effect is reflected in the renewal of program variable and the change of program structure, then performs step 9.2;
Step 9.2, judges whether NextState collection of programs is empty:If NextState collection of programs is not sky, will be next Then status routine set changes the time sequence status of function program as new pending program, is redirected from current time sequence status To next time sequence status, now, if new pending program is simple structure, returns and perform step 9.1, if new is pending Program is labyrinth, then carry out recursive structure conversion to the program, is converted to a simple structure, is then back to perform step 9.1;If NextState collection of programs is sky, recover the execution step of caller, and the state that function call is produced To the interval that performs of call function, control is given back caller to sequence statistic by the function that is then called, and now function is adjusted Calculating process terminates, and the done state that caller is then performed from called function is continued executing with.
2. a kind of function calling method based on temporal logic language MSVL according to claim 1, it is characterised in that letter The syntactic definition that number black box is called is as follows:
The black box of MSVL functions calls grammer:Ext MSVL function names (argument list, RV);
The black box of external function calls grammer:Ext external function names (argument list, RV).
3. a kind of function calling method based on temporal logic language MSVL according to claim 1, it is characterised in that step In rapid 3, the syntactic definition of described MSVL expression formulas is:
To the constant of single belt type:A, b, c ... ∈ D are basic representations, and wherein basic representation can contain subscript;
To the static variable and dynamic variable of single belt type:U, v, x, y, z ... ∈ V are basic representations, wherein primary expression Formula can contain subscript;
If x is variable, Ο x and Θ x are expression formulas;
If op is the n-ary operation symbol (n in MSVL>0), e1 ..., en are the expression mutually compatible with the parameter type of op of n type Formula, then op (e1 ..., en) is expression formula;
If h is n units MSVL function of states (n>0), e1 ..., en are the n type expression formulas mutually compatible with h parameter types, then h (e1 ..., en, RV) it is expression formula;
If f is n units MSVL sequential functions (n>0), e1 ..., en are the n type expression formulas mutually compatible with f parameter types, then f (e1 ..., en, RV) it is expression formula;
If g is the first external function (n of n>0), e1 ..., en are the n type expression formulas mutually compatible with g parameter types, then ext g (e1 ..., en, RV) it is expression formula.
4. a kind of function calling method based on temporal logic language MSVL according to claim 3, it is characterised in that institute The MSVL expression formula e1 for stating ..., the semantic interpretation of en is MSVL expression formula e1 ..., en is in the interval current state of given state The value at place, it is by explaining I=(σ, i, k, j) come what is defined:
The values that is construed to the constant of the I to belt type constant;
I is construed to value of the variable at the indictment state of the state interval to static variable;
I is construed to value of the variable at the current state of the state interval to dynamic variable;
I is construed to Ο x:If k<J, then result is with Sk+1It is new interpretation (σ, i, the k+1, j) to the explanation of x of current state; Otherwise, explanation results are ni l;
I is construed to Θ x:If i<K, then result is with Sk-1It is new interpretation (σ, i, the k-1, j) to the explanation of x of current state; Otherwise, explanation results are ni l;
I is construed to op's (e1 ..., en):Operation op is applied to expression formula e1 ..., ene1 ..., en is under the explanation of I The result of gained;
I is construed to h's (e1 ..., en, RV):With expression formula e1 ..., ene1 ..., explanations of the en under I is to function of state After the argument initialization of variable of h, the value of RV [0] at the end of program execution;
I is construed to f's (e1 ..., en, RV):With expression formula e1 ..., ene1 ..., explanations of the en under I is to sequential function After the argument initialization of variable of f, the value of RV [0] at the end of program execution;
I is construed to ext g's (e1 ..., en, RV):With expression formula e1 ..., ene1 ..., explanations of the en under I is to outside After the argument initialization of variable of function g, the value of RV [0] at the end of program execution.
5. a kind of function calling method based on temporal logic language MSVL according to claim 1 or 4, its feature exists In in step 3, the semantical definition that described black box is called is explanation I=(σ, i, k, j) and the external call sentence of MSVL functions Between satisfiability relation:
Explain that I=(σ, i, k, j) meets ext g (e1 ..., en, z1 ..., zm, RV), and if only if, and following two conditions are simultaneously full Foot (1) j=k+1;(2) there is an interval, it is formed by connecting by two parts, Part I is σ(0..k), Part II is one With SkHeaded by state SjIt is the interval of last current state;By the interval and current state SkThe explanation of composition is met by external call generation Projection formula Q, wherein:
E1 ..., en are the input arguments of function g, can be expression formula;
Z1 ..., zm are the output arguments of function g, it is necessary to be variable, parameter y1 ..., the ym correspondence in and function definition;
Fin (zi=bi) ∧ fin (R=r)) prj (zi:=bi ∧ RV:=r).
CN201410531029.2A 2014-10-10 2014-10-10 A kind of function calling method based on temporal logic language MSVL Active CN104281480B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410531029.2A CN104281480B (en) 2014-10-10 2014-10-10 A kind of function calling method based on temporal logic language MSVL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410531029.2A CN104281480B (en) 2014-10-10 2014-10-10 A kind of function calling method based on temporal logic language MSVL

Publications (2)

Publication Number Publication Date
CN104281480A CN104281480A (en) 2015-01-14
CN104281480B true CN104281480B (en) 2017-06-06

Family

ID=52256382

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410531029.2A Active CN104281480B (en) 2014-10-10 2014-10-10 A kind of function calling method based on temporal logic language MSVL

Country Status (1)

Country Link
CN (1) CN104281480B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102339232A (en) * 2011-09-15 2012-02-01 西安电子科技大学 Modeling simulation verification language (MSVL) asynchronous communication system and method
CN103150199A (en) * 2013-04-08 2013-06-12 西安电子科技大学 Multi-type MSVL (Modeling, Simulation and Verification Language) interpretive system and multi-type MSVL interpretive method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102339232A (en) * 2011-09-15 2012-02-01 西安电子科技大学 Modeling simulation verification language (MSVL) asynchronous communication system and method
CN103150199A (en) * 2013-04-08 2013-06-12 西安电子科技大学 Multi-type MSVL (Modeling, Simulation and Verification Language) interpretive system and multi-type MSVL interpretive method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Asynchronous communication in MSVL;Dapeng Mo等;《 Proceedings of the 13th international conference on Formal methods》;20111026;第82-87页 *
MSVL建模、仿真与验证软件的扩展及其应用;郭夏;《中国优秀硕士学位论文全文数据库》;20130315;正文第二章-第三章 *
面向对象MSVL语言及其在组合Web服务验证中的应用;王小兵;《中国博士学位论文全文数据库》;20090115;正文第二章-第四章 *

Also Published As

Publication number Publication date
CN104281480A (en) 2015-01-14

Similar Documents

Publication Publication Date Title
CN111178545B (en) Dynamic reinforcement learning decision training system
JP2012234536A (en) Methods for code generation from semantic models and rules
CN1916926A (en) Simulation method and simulation program
CN104281480B (en) A kind of function calling method based on temporal logic language MSVL
Märtin et al. Patterns and models for automated user interface construction–in search of the missing links
CN103902282B (en) Model transformation method from Web service combination to colored Petri network
CN102999324A (en) Establishing method and system of Rete network
US20090265682A1 (en) Method for transforming data from a model into a secondary model to optimize code generation
JP2010049439A (en) System construction method using software model and modeling device
Ahrendt et al. Reasoning about loops using vampire in KeY
CN107450986A (en) A kind of resource regulating method based on software communications architecture
WO2020211074A1 (en) Multi-party secure computing data processing method, apparatus and system
Faghih et al. ASSESS: A tool for automated synthesis of distributed self-stabilizing algorithms
Cansell et al. Proved-patterns-based development for structured programs
Mbarek et al. Using model driven engineering to reliably accelerate early low power intent exploration for a system-on-chip design
Ingole et al. Instruction set design for elementary set in tensilica xtensa
CN116820564B (en) Unified form semanticalization method of program language
Greve et al. A step-indexing approach to partial functions
Hili et al. Towards a Semantic-Aware Code Generator for Cyber-Physical Systems
Boutekkouk et al. Intelligent Embedded Software: New Perspectives and Challenges
Kirner et al. Compilers must speak properties, not just code: CAL: constraint aggregation language for declarative component-coordination
Studer et al. Object-oriented programming in explicit mathematics: Towards the mathematics of objects
Fourtounis et al. The intensional transformation for functional languages with user-defined data types
CN106126312A (en) A kind of intermediate code based on algebraically calculation optimizes system
Lindley et al. Programming and Reasoning with Algebraic Effects and Effect Handlers

Legal Events

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