JPH03218522A - Automatic generation system for program specification - Google Patents

Automatic generation system for program specification

Info

Publication number
JPH03218522A
JPH03218522A JP1459290A JP1459290A JPH03218522A JP H03218522 A JPH03218522 A JP H03218522A JP 1459290 A JP1459290 A JP 1459290A JP 1459290 A JP1459290 A JP 1459290A JP H03218522 A JPH03218522 A JP H03218522A
Authority
JP
Japan
Prior art keywords
branching
sentences
program
similarity
sentence
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.)
Pending
Application number
JP1459290A
Other languages
Japanese (ja)
Inventor
Shigeki Naota
直田 繁樹
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP1459290A priority Critical patent/JPH03218522A/en
Publication of JPH03218522A publication Critical patent/JPH03218522A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

PURPOSE:To automatically generate a specification whose abstraction degree is high and which is easy to understand from a program by taking out a condition which satisfies the prescribed condition from plural branching sentences taken out from the program, obtaining similarity between the processings of the branching sentences and generating the specification of table structure. CONSTITUTION:The branching sentence whose condition satisfies the prescribed condition is take out among plural branching sentences which a branching sentence taking out part 1 extracts by syntactic analysis for the program. A similarity calculation part 2 collects the branching sentences whose name of variables are same kinds from the taken out branching sentences. Then, similar ity between the processings of respective sentences is calculated and a table generation part 3 generates the specification of table structure where a processing is substituted with an identifier based on calculated similarity and the description of the processing is simplified. Thus, the specification whose abstraction degree is high and which is easy to understand can automatically be generated.

Description

【発明の詳細な説明】 〔概要〕 プログラムから仕揉書を自動生成するプログラム仕様書
自動作成方式に関し、 プログラムから取り出した複数の分岐文から所定条件(
例えば全ての変数=値、変数名が全て同一)に合致する
ものを取り出し、これら分岐文の処理の間の類似度をも
とに識別子で置き換えて記述を簡略化した表構造の仕様
書を作成し、抽象度が高《、理解し易い仕様書を自動生
成することを目的とし、 プログラムから抽出した複数の分岐文について、分岐文
内の条件が所定条件{例えば全ての変数=値、変数名が
全て同一}に合致するものを取り出す分岐文取出部と、
この分岐文取出部によって取り出した分岐文のうちから
変数名が同種(例えば判定コードという範晴で同種)の
ものをまとめて各文の間の処理の類似度を算出する類位
度算出部と、この類似度算出部によって算出した類似度
をもとに処理を識別子(Inえばエラー処理)で置き換
えた表構造の仕様書を作成する表作成部とを備え、この
表作成部によって作成した仕様書を出力するように構成
する。
[Detailed Description of the Invention] [Summary] Regarding an automatic program specification creation method that automatically generates a worksheet from a program, a predetermined condition (
For example, create a table-structured specification that simplifies the description by extracting items that match the condition (all variables = all values and variable names are the same) and replacing them with identifiers based on the similarity between the processing of these branch statements. The purpose is to automatically generate specifications that have a high level of abstraction and are easy to understand.For multiple branching statements extracted from a program, the conditions in the branching statements are set to predetermined conditions {for example, all variables = value, variable name are all the same};
a similarity calculation unit that calculates the similarity of processing between each sentence by grouping together branch sentences with the same type of variable name (for example, the same type of judgment code) from among the branch sentences extracted by the branch sentence extraction unit; , and a table creation unit that creates a table structure specification in which processing is replaced with an identifier (for example, error processing) based on the similarity calculated by this similarity calculation unit, and the specification created by this table creation unit. Configure it to output a document.

こ産業上の利用分野〕 本発明は、プログラムから仕様書を自動生成するプログ
ラム仕様書自動作成方式に関するものである。ソフトウ
ェアの1!能拡張/保守作業において、システムの設計
仕様書が頻緊に参照され、大規模システムではその量が
多く、仕様書の検索に要する時間が膨大なものとなる.
このために仕様書を計算機化することによって、検索作
業の向上を図ることが考えられるが、現存の仕様書の多
くは手書きで作成されている.これを単純に手作業で計
算機に入力するのでは、作業コストが太き《、かつその
正確さに問題がある.そこで、既存のプログラムから仕
様書を自動的に生成する手法が望まれでいる. 〔従来の技術と発明が解決しようとする課題〕従来の仕
様書の生成は、プログラム中の変数名やキーワードを日
本語化したり、制御構造を図で示すような工夫をしてい
た.しかし、これでは基本的にプログラムとの1対1の
対応関係しか示すことができず、充分な抽象度でプログ
ラムの機能を示すことができないという間腫があった.
本発明は、プログラムから取り出した複数の分岐文から
所定条件(例えば全ての変数=値、変数名が全て同一)
に合致するものを取り出し、これら分岐文の処理の間の
類似度をもとにll別子で置き換えて記述を簡略化した
表構造の仕様書を作成し、抽象度が高く、理解し易い仕
様書を自動生成することを目的としている。
INDUSTRIAL APPLICATION FIELD The present invention relates to an automatic program specification creation method for automatically generating specifications from a program. Software 1! During capability expansion/maintenance work, system design specifications are frequently referenced, and in large-scale systems, there are many of them, and the time required to search for specifications is enormous.
For this purpose, it is possible to improve the search process by computerizing specifications, but many of the existing specifications are created by hand. Simply inputting this information into a computer by hand would result in high work costs, and there would be problems with its accuracy. Therefore, a method for automatically generating specifications from existing programs is desired. [Problems to be solved by conventional technology and inventions] Conventional specifications were generated by converting variable names and keywords in the program into Japanese, and by showing control structures in diagrams. However, this basically only shows a one-to-one correspondence with the program, and has the drawback that it is not possible to show the program's functions at a sufficient level of abstraction.
The present invention analyzes multiple branching statements extracted from a program under predetermined conditions (for example, all variables = value, all variable names are the same).
Based on the similarity between the processing of these branch statements, we create a specification with a table structure that simplifies the description by replacing it with the ll identifier, and creates a specification that is highly abstract and easy to understand. The purpose is to automatically generate documents.

〔諜題を解決する手段〕[Means to solve intelligence problems]

第1図を参照して課題を解決する手段を説明す第1図に
おいて、分岐文取出部1ぱ、プログラムを構文解析して
抽出した複数の分岐文について、分岐文内の条件が所定
条件(g4えば全での変数=値、変数名が全て同一)に
合致するものを取り出すものである。
In FIG. 1, which explains means for solving the problem with reference to FIG. For example, g4 extracts the variables that match the condition (all variables = value, all variable names are the same).

類領度算出部2は、分岐文取出部lによって取り出した
分岐文のうちから変数名が同種(例えば判定コードとい
う範疇で同種)のものをまとめ、これらまとめた各文の
処理の間の類似度を算出するものである. 表作成部3ば、類似度算出部2によって算出した11位
度をもとに処理を識別子で置き換えて処理の記述を簡略
化した表構造の仕様書を作成するものである. 〔作用〕 本発明は、第1図に示すように、分岐文取出部lがプロ
グラムを構文解析して抽出した複数の分岐文について、
分岐文内の条件が所定条件(例えば全ての変数=値、変
数名が全て同一)に合致するものを取り出し、類似度算
出部2がこの取り出した分岐文のうちから変数名が同種
(例えば判定コードとい゜う範疇で同種)のものをまと
め、これらまとめた各文の処理の間の類似度を算出し、
表作成部3がこの算出した類似度をもとに処理を識別子
で置き換えて処理の記述を簡略化した表構造の仕様書を
作成するようにしている. 従って、プログラムから取り出した複数の分岐文から所
定条件Cfj4えば全での変数=値、変数名が全て同一
》に合致するものを取り出し、これら分岐文の処理の間
のi似度をもとに識別子で置き換えて記述を簡略化した
表構造の仕様書を作成することにより、抽象度が高く、
理解し易い仕様嘗を自動生成することが可能となる. 〔実施例〕 次に、第1図フローチャートに示す順序に従い、第3図
から第10図を用いて本発明の1実施例の構成および動
作を詳細に説明する. 第1図において、■は、中間表現から文を取り出す.こ
れは、第3図入カプログラム例を構文解析して生成した
第4ryJ中間表現から文を取り出す(文1、文2・−
・というように文単位に取り出す). ■は、分岐文か否かを判別する.これば、■で取り出し
た文が分岐文か否かを判別する.例えば第4図中間表現
の先頭から取り出した文lについて分岐文か否かを判別
し、ここでは“文1 種別分岐文゜と構文解析されてい
るので分岐文と判別する.YESの場合には、■を行う
.NOの場合には、[相]でNOのときにOで次の文を
取り出す.■は、条件が全て変数=値という形式か否か
を判別する.これは、■で分岐文と判別された文内の条
件が全て変数=値という形式か否かを判別する.YES
の場合(例えば第4図文L内の条件1.11条件1.2
、条件1.3 &,:ツイ?それぞれl[OZANoC
l=O、KOZANQCI[=L, KOZANOCI
[=QT肛2となり、変数(IOZANOcK) =値
(0、1 、O丁11Ell)となってYESの場合)
、[有]を行う.NOの場合には、[相]でNoのとき
に■で次の文を取り出す. ■は、変数が全て同一か否かを判別する.これは、文内
の条件の変数が全て同一か否かを判別する.YESの場
合(Nえば第4図文l内の条件l−1、条件1,2、条
件1.3については変数が全て[OZANOC[となっ
てYESの場合)、■を行う.NOの場合には、[相]
でNoのときに■で次の文を取り出す. ■は、中間表現の変換を行う.これは、@YES,6Y
ES,OYESに該当する部分について変換する.g4
えば第4図矩形で囲んだ部分を、第5図矩形で囲んだ部
分に示すように変換する.[相]は、中間表現ファイル
が空きか否かを判別する。これは、例えば第4図中間表
現を格納したファイルから文を取り出し、空になったか
否かを判別する.YESの場合(空の場合)には、■を
行う.NOの場合には、■で中間表現から次の文を取り
出し、■以降を繰り返し行う. Oば、中間表現ファイルを変換後のものと置き換える.
これにより、例えば第4図中間表現中で矩形で囲んだ部
分を、第5図中間表現中の矩形で囲んだ部分に示すよう
に置き換える. 以上の処理によって、例えば第4図構文解析によって生
成した中間表現から、分岐文(@YES)、条件が全て
変数=値という形式(■YES)、変数が全て同一([
相]YES)という所定条件を満たす第4図矩形で囲ん
だ分岐文、条件、変数、値について、第5図矩形で囲ん
だように変換して置き換える。
The similarity degree calculation unit 2 collects the branch sentences with the same type of variable name (for example, the same type in the category of judgment code) from among the branch sentences extracted by the branch sentence extraction unit 1, and calculates the similarity between the processing of each of these grouped sentences. This is to calculate the degree. The table creation unit 3 creates a specification with a table structure in which the process is replaced with an identifier and the description of the process is simplified based on the 11th degree calculated by the similarity calculation unit 2. [Operation] As shown in FIG. 1, the present invention provides for a plurality of branching statements extracted by the branching statement extraction unit l by parsing the program.
The similarity calculation unit 2 extracts branching sentences whose conditions match a predetermined condition (for example, all variables = values, all variable names are the same), and the similarity calculation unit 2 extracts branching sentences whose variable names are the same (for example, judgment We collect code (of the same type in a category called code) and calculate the degree of similarity between the processing of each of these summarized sentences.
Based on the calculated similarity, the table creation unit 3 replaces the process with an identifier to create a table structure specification that simplifies the description of the process. Therefore, from multiple branching statements extracted from the program, those that meet the predetermined condition Cfj4, all variables = value, variable names are all the same] are extracted, and based on the i similarity between the processing of these branching statements, By creating a table structure specification that simplifies the description by replacing it with identifiers, the level of abstraction is high.
It becomes possible to automatically generate specifications that are easy to understand. [Embodiment] Next, the configuration and operation of an embodiment of the present invention will be explained in detail using FIGS. 3 to 10 in accordance with the order shown in the flowchart of FIG. 1. In Figure 1, ■ extracts a sentence from the intermediate representation. This extracts sentences from the 4th ryJ intermediate representation generated by parsing the input program example in Figure 3 (sentence 1, sentence 2, -
・Take out sentences in units of sentences). ■ determines whether it is a branching sentence or not. This will determine whether the sentence extracted in ■ is a branching sentence. For example, it is determined whether or not the sentence l extracted from the beginning of the intermediate expression in Figure 4 is a branching sentence.Here, it is determined that it is a branching sentence because it is parsed as "sentence 1 type branching sentence゜゜.If YES, , do ■.If NO, when [phase] is NO, extract the next sentence with O. ■ determines whether all the conditions are in the form of variable = value. Determine whether all conditions in the statement determined to be a branching statement are in the form variable = value. YES
In the case of (for example, condition 1.11 condition 1.2 in sentence L in Figure 4)
, Condition 1.3 &,: Tweet? respectively l[OZANoC
l=O, KOZANQCI[=L, KOZANOCI
[= QT anal 2, variable (IOZANOcK) = value (0, 1, 011Ell) and YES)
, [exist]. If the answer is NO, press ■ to extract the next sentence. ■ determines whether all variables are the same. This determines whether all the variables of the condition in the sentence are the same. If YES (if YES because all variables become [OZANOC[ for condition l-1, conditions 1, 2, and conditions 1.3 in sentence l in Figure 4), perform ■. If NO, [phase]
If the answer is No, press ■ to extract the next sentence. ■ converts the intermediate representation. This is @YES, 6Y
Convert the parts corresponding to ES and OYES. g4
For example, convert the area enclosed by the rectangle in Figure 4 as shown in the area enclosed by the rectangle in Figure 5. [Phase] determines whether the intermediate representation file is free. This involves, for example, extracting a sentence from the file storing the intermediate representation shown in Figure 4 and determining whether it is empty or not. If YES (empty), perform ■. If NO, extract the next sentence from the intermediate expression using ■, and repeat steps after ■. Otherwise, replace the intermediate representation file with the converted one.
As a result, for example, the part surrounded by a rectangle in the intermediate representation in Figure 4 is replaced as shown by the part surrounded by a rectangle in the intermediate representation in Figure 5. Through the above processing, for example, from the intermediate expression generated by the syntactic analysis in Figure 4, we can obtain a branching statement (@YES), a condition in which all variables = values (■YES), and all variables being the same ([
The branch statements, conditions, variables, and values that satisfy the predetermined condition (YES), which are enclosed in the rectangle in FIG. 4, are converted and replaced as enclosed in the rectangle in FIG.

第tmにおいて、@は、中間表現ファイルから連続する
変換済中間表現を取り出す.これは、■で変換後の文で
置き換えた後の中間表現中から変換した文のみを取り出
し、変換されていない文を除外する. [相]は、文の変数名が同種か否かを判別する.これは
、例えば第5図変換を施した後の中間表現で、文1の変
数名=KOZANOCK’、文2の変数名″ZENZA
NOCr1文3の変数名“RIRITυCl1″が同種
か否かを判別し、ここではこれら3つの変数は第7図意
味情報を参照して口座番号判定コード、前残判定コード
、利率コード判定コードであり、判定コードという範疇
で同種であり、YESと判別する,YESの場合には、
[株]を行う.NOの場合には、同種でなく、終了する
. @ぱ、表の原形を作成する.これは、第5図中間表現中
の文1、文2、文3が“判定コード”という種別で同一
であったので、第6図の上段の矩形欄に示すように、文
1ないし文3についてまとめた表の原形を図示のように
作成する.[相]は、分岐後の処理の記述を簡略化する
ために、表中の処理の間の類似度の計算を行う.これは
、例えば第6図処理1.2、処理163などの間の類似
度を第9図に示すように計算を行う(後述する).[相
]は、頻領度が所定値以上か否かを判別する.YESの
場合には、0を行う.NOの場合には、[相]を行う. @は、共通の戯別子を与え、登録して表を簡略化する.
これは、第6図上段の矩形部分の表について、@で類似
度が所定閾値以上と判別された処理について共通の識別
子例えば“エラー処理″を与え、第10図に示すように
表を簡略化する.この共通部分は、類似パターンとして
、意味情報に登録し、他の処理の記述を簡略化するため
に第B図に示すように登録する. [相]は、処理に個別に識別子を付け、表にはその識別
子を入れ、補足記述として処理を記載する.以上の@か
ら[相]の処理によって、第6図上段の矩形欄の表中の
処理の記述を簡略化し、第10図に示す表(表形式の仕
様書)を作成する.次に、第2図から第10図について
それぞれ説明する. 第2図は、本発明の全体構成図を示す.第2図において
、プログラム11は、表形式の仕様書を作成しようとす
るプログラムであって、例えば第3図に示すプログラム
である.構文解析部12は、プログラム11を取り込ん
で構文解析し、中間表現に変換するものであって、例え
ば第3図プログラムを第4図中間表現に変換するもので
ある. 中間表現13ば、構文M捉部12によって変換した中間
表現である.この中間表現13は、ファイルとして格納
されている. 変換部14は、中間表現13を表形式の仕様書17に変
換するものである. 意味情報15は、データ名に関する意味情報であって、
例えば第7図に示すようにデータ名“KOzANO(J
”が口座番号判定コードという意味である旨の情報であ
る. 類似パターン検出部16は、処理が類似するか否かを検
出するものである(第1図■、6YES/No). 次に、動作を説明する. (1)構文解析部12がプログラム11として例えば第
3図プログラムを順次取り込み、構文解析して第4図中
間表現l3に変換する. (2)IRWR部14が、中間表現l3として例えば第
4図中間表現を文単位に取り込み、意味情Ill5を参
照しながら、類似パターン検出部16によって類似の処
理を検出し、分岐文を表形式の仕様書(第lO図)に変
換する. 第3図は、入力プログラム例を示す.これは、COBO
Lによる1i!行預金処理の入力チェックプログラムの
一部を取り出したものである.第4図は、本発明の構文
解析によって生成した中間表現例を示す。これは、第3
図入カブログラム例を構文解析して生成した中間表現例
である.第3図プログラムと第4図中間表現の関係の一
部を以下に示す。
At tm-th, @ retrieves successive transformed intermediate representations from the intermediate representation file. This extracts only the converted sentences from the intermediate representation after replacing them with the converted sentences in ■, and excludes unconverted sentences. [Similar] determines whether the variable names in the sentences are of the same type. This is, for example, the intermediate representation after performing the transformation in Figure 5, where the variable name of statement 1 = KOZANOCK', and the variable name of statement 2 = ``ZENZA''.
It is determined whether the variable name "RIRITυCl1" in NOCr1 statement 3 is of the same type or not, and here, these three variables are the account number determination code, the front balance determination code, and the interest rate code determination code by referring to the semantic information in Figure 7. , are of the same type in the category of determination codes, and determined as YES. In the case of YES,
Do [stocks]. If NO, it is not the same type and ends. @Pa, create the original form of the table. This is because sentences 1, 2, and 3 in the intermediate expression in FIG. Create the original form of the table summarizing the information as shown in the figure. [Phase] calculates the similarity between the processes in the table in order to simplify the description of the processes after branching. For example, the degree of similarity between processing 1.2 and processing 163 in Fig. 6 is calculated as shown in Fig. 9 (described later). [Phase] determines whether the frequency is greater than or equal to a predetermined value. If YES, perform 0. If NO, perform [phase]. @ gives a common play symbol, registers it, and simplifies the table.
For the rectangular table in the upper part of Figure 6, a common identifier such as "error processing" is given to processes for which the degree of similarity is determined to be greater than a predetermined threshold using @, and the table is simplified as shown in Figure 10. do. This common part is registered as a similar pattern in the semantic information, and is registered as shown in Figure B in order to simplify the description of other processes. [Phase] assigns an identifier to each process, enters the identifier in the table, and describes the process as a supplementary description. By the above processing from @ to [phase], the description of the processing in the table in the rectangular column at the top of Figure 6 is simplified, and the table (specification in tabular form) shown in Figure 10 is created. Next, each of Figures 2 to 10 will be explained. FIG. 2 shows an overall configuration diagram of the present invention. In FIG. 2, a program 11 is a program for creating a tabular specification, and is, for example, the program shown in FIG. 3. The syntactic analysis unit 12 takes in the program 11, parses it, and converts it into an intermediate representation. For example, it converts the program shown in FIG. 3 into the intermediate representation shown in FIG. The intermediate representation 13 is an intermediate representation converted by the syntax M capture unit 12. This intermediate representation 13 is stored as a file. The converter 14 converts the intermediate representation 13 into a tabular specification 17. The semantic information 15 is semantic information regarding the data name,
For example, as shown in Figure 7, the data name “KOzANO(J
" is the information that means the account number determination code. The similar pattern detection unit 16 detects whether or not the processes are similar (■, 6 YES/No in FIG. 1). Next, The operation will be explained. (1) The syntactic analysis unit 12 sequentially takes in, for example, the program shown in FIG. For example, the intermediate expression shown in Figure 4 is taken in sentence by sentence, the similar pattern detection unit 16 detects similar processing while referring to the semantic information Ill5, and the branched sentence is converted into a tabular specification (Figure 1O). Figure 3 shows an example input program.
1i by L! This is a part of the input check program for bank deposit processing. FIG. 4 shows an example of an intermediate representation generated by the syntactic analysis of the present invention. This is the third
This is an example of an intermediate representation generated by parsing the illustrated example of a program. Part of the relationship between the program in Figure 3 and the intermediate representation in Figure 4 is shown below.

!11  EVALtlATE 上 種別 分岐文 (2)賀HEN O CONTINtlE↓ 条件1.1 KOZAIfOC[=O  処理1−1 
 1,(3)賀HE?1 1 ?IOVE 10001
 To ERRI’!SGNOPIOVE l[OZA
IIIoIDNo To EI?l?InNOperf
orm ERROR−SECTION↓ 条件1.2 KOZANOCK=1 処理1.2 文1.2.1種別 代入文 ERRfISGNO:=lOOIL 文1.2.2種別 代入文 Efl?IDNO:=KOZllNOInNO文1.2
.3種別 手続き呼び出し文 PEI?FOl?PrER20R−SECτION(4
)以下同様であるので省略する. 第5図は、本発明の分岐文に変換を施した中間表現例を
示す。これは、第4図矩形で囲んだ分岐文、条件一変数
名、!lについて、第1図[株]YES、OYES、■
YESに該当するので、これに変換を施して第5図矩形
で囲んだ部分に示すように置き換えたものである. 第6図は、本発明の分岐文をマージした中間表現例を示
す.これは、第5図分岐文のうちの矩形で囲んだ部分の
変数([QZILNOC[ , ZENZAffC[,
 RII?1rLlcI[) 6こついて判定コードと
いう範晴で同種と判別サレノテ(第1図OYES) 、
文1、文2、文3の分岐文を図示のようにマージしたも
のである.第7図は、本発明に係る変換に用いる意味情
報(日本語名)を示す.これは、分岐文などで使用する
変数名の日本語による意味情報を表す.ここでは、日本
語で判定コードという範喝で同種となるものが、図示K
OZANOCK, ZENZANCK, flflTU
(Jがある. 第8図は、本発明に係る類似パターン登録例を示す.こ
れは、分岐後の処理の記述を簡略化するための識別子“
エラー処理゛について、類似する図示のような処理で使
用する旨を登録したものである. 第9図は、本発明に係る類似度算出例を示す.例えば第
6図処理1.2と処理1.3の類領度は、図示のように
表され、図示のようにして求める.以下処理1、処理2
0間の類似度の計算について一般的に説明する. 1!位度を当初0とする。
! 11 EVALtlATE Upper type Branching statement (2) HEN O CONTINtlE↓ Condition 1.1 KOZAIfOC[=O Processing 1-1
1, (3) KaHE? 1 1? IOVE 10001
To ERRI'! SGNOPIOVE l[OZA
IIIoID No To EI? l? InNOperf
orm ERROR-SECTION↓ Condition 1.2 KOZANOCK=1 Processing 1.2 Statement 1.2.1 Type Assignment statement ERRfISGNO:=lOOIL Statement 1.2.2 Type Assignment statement Efl? IDNO:=KOZllNOInNO statement 1.2
.. 3 types Procedure call statement PEI? FOl? PrER20R-SECτION(4
) The same applies hereafter, so it will be omitted. FIG. 5 shows an example of intermediate expression obtained by converting the branch statement of the present invention. This is the branching statement enclosed in a rectangle in Figure 4, one condition, one variable name, and one variable name! Regarding l, Figure 1 [stock] YES, OYES, ■
Since it corresponds to YES, it is converted and replaced as shown in the rectangular area in Figure 5. Figure 6 shows an example of an intermediate representation in which branching statements of the present invention are merged. This is the variable ([QZILNOC[, ZENZAffC[,
RII? 1rLlcI [) 6 It is determined that the determination code is the same species by Noriharu (Fig. 1 OYES),
The branch sentences of sentence 1, sentence 2, and sentence 3 are merged as shown. FIG. 7 shows the semantic information (Japanese name) used for conversion according to the present invention. This represents the meaning information in Japanese of variable names used in branching statements, etc. Here, the same type of judgment code in Japanese is shown in the diagram K.
OZANOCK, ZENZANCK, flflTU
(There is J. Fig. 8 shows an example of similar pattern registration according to the present invention. This is an identifier "
Regarding error handling, it is registered to be used in similar processing as shown in the diagram. FIG. 9 shows an example of similarity calculation according to the present invention. For example, the similarity degree of process 1.2 and process 1.3 in FIG. 6 is expressed as shown in the figure, and is determined as shown in the figure. Below processing 1, processing 2
This section provides a general explanation of the calculation of similarity between 0. 1! The degree is initially set to 0.

処理lの先頭の文と処理2の先頭の文と順に比較する. 文間の類似度を以下のように計算する.文種別が一致す
れば類似度を1加える.次に個々の文種別毎に以下のよ
うに類似度を計算する。
Compare the first sentence of process l and the first sentence of process 2 in order. Calculate the similarity between sentences as follows. If the sentence types match, add 1 to the similarity. Next, the similarity is calculated for each sentence type as follows.

代入文: 左辺の変数が一致する場合は変数に2 加える. 右辺の変数が同種のものである場合は 変数に1加える. 右辺の式が一致する場合は2加える. そうでなく、右辺が変数のみで、その 変数が同種である場合はl加える. 手続き呼び出し文: 引数がある場合: 手続き名が一致すれば、2加える. 更に(一致する引数の数×2+同種の 引数の数)÷引数の数を加える。Assignment statement: If the variables on the left side match, add 2 to the variable. Add. If the variables on the right side are of the same type, then Add 1 to the variable. If the expressions on the right side match, add 2. Otherwise, if the right-hand side is only a variable, then If the variables are of the same type, add l. Procedure call statement: With arguments: If the procedure names match, add 2. Furthermore, (number of matching arguments x 2 + homogeneous number of arguments) ÷ number of arguments.

引数がない場合: 手続き名が一致すれば、4加える。If there are no arguments: If the procedure names match, add 4.

分岐文: 条件が一致していれば、4加える. そうでなく、条件の変数一値の形式で、その変数が一致
している場合は2加える.そうでなく、条件の変数=値
の形式で、その変数が同種の場合は1加える. 分岐後の個々の処理について類似度を 計算し、それを加える 繰り返し文: 条件が一致していれば、4加える. そうでなく、条件の変数=値の形式で、その変数が一致
している場合は2加える.そうでな《、条件の変数=値
の形式で、その変数が同種の場合は!加える. 繰り返しの個々の処理について!!位度を計夏し、それ
を加える. 類似度が2以上のものがあり、それが処理2のi番目の
文であるとすると、それ以降は処理1のj番目の文と処
理2のi+j−1番目の文とを比較する. 111位度が2以上のものがない場合は、処理Lの次の
文と処理2の各文を順に比較し、上記と同様のことを行
う. 全体の類似度を計算し終われば、それを処理1と処理2
0文の数の和で割り、2つの処理間の類領度とする. 第10図は、本発明により出力される仕様書例を示す.
これは、第6図上段の矩形欄の判定コードによりマージ
した分岐文の処理について、第9図類似度計算を行って
類似度が所定閾値以上の処理について共通の識別子“エ
ラー処理゛で置き換え、記述を簡略化したものである.
類領度が所定闇値以下の処理については、個別に識別子
を付与し、補足記述を図示のように記載する.〔発明の
効果〕 以上説明したように、本発明によれば、プログラムから
取り出した複数の分岐文から所定条件(例えば全ての変
数=値、変数名が全て同一)に合致するものを取り出し
、これら分岐文の処理の間の類似度を求めて表構造の仕
檄書を作成する構成を採用しているため、抽象度が高く
、理解し易い仕様書をプログラムから自動生成すること
ができ、保守作業などの効率を向上させることができる
Branching statement: If the conditions match, add 4. Otherwise, if the condition is in the form of one variable value, and the variable matches, add 2. Otherwise, in the condition variable = value format, if the variables are of the same type, add 1. A repeating statement that calculates the similarity for each process after branching and adds it: If the conditions match, add 4. Otherwise, in the condition variable = value format, if the variable matches, add 2. Otherwise, if the condition variable = value format and the variables are of the same type! Add. About repeated individual processing! ! Calculate the degree and add it. If there is a sentence with a degree of similarity of 2 or more, and it is the i-th sentence in Process 2, then the j-th sentence in Process 1 and the i+j-1 sentence in Process 2 are compared. If there is no sentence with a degree of 111th rank of 2 or more, the next sentence in process L and each sentence in process 2 are compared in order, and the same thing as above is performed. After calculating the overall similarity, it is divided into Process 1 and Process 2.
Divide by the sum of the number of 0 sentences and use it as the degree of similarity between the two processes. FIG. 10 shows an example of a specification sheet output by the present invention.
This is done by calculating the similarity in Figure 9 for the processing of the branch sentences merged using the judgment code in the rectangular column in the upper part of Figure 6, and replacing the processing with the similarity with a common identifier "error processing" for processes whose similarity is higher than a predetermined threshold. This is a simplified description.
For processes whose degree of similarity is less than the predetermined darkness value, an identifier is assigned to each process and a supplementary description is written as shown in the figure. [Effects of the Invention] As explained above, according to the present invention, branch statements that meet a predetermined condition (for example, all variables = value, all variable names are the same) are extracted from a plurality of branch statements extracted from a program, and these Since we have adopted a configuration that creates a tabular business report based on the similarity between the processing of branch statements, it is possible to automatically generate a highly abstract and easy-to-understand specification from a program, making maintenance easier. It is possible to improve work efficiency.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明の1実施例構成・動作説明図、第2図は
本発明の全体構成図、第3図は入力プログラム例、第4
図は本発明の構文解析によって生成した中間表現例、第
5図は本発明の分岐文に変換を施した中間表現例、第6
図は本発明の分岐文をマージした中間表現例、第7図は
本発明に係る変換に用いる意味情報(日本語名)、第8
図は本発明に係る類似パターン登録例、第9図は本発明
に係る類似度算出例、第10図は本発明により出力され
る仕様書例を示す. 図中、1は分岐文取出部、2は類似度算出部、3は表作
成部、11ばプログラム、l2は構文解析部、13は中
間表現、l4は変換部、15は意味情報、16は類似パ
ターン検出部、17は仕様書を表す. 本発明の全体構成図 第 2 図 本発明により出力される仕様書例 第 10 図 口変換を施した部分 本発明の分岐文に変換を施した中間表現例第 5 図 本発明の分岐文をマージした中間表現例第 6 図
FIG. 1 is an explanatory diagram of the configuration and operation of one embodiment of the present invention, FIG. 2 is an overall configuration diagram of the present invention, FIG. 3 is an example of an input program, and FIG.
The figure shows an example of an intermediate expression generated by the syntactic analysis of the present invention, Figure 5 is an example of an intermediate expression generated by converting the branch statement of the present invention, and Figure 6 shows an example of an intermediate expression generated by the syntax analysis of the present invention.
The figure shows an example of intermediate representation by merging the branch sentences of the present invention, Figure 7 shows the semantic information (Japanese name) used for the conversion according to the present invention, and Figure 8
The figure shows an example of similar pattern registration according to the present invention, Fig. 9 shows an example of similarity calculation according to the present invention, and Fig. 10 shows an example of a specification outputted according to the present invention. In the figure, 1 is a branch sentence extraction unit, 2 is a similarity calculation unit, 3 is a table creation unit, 11 is a program, l2 is a syntax analysis unit, 13 is an intermediate representation, l4 is a conversion unit, 15 is semantic information, and 16 is A similar pattern detection unit, 17 represents a specification. Overall configuration diagram of the present invention Figure 2 Example of a specification output by the present invention Part 10 Part subjected to figure-head conversion Example of an intermediate expression in which the branching statement of the present invention is converted Figure 5 Merging the branching statement of the present invention Figure 6 Example of intermediate representation

Claims (1)

【特許請求の範囲】 プログラムから仕様書を自動生成するプログラム仕様書
自動作成方式において、 プログラムから抽出した複数の分岐文について、分岐文
内の条件が所定条件(例えば全ての変数=値、変数名が
全て同一)に合致するものを取り出す分岐文取出部(1
)と、 この分岐文取出部(1)によって取り出した分岐文のう
ちから変数名が同種(例えば判定コードという範疇で同
種)のものをまとめて各文の間の処理の類似度を算出す
る類似度算出部(2)と、この類似度算出部(2)によ
って算出した類似度をもとに処理を識別子(例えばエラ
ー処理)で置き換えた表構造の仕様書を作成する表作成
部(3)とを備え、 この表作成部(3)によって作成した仕様書を出力する
ように構成したことを特徴とするプログラム仕様書自動
作成方式。
[Claims] In a program specification automatic creation method that automatically generates a specification from a program, for a plurality of branch statements extracted from a program, a condition in the branch statement is set to a predetermined condition (for example, all variables = value, variable name are all the same).
), and a similarity method that calculates the similarity of processing between each sentence by grouping together branch sentences with the same type of variable name (for example, the same type in the category of judgment code) from among the branch sentences extracted by this branch sentence extraction unit (1). a table creation unit (3) that creates a table structure specification in which processes are replaced with identifiers (for example, error handling) based on the similarity calculated by the similarity calculation unit (2); An automatic program specification creation method, characterized in that the table creation unit (3) is configured to output the specifications created by the table creation unit (3).
JP1459290A 1990-01-24 1990-01-24 Automatic generation system for program specification Pending JPH03218522A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1459290A JPH03218522A (en) 1990-01-24 1990-01-24 Automatic generation system for program specification

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1459290A JPH03218522A (en) 1990-01-24 1990-01-24 Automatic generation system for program specification

Publications (1)

Publication Number Publication Date
JPH03218522A true JPH03218522A (en) 1991-09-26

Family

ID=11865443

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1459290A Pending JPH03218522A (en) 1990-01-24 1990-01-24 Automatic generation system for program specification

Country Status (1)

Country Link
JP (1) JPH03218522A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013250631A (en) * 2012-05-30 2013-12-12 Ntt Data Corp Information processor, information processing method and program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013250631A (en) * 2012-05-30 2013-12-12 Ntt Data Corp Information processor, information processing method and program

Similar Documents

Publication Publication Date Title
US20050138606A1 (en) System and method for code migration
JP7297458B2 (en) Interactive content creation support method
JPH07219758A (en) Specification generation method
CN110377892A (en) A kind of government intelligence form templat designing system
CN108319687A (en) A kind of SQL Rule Builders pulling technology based on JS
US5564053A (en) Method for generating specific program systems and tools to facilitate in generating the specific program systems
WO1996002033A1 (en) Method of writing program for specific business
JP2016164707A (en) Automatic translation device and translation model learning device
CN117370493A (en) Intelligent interaction method and device for system based on large language model
JPH03218522A (en) Automatic generation system for program specification
CN106354493A (en) Development mode implementation method for solving traditional software development pain points
Pinheiro et al. ChartText: Linking Text with Charts in Documents
US20220284188A1 (en) Machine based expansion of contractions in text in digital media
CN116340337A (en) Database-independent SQL sentence generation method
US5542085A (en) Method for producing program modules
CN112631567A (en) Method and device for generating database operation file
KR20230065017A (en) Apparatus and method for generating summary of program source code based on ai analysis
CN110727428B (en) Method and device for converting service logic layer codes and electronic equipment
KR20230076497A (en) Interface structure and method for question and answer of document data
CN114116779A (en) Deep learning-based power grid regulation and control field information retrieval method, system and medium
CN112949274A (en) Document data entry method and system
CN110928535A (en) Derivative variable deployment method, device, equipment and readable storage medium
JP2021056828A (en) Interactive operation explanation device, interactive device and interactive operation explanation program
CN117521606B (en) Intelligent report generation system and method for financial data
JP2006139441A (en) Rule definition apparatus for document conversion