JP5812878B2 - Source code generation apparatus, source code generation method, and source code generation program - Google Patents

Source code generation apparatus, source code generation method, and source code generation program Download PDF

Info

Publication number
JP5812878B2
JP5812878B2 JP2012007144A JP2012007144A JP5812878B2 JP 5812878 B2 JP5812878 B2 JP 5812878B2 JP 2012007144 A JP2012007144 A JP 2012007144A JP 2012007144 A JP2012007144 A JP 2012007144A JP 5812878 B2 JP5812878 B2 JP 5812878B2
Authority
JP
Japan
Prior art keywords
source code
cell
code generation
decision table
row
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.)
Expired - Fee Related
Application number
JP2012007144A
Other languages
Japanese (ja)
Other versions
JP2013148964A (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.)
Fujitsu FSAS Inc
Original Assignee
Fujitsu FSAS Inc
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 FSAS Inc filed Critical Fujitsu FSAS Inc
Priority to JP2012007144A priority Critical patent/JP5812878B2/en
Publication of JP2013148964A publication Critical patent/JP2013148964A/en
Application granted granted Critical
Publication of JP5812878B2 publication Critical patent/JP5812878B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Description

本発明は、ソースコード生成装置等に関する。   The present invention relates to a source code generation device and the like.

近年、プログラムの処理条件やポリシーなどを分かりやすく表現するためにデシジョンテーブルが利用されている。図16は、デシジョンテーブルの一例を示す図である。図16に示すように、デシジョンテーブル10は、条件記述領域10a、条件指定領域10b、動作記述領域10c、動作指定領域10dを有する。   In recent years, decision tables have been used to express program processing conditions and policies in an easy-to-understand manner. FIG. 16 is a diagram illustrating an example of a decision table. As shown in FIG. 16, the decision table 10 has a condition description area 10a, a condition designation area 10b, an action description area 10c, and an action designation area 10d.

条件記述領域10aは、条件を記述する部分である。条件指定領域10bは、条件記述領域10aの条件が満たされているか否かを指定する部分である。条件が満たされていれば、条件記述領域10aに「y」が指定され、条件が満たされていなければ「n」が指定される。   The condition description area 10a is a part for describing conditions. The condition designation area 10b is a part for designating whether or not the condition of the condition description area 10a is satisfied. If the condition is satisfied, “y” is specified in the condition description area 10a, and if the condition is not satisfied, “n” is specified.

動作記述領域10cは、動作を記述する部分である。動作指定領域10dは、動作を実行するか否かを指定する部分である。動作を実行する場合には、動作指定領域10dに「x」が指定され、動作を実行しない場合には「−」が指定される。   The behavior description area 10c is a portion describing behavior. The operation designation area 10d is a part for designating whether or not to execute an operation. When the operation is executed, “x” is specified in the operation specifying area 10d, and when the operation is not executed, “−” is specified.

例えば、図16のデシジョンテーブル10において、「商品コード<000」の条件を満たし、「商品コード>999」の条件を満たさない場合には「下限エラー処理」が実行される。「商品コード<000」の条件を満たさず、「商品コード>999」の条件を満たす場合には「上限エラー処理」が実行される。「商品コード<000」および「商品コード>999」の条件を満たさない場合には「マスタファイル登録」が実行される。   For example, in the decision table 10 of FIG. 16, when the condition “product code <000” is satisfied and the condition “product code> 999” is not satisfied, “lower limit error processing” is executed. If the condition “product code <000” is not satisfied and the condition “product code> 999” is satisfied, the “upper limit error process” is executed. If the conditions of “product code <000” and “product code> 999” are not satisfied, “master file registration” is executed.

利用者は、デシジョンテーブル10を作成して、処理条件やポリシーなどを整理したのちに、デシジョンテーブル10に定義した条件による動作をコンピュータに実行させるソースコードを、エディタを利用して作成する。   A user creates a decision table 10 and arranges processing conditions, policies, and the like, and then creates source code that causes a computer to execute an operation based on the conditions defined in the decision table 10 using an editor.

ここで、ソースコードを作成する利用者の負担を軽減するべく、デシジョンテーブルで定義した情報を、任意の処理言語に変換する従来技術が開示されている。この従来技術は、条件記述領域、条件指定領域、動作記述領域、動作指定領域に設定された情報の関係から、IF文を生成する。図17は、従来技術により生成されたソースコードの一例を示す図である。図17に示すように、図16に示したデシジョンテーブル10は、IF文を含むソースコード20に変換されている。   Here, a conventional technique for converting information defined in a decision table into an arbitrary processing language is disclosed in order to reduce a burden on a user who creates a source code. This prior art generates an IF statement from the relationship of information set in a condition description area, a condition designation area, an action description area, and an action designation area. FIG. 17 is a diagram illustrating an example of source code generated by the conventional technique. As shown in FIG. 17, the decision table 10 shown in FIG. 16 is converted into source code 20 including an IF statement.

特開平7−152543号公報JP 7-152543 A

しかしながら、上述した従来技術では、繰り返しの動作を含むデシジョンテーブルをソースコードに変換することができないという問題があった。   However, the above-described prior art has a problem that a decision table including repetitive operations cannot be converted into source code.

一般のデシジョンテーブルは、図16に示した単純なものだけではなく、繰り返しの動作を含むデシジョンテーブルが用いられる場合がある。従来技術では、このような繰り返しの動作を含むデシジョンテーブルを、ソースコードに変換することができない。このため、デシジョンテーブルに繰り返しの動作が含まれる場合には、利用者自身が、エディタでソースコードを作成することになる。   The general decision table is not limited to the simple one shown in FIG. 16, but may be a decision table including repeated operations. In the prior art, a decision table including such repeated operations cannot be converted into source code. For this reason, when the decision table includes repeated operations, the user himself / herself creates the source code with the editor.

開示の技術は、上記に鑑みてなされたものであって、繰り返しの動作を含むデシジョンテーブルをソースコードに変換することができるソースコード生成装置、ソースコード生成方法およびソースコード生成プログラムを提供することを目的とする。   The disclosed technique has been made in view of the above, and provides a source code generation device, a source code generation method, and a source code generation program capable of converting a decision table including repetitive operations into source code. With the goal.

開示のソースコード生成装置は、記憶部と、再帰検出部と、出力部とを有する。記憶部は、複数の条件を各行に分けて記述する条件記述領域と、条件記述領域の条件が満たされているか否かの情報を行および列により決まるセルに指定する条件指定領域と、複数の動作を各行に分けて記述する動作記述領域と、条件記述領域の条件を満たしているか否かに応じて動作を実行するか否かの情報を各行および各列により決まるセルに指定する動作指定領域とを有するデシジョンテーブルを記憶する。再帰検出部は、デシジョンテーブルのセルを順次走査して、該デシジョンテーブルの末尾の行で再帰の動作を行う情報が指定されたセルを検出する。出力部は、再帰検出部の検出結果を基にして、繰り返しを実行するコードを出力する。   The disclosed source code generation device includes a storage unit, a recursion detection unit, and an output unit. The storage unit includes a condition description area that divides a plurality of conditions into each line, a condition designation area that specifies information about whether or not the conditions of the condition description area are satisfied in a cell determined by a row and a column, a plurality of conditions An operation description area that describes the operation divided into each line, and an operation specification area that specifies whether or not the operation is executed depending on whether or not the conditions in the condition description area are satisfied, in a cell determined by each row and each column And a decision table having The recursion detection unit sequentially scans the cells of the decision table, and detects cells in which information for performing the recursion operation is specified in the last row of the decision table. The output unit outputs a code for executing repetition based on the detection result of the recursion detection unit.

開示のソースコード生成装置によれば、繰り返しの動作を含むデシジョンテーブル130aをソースコード130bに変換することができるという効果を奏する。   According to the disclosed source code generation device, it is possible to convert the decision table 130a including repetitive operations into the source code 130b.

図1は、本実施例1に係るソースコード生成装置の構成を示す機能ブロック図である。FIG. 1 is a functional block diagram illustrating the configuration of the source code generation device according to the first embodiment. 図2は、デシジョンテーブルのデータ構造の一例を示す図である。FIG. 2 is a diagram illustrating an example of the data structure of the decision table. 図3は、「put("}")」の動作を定義するデシジョンテーブルを示す図である。FIG. 3 is a diagram illustrating a decision table that defines the operation of “put (“} ”)”. 図4は、本実施例1に係るソースコードのデータ構造の一例を示す図(1)である。FIG. 4 is a diagram (1) illustrating an example of the data structure of the source code according to the first embodiment. 図5は、本実施例1に係るソースコードのデータ構造の一例を示す図(2)である。FIG. 5 is a diagram (2) illustrating an example of the data structure of the source code according to the first embodiment. 図6は、本実施例1に係るソースコード生成部の処理手順を示すフローチャート(1)である。FIG. 6 is a flowchart (1) illustrating the processing procedure of the source code generation unit according to the first embodiment. 図7は、本実施例1に係るソースコード生成部の処理手順を示すフローチャート(2)である。FIG. 7 is a flowchart (2) illustrating the processing procedure of the source code generation unit according to the first embodiment. 図8は、閉じ括弧出力処理の処理手順を示すフローチャートである。FIG. 8 is a flowchart showing a processing procedure of the closing bracket output process. 図9は、本実施例1に係る末尾再帰判定処理の処理手順を示すフローチャートである。FIG. 9 is a flowchart of the process procedure of the tail recursion determination process according to the first embodiment. 図10は、本実施例2に係るソースコード生成装置の構成を示す機能ブロック図である。FIG. 10 is a functional block diagram illustrating the configuration of the source code generation device according to the second embodiment. 図11は、本実施例2に係るソースコードのデータ構造の一例を示す図である。FIG. 11 is a diagram illustrating an example of the data structure of the source code according to the second embodiment. 図12は、break文の行を追加したデシジョンテーブルのデータ構造の一例を示す図である。FIG. 12 is a diagram illustrating an example of a data structure of a decision table to which a break statement line is added. 図13は、本実施例2に係るソースコード生成部の処理手順を示すフローチャート(1)である。FIG. 13 is a flowchart (1) illustrating the processing procedure of the source code generation unit according to the second embodiment. 図14は、本実施例2に係るソースコード生成部の処理手順を示すフローチャート(2)である。FIG. 14 is a flowchart (2) illustrating the processing procedure of the source code generation unit according to the second embodiment. 図15は、本実施例2に係る末尾再帰判定処理の処理手順を示すフローチャートである。FIG. 15 is a flowchart of the process procedure of the tail recursion determination process according to the second embodiment. 図16は、デシジョンテーブルの一例を示す図である。FIG. 16 is a diagram illustrating an example of a decision table. 図17は、従来技術により生成されたソースコードの一例を示す図である。FIG. 17 is a diagram illustrating an example of source code generated by the conventional technique.

以下に、本願の開示するソースコード生成装置、ソースコード生成方法およびソースコード生成プログラムの実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの発明が限定されるものではない。   Embodiments of a source code generation device, a source code generation method, and a source code generation program disclosed in the present application will be described below in detail with reference to the drawings. Note that the present invention is not limited to the embodiments.

本実施例1に係るソースコード生成装置の構成について説明する。図1は、本実施例1に係るソースコード生成装置の構成を示す機能ブロック図である。図1に示すように、このソースコード生成装置100は、入力部110、表示部120、記憶部130、制御部140を有する。   A configuration of the source code generation device according to the first embodiment will be described. FIG. 1 is a functional block diagram illustrating the configuration of the source code generation device according to the first embodiment. As illustrated in FIG. 1, the source code generation device 100 includes an input unit 110, a display unit 120, a storage unit 130, and a control unit 140.

入力部110は、各種の情報をソースコード生成装置100に入力するための入力装置である。例えば、入力部110は、キーボードやマウス、タッチパネル等に対応する。例えば、利用者は、入力部110を操作して、デシジョンテーブル130aの生成や、ソースコード130bの修正などを行う。   The input unit 110 is an input device for inputting various types of information to the source code generation device 100. For example, the input unit 110 corresponds to a keyboard, a mouse, a touch panel, or the like. For example, the user operates the input unit 110 to generate the decision table 130a, modify the source code 130b, and the like.

表示部120は、各種の情報を表示する表示装置である。例えば、表示部120は、後述するデシジョンテーブル130a、ソースコード130b等を表示する。表示部120は、液晶モニタやタッチパネル等に対応する。   The display unit 120 is a display device that displays various types of information. For example, the display unit 120 displays a decision table 130a, source code 130b, and the like which will be described later. The display unit 120 corresponds to a liquid crystal monitor, a touch panel, or the like.

記憶部130は、デシジョンテーブル130aおよびソースコード130bを記憶する。記憶部130は、例えば、RAM(Random Access Memory)、ROM(Read Only Memory)、フラッシュメモリ(Flash Memory)などの半導体メモリ素子、またはハードディスク、光ディスクなどの記憶装置に対応する。   The storage unit 130 stores a decision table 130a and source code 130b. The storage unit 130 corresponds to, for example, a semiconductor memory device such as a random access memory (RAM), a read only memory (ROM), and a flash memory, or a storage device such as a hard disk or an optical disk.

デシジョンテーブル130aは、どのような条件の場合に、どのような動作を行うのかを定義するテーブルである。図2は、デシジョンテーブルのデータ構造の一例を示す図である。図2に示すように、このデシジョンテーブル130aは、条件記述領域131、条件指定領域132、動作記述領域133、動作指定領域134を有する。以下において、条件記述領域131、条件指定領域132、動作記述領域133、動作指定領域134について順に説明する。   The decision table 130a is a table that defines what operation is performed under what conditions. FIG. 2 is a diagram illustrating an example of the data structure of the decision table. As shown in FIG. 2, the decision table 130 a includes a condition description area 131, a condition designation area 132, an action description area 133, and an action designation area 134. In the following, the condition description area 131, the condition designation area 132, the behavior description area 133, and the behavior designation area 134 will be described in order.

条件記述領域131について説明する。条件記述領域131は、複数の条件を各行に分けて記述する領域である。図2に示す例では、デシジョンテーブル130aの0行目から6行目まで、条件が記述されている。0行目から6行目までに記述された条件の意味について説明する。   The condition description area 131 will be described. The condition description area 131 is an area in which a plurality of conditions are described on each line. In the example shown in FIG. 2, conditions are described from the 0th line to the 6th line of the decision table 130a. The meaning of the conditions described from the 0th line to the 6th line will be described.

0行目の条件「t[-1][j]==""」について説明する。条件「t[-1][j]==""」は、デシジョンテーブル130aの−1行目、j列目のセルに情報が含まれていないという条件である。jは変数であり、所定の初期値が設定される。以下に示すjも同様である。なお、−1行目は、0行目の1つ上の行に対応する。   The condition “t [-1] [j] ==" "" on the 0th line will be described. The condition “t [-1] [j] ==“ ”” is a condition that information is not included in the cell in the −1st row and jth column of the decision table 130a. j is a variable, and a predetermined initial value is set. The same applies to j shown below. The -1 line corresponds to the line immediately above the 0 line.

1行目の条件「t[i][-1]==""」について説明する。条件「t[i][-1]==""」は、デシジョンテーブル130aのi行目、−1列目のセルに情報が含まれていないという条件である。iは変数であり、所定の初期値が設定される。以下に示すiも同様である。なお、−1列目は、0列目の一つ左の列に対応する。   The condition “t [i] [− 1] ==“ ”” on the first line will be described. The condition “t [i] [− 1] ==“ ”” is a condition that information is not included in the cell in the i-th row and the −1-th column of the decision table 130a. i is a variable, and a predetermined initial value is set. The same applies to i shown below. Note that the -1 column corresponds to the 1 left column of the 0 column.

2行目の条件「j=0」について説明する。条件「j=0」は、変数jの値が0であるという条件である。   The condition “j = 0” on the second line will be described. The condition “j = 0” is a condition that the value of the variable j is 0.

3行目の条件「t[i][j-1]==t[i][j]」について説明する。条件「t[i][j-1]==t[i][j]」は、デシジョンテーブル130aのi行目、j−1列目のセルの情報と、i行目、j列目のセルの情報とが等しいという条件である。   The condition “t [i] [j−1] == t [i] [j]” on the third line will be described. The condition “t [i] [j-1] == t [i] [j]” is that information on the cell in the i-th row and j−1-th column of the decision table 130a and the i-th row and j-th column The condition is that the cell information is equal.

4行目の条件「t[i][j]=="y"」について説明する。条件「t[i][j]=="y"」は、デシジョンテーブル130aのi行目、j列目のセルの情報が「y」であるという条件である。   The condition “t [i] [j] ==" y "" on the fourth line will be described. The condition “t [i] [j] ==“ y ”” is a condition that the information of the cell in the i-th row and the j-th column of the decision table 130a is “y”.

5行目の条件「t[i][j]=="n"」について説明する。条件「t[i][j]=="n"」は、デシジョンテーブル130aのi行目、j列目のセルの情報が「n」であるという条件である。   The condition “t [i] [j] ==" n "" on the fifth line will be described. The condition “t [i] [j] ==“ n ”” is a condition that the information of the cell in the i-th row and j-th column of the decision table 130a is “n”.

6行目の条件「t[i][j]=="x"」について説明する。条件「t[i][j]=="x"」は、デシジョンテーブル130aのi行目、j列目のセルの情報が「x」であるという条件である。   The condition “t [i] [j] ==" x "" on the sixth line will be described. The condition “t [i] [j] ==“ x ”” is a condition that the information of the cell in the i-th row and the j-th column of the decision table 130a is “x”.

条件指定領域132について説明する。条件指定領域132は、条件記述領域131の各条件が満たされているか否かの情報を記述する領域である。該当する行の条件を満たしていれば、セルに「y」が記述される。該当する行の条件を満たさない場合にはセルに「n」が記述される。   The condition designation area 132 will be described. The condition designation area 132 is an area for describing information as to whether or not each condition of the condition description area 131 is satisfied. If the condition of the corresponding row is satisfied, “y” is described in the cell. When the condition of the corresponding row is not satisfied, “n” is described in the cell.

動作記述領域133について説明する。動作記述領域133は、動作を各行に分けて記述する領域である。図2に示す例では、デシジョンテーブル130aの7行目から17行目まで、動作が記述されている。7行目から17行目までに記載された動作の一例について説明する。   The behavior description area 133 will be described. The behavior description area 133 is an area in which the behavior is described on each line. In the example shown in FIG. 2, the operations are described from the seventh line to the 17th line of the decision table 130a. An example of the operations described in the 7th to 17th lines will be described.

7行目の動作「put("if")」について説明する。動作「put("if")」は、「if」を出力する動作である。   The operation “put (“ if ”)” on the seventh line will be described. The operation “put (“ if ”)” is an operation for outputting “if”.

8行目の動作「put("else")」について説明する。動作「put("else")」は、「else」を出力する動作である。   The operation “put (“ else ”)” on the eighth line will be described. The operation “put (“ else ”)” is an operation for outputting “else”.

9行目の動作「put(x)」について説明する。動作「put(x)」は、「x」を出力する動作である。   The operation “put (x)” on the ninth line will be described. The operation “put (x)” is an operation for outputting “x”.

10行目の動作「l++」について説明する。動作「l++」は、変数lの値に1を加算した値によって、lの値を更新する動作である。   The operation “l ++” on the 10th line will be described. The operation “l ++” is an operation of updating the value of l with a value obtained by adding 1 to the value of the variable l.

11行目の動作「i++」について説明する。動作「i++」は、変数iの値に1を加算した値によって、iの値を更新する動作である。   The operation “i ++” on the eleventh line will be described. The operation “i ++” is an operation for updating the value of i with a value obtained by adding 1 to the value of the variable i.

12行目の動作「i--」について説明する。動作「i--」は、変数iの値から1を減算した値によって、iの値を更新する動作である。   The operation “i--” on the 12th line will be described. The operation “i--” is an operation in which the value of i is updated by a value obtained by subtracting 1 from the value of the variable i.

13行目の動作「put("}")」について説明する。動作「put("}")」は、図3に示すデシジョンテーブルに対応する処理を行う。図3は、「put("}")」の動作を定義するデシジョンテーブルを示す図である。   The operation “put (“} ”)” on the 13th line will be described. The operation “put (“} ”)” performs processing corresponding to the decision table shown in FIG. FIG. 3 is a diagram illustrating a decision table that defines the operation of “put (“} ”)”.

図3の0列目に示すように、iの値が0未満の場合には、動作「put("}")」は何も動作しない。また、図3の1列目に示すように、iの値が0以上であり、デシジョンテーブル130aのi行目、j列目が「y」である場合には、動作「put("}")」は何も動作しない。   As shown in the 0th column in FIG. 3, when the value of i is less than 0, the operation “put (“} ”)” does not operate. As shown in the first column of FIG. 3, when the value of i is 0 or more and the i-th row and j-th column of the decision table 130a are “y”, the operation “put (“} ”” ) "Does nothing.

図3の2列目に示すように、iの値が0以上であり、デシジョンテーブル130aのi行目、j列目が「n」の場合には、動作「put("}")」は、lの値から1を減算した値によって、lの値を更新する。また、動作「put("}")」は、「}」を出力する。また、動作「put("}")」は、iの値から1を減算した値によって、iの値を更新する。   As shown in the second column of FIG. 3, when the value of i is 0 or more and the i-th row and j-th column of the decision table 130a are “n”, the operation “put (“} ”)” The value of l is updated by the value obtained by subtracting 1 from the value of l. Also, the operation “put (“} ”)” outputs “}”. Further, the operation “put (“} ”)” updates the value of i by a value obtained by subtracting 1 from the value of i.

図3の3列目に示すように、iの値が0以上であり、デシジョンテーブル130aのi行目、j列目が「y」でも「n」でもない場合には、動作「put("}")」は、iの値から1を減算した値によって、iの値を更新する。   As shown in the third column of FIG. 3, when the value of i is 0 or more and the i-th row and j-th column of the decision table 130a are neither “y” nor “n”, the operation “put (” } ")" Updates the value of i with a value obtained by subtracting 1 from the value of i.

図2に戻り、14行目の動作「j++」について説明する。動作「j++」は、変数jの値に1を加算した値によって、jの値を更新する動作である。   Returning to FIG. 2, the operation “j ++” on the 14th line will be described. The operation “j ++” is an operation of updating the value of j with a value obtained by adding 1 to the value of the variable j.

15行目の動作「i=0」について説明する。動作「i=0」は、変数iの値に0を設定する動作である。   The operation “i = 0” on the 15th line will be described. The operation “i = 0” is an operation for setting 0 to the value of the variable i.

16行目の動作「l=0」について説明する。動作「l=0」は、変数lの値に0を設定する動作である。   The operation “l = 0” on the 16th line will be described. The operation “l = 0” is an operation for setting 0 to the value of the variable l.

17行目の動作「dt()」について説明する。動作「dt()」は、再帰の動作である。動作「dt()」は、デシジョンテーブル130aを再度呼び出し、デシジョンテーブル130aと同じ処理を再度行う。図2では一例として、動作「dt()」としたが、動作「call dt()」としても良い。   The operation “dt ()” on the 17th line will be described. The operation “dt ()” is a recursive operation. The operation “dt ()” calls the decision table 130a again, and performs the same process as the decision table 130a again. In FIG. 2, the operation “dt ()” is taken as an example, but the operation “call dt ()” may be used.

動作指定領域134について説明する。動作指定領域134は、該当する行の動作を実行するか否かの情報を記述する領域である。該当する行の動作を実行する場合には、「x」が記述される。以下において、デシジョンテーブル130aに定義された、条件と動作について列毎に説明する。   The operation designation area 134 will be described. The operation designation area 134 is an area for describing information on whether or not to execute the operation of the corresponding line. When executing the operation of the corresponding row, “x” is described. Hereinafter, the conditions and operations defined in the decision table 130a will be described for each column.

デシジョンテーブル130aの0列目について説明する。0行目の条件を満たす場合には、デシジョンテーブル130aにより定義された処理は終了となる。   The 0th column of the decision table 130a will be described. When the condition of the 0th row is satisfied, the processing defined by the decision table 130a is finished.

デジションテーブル130aの1列目について説明する。0行目の条件を満たさず、1行目の条件を満たす場合には、12行目から17行目までの動作が行われる。   The first column of the decision table 130a will be described. When the condition of the 0th line is not satisfied and the condition of the 1st line is satisfied, the operations from the 12th line to the 17th line are performed.

デジションテーブル130aの2列目について説明する。0行目および1行目の条件を満たさず、2行目および4行目の条件を満たす場合には、7、10、11、17行目の動作が行われる。   The second column of the decision table 130a will be described. When the conditions of the 0th and 1st lines are not satisfied and the conditions of the 2nd and 4th lines are satisfied, the operations of the 7, 10, 11, and 17th lines are performed.

デシジョンテーブル130aの3列目について説明する。0、1、4行目の条件を満たさず、2行目および5行目の条件を満たす場合には、8、10、11、17行目の動作が行われる。   The third column of the decision table 130a will be described. If the conditions of the 0th, 1st, and 4th lines are not satisfied and the conditions of the 2nd and 5th lines are satisfied, the operations of the 8th, 10th, 11th, and 17th lines are performed.

デシジョンテーブル130aの4列目について説明する。0、1、4、5行目の条件を満たさず、2、6行目の条件を満たす場合には、9、11、17行目の動作が行われる。   The fourth column of the decision table 130a will be described. If the conditions of the 0th, 1st, 4th, and 5th lines are not satisfied and the conditions for the 2nd and 6th lines are satisfied, the operations of the 9th, 11th, and 17th lines are performed.

デシジョンテーブル130aの5列目について説明する。0、1、4、5、6行目の条件を満たさず、2行目の条件を満たす場合には、11、17行目の動作が行われる。   The fifth column of the decision table 130a will be described. If the conditions of the 0th, 1st, 4th, 5th and 6th lines are not satisfied and the condition for the 2nd line is satisfied, the operations of the 11th and 17th lines are performed.

デシジョンテーブル130aの6列目について説明する。0、1、2行目の条件を満たさず、3、4行目の条件を満たす場合には、10、11、17行目の動作が行われる。   The sixth column of the decision table 130a will be described. If the conditions of the 0th, 1st, and 2nd lines are not satisfied and the conditions of the 3rd and 4th lines are satisfied, the operations of the 10th, 11th, and 17th lines are performed.

デシジョンテーブル130aの7行目について説明する。0、1、2、4行目の条件を満たさず、3、5行目の条件を満たす場合には、10、11、17行目の動作が行われる。   The seventh line of the decision table 130a will be described. If the conditions of the 0th, 1st, 2nd, and 4th lines are not satisfied and the condition of the 3rd and 5th lines is satisfied, the operations of the 10th, 11th, and 17th lines are performed.

デシジョンテーブル130aの8行目について説明する。0、1、2、4、5行目の条件を満たさず、3、6行目の条件を満たす場合には、9、11、17行目の動作が行われる。   The eighth line of the decision table 130a will be described. When the conditions of the 0th, 1st, 2nd, 4th, and 5th lines are not satisfied and the conditions for the 3rd and 6th lines are satisfied, the operations of the 9th, 11th, and 17th lines are performed.

デシジョンテーブル130aの9行目について説明する。0、1、2、4、5、6行目の条件を満たさず、3行目の条件を満たす場合には、11、17行目の動作が行われる。   The ninth line of the decision table 130a will be described. If the conditions of the 0th, 1st, 2nd, 4th, 5th, and 6th lines are not satisfied and the condition for the 3rd line is satisfied, the operations of the 11th and 17th lines are performed.

デシジョンテーブル130aの10行目について説明する。0、1、2、3行目の条件を満たさず、4行目の条件を満たす場合には、7、10、11、17行目の動作が行われる。   The 10th line of the decision table 130a will be described. If the conditions of the 0th, 1st, 3rd and 3rd rows are not satisfied, and the condition of the 4th row is satisfied, the operations of the 7th, 10th, 11th and 17th rows are performed.

デシジョンテーブル130aの11行目について説明する。0、1、2、3、4行目の条件を満たさず、5行目の条件を満たす場合には、8、10、11、17行目の動作が行われる。   The eleventh line of the decision table 130a will be described. If the conditions of the 0th, 1st, 3rd, 4th lines are not satisfied and the condition for the 5th line is satisfied, the operations of the 8th, 10th, 11th and 17th lines are performed.

デシジョンテーブル130aの12行目について説明する。0、1、2、3、4、5行目の条件を満たさず、6行目の条件を満たす場合には、9、11、17行目の動作が行われる。   The twelfth line of the decision table 130a will be described. If the conditions of the 0th, 1st, 3rd, 4th, and 5th lines are not satisfied and the condition for the 6th line is satisfied, the operations of the 9th, 11th, and 17th lines are performed.

デシジョンテーブル130aの13行目について説明する。0、1、2、3、4、5、6行目の条件を満たさない場合には、11、17行目の動作が行われる。   The 13th line of the decision table 130a will be described. When the conditions of the 0th, 1st, 2nd, 3rd, 4th, 5th and 6th rows are not satisfied, the operations of the 11th and 17th rows are performed.

ソースコード130bは、デシジョンテーブル130aに定義された各条件による動作をコンピュータに実行させるためのソースコードである。図4および図5は、本実施例1に係るソースコードのデータ構造の一例を示す図である。デシジョンテーブル130aから、図4の1行目から図5の83行目に示すソースコードが生成される。   The source code 130b is source code for causing a computer to execute an operation according to each condition defined in the decision table 130a. 4 and 5 are diagrams illustrating an example of the data structure of the source code according to the first embodiment. From the decision table 130a, the source code shown in the first line of FIG. 4 to the 83rd line of FIG. 5 is generated.

制御部140は、管理部140a、ソースコード生成部140bを有する。制御部140は、例えば、ASIC(Application Specific Integrated Circuit)や、FPGA(Field Programmable Gate Array)などの集積装置に対応する。また、制御部140は、例えば、CPUやMPU(Micro Processing Unit)等の電子回路に対応する。   The control unit 140 includes a management unit 140a and a source code generation unit 140b. The control unit 140 corresponds to an integrated device such as an ASIC (Application Specific Integrated Circuit) or an FPGA (Field Programmable Gate Array). The control unit 140 corresponds to an electronic circuit such as a CPU or MPU (Micro Processing Unit).

管理部140aは、記憶部130に記憶された情報を管理する処理部である。例えば、管理部140aは、利用者が入力部110を操作して入力したデシジョンテーブル130aを、記憶部130に記憶させる。また、管理部140aは、各種の要求に応じて、デシジョンテーブル130a及びソースコード130bを、表示部120に表示させる。   The management unit 140 a is a processing unit that manages information stored in the storage unit 130. For example, the management unit 140a causes the storage unit 130 to store a decision table 130a input by the user operating the input unit 110. Further, the management unit 140a causes the display unit 120 to display the decision table 130a and the source code 130b in response to various requests.

ソースコード生成部140bは、デシジョンテーブル130aを基にして、ソースコード130bを生成する処理部である。ソースコード生成部140bは、再帰検出部141、出力部142を有する。   The source code generation unit 140b is a processing unit that generates the source code 130b based on the decision table 130a. The source code generation unit 140b includes a recursion detection unit 141 and an output unit 142.

再帰検出部141は、デシジョンテーブル130aのセルを0行目0列目から順次走査して、デシジョンテーブル130aの末尾の行で再帰の動作を行う情報が指定されたセルを検出する処理部である。   The recursion detection unit 141 is a processing unit that sequentially scans cells of the decision table 130a from the 0th row and the 0th column, and detects cells in which information for performing recursion is specified in the last row of the decision table 130a. .

出力部142は、再帰検出部141の検出結果を基にして、繰り返しを実行するコードを出力する処理部である。   The output unit 142 is a processing unit that outputs a code for executing repetition based on the detection result of the recursion detection unit 141.

ここで、ソースコード生成部140bに含まれる再帰検出部141と出力部142とが協働してデシジョンテーブル130aからソースコード130bを生成する処理手順について具体的に説明する。図6及び図7は、本実施例1に係るソースコード生成部の処理手順を示すフローチャートである。ソースコード生成部140bは、デシジョンテーブル130aの0行目0列目のセルから、走査を開始する。   Here, a processing procedure in which the recursion detection unit 141 and the output unit 142 included in the source code generation unit 140b cooperate to generate the source code 130b from the decision table 130a will be specifically described. 6 and 7 are flowcharts illustrating the processing procedure of the source code generation unit according to the first embodiment. The source code generation unit 140b starts scanning from the cell in the 0th row and the 0th column of the decision table 130a.

図6に示すように、ソースコード生成部140bは、末尾再帰の移動先となるコードを出力する(ステップS101)。ステップS101において、例えば、ソースコード生成部140bは、図4に示すソースコード130bの1行目に示すコード「dt:」を出力する。かかるコードは、図2に示すデシジョンテーブル130aの−1行目、−1列目のコードに対応する。   As illustrated in FIG. 6, the source code generation unit 140b outputs a code that is a destination of recursion at the end (step S101). In step S101, for example, the source code generation unit 140b outputs the code “dt:” shown in the first line of the source code 130b shown in FIG. Such a code corresponds to the code of the -1st row and the -1th column of the decision table 130a shown in FIG.

ソースコード生成部140bは、列の終わりであるか否かを判定する(ステップS102)。図2に示すデシジョンテーブル130aを例にすると、列の終わりは、14行目に対応する。   The source code generation unit 140b determines whether it is the end of the sequence (step S102). Taking the decision table 130a shown in FIG. 2 as an example, the end of the column corresponds to the 14th row.

ソースコード生成部140bは、列の終わりである場合には(ステップS102,Yes)、処理を終了する。一方、列の終わりではない場合には(ステップS102,No)、行の終わりか否かを判定する(ステップS103)。図2に示すデシジョンテーブル130aを例にすると、行の終わりは、18行目に対応する。   The source code generation unit 140b ends the process when it is the end of the column (step S102, Yes). On the other hand, if it is not the end of the column (step S102, No), it is determined whether or not it is the end of the row (step S103). Taking the decision table 130a shown in FIG. 2 as an example, the end of the line corresponds to the 18th line.

ソースコード生成部140bは、行の終わりである場合には(ステップS103,Yes)、行を1つ戻す(ステップS104)。ソースコード生成部140bは、閉じ括弧出力処理を実行する(ステップS105)。   When it is the end of the line (step S103, Yes), the source code generation unit 140b returns one line (step S104). The source code generation unit 140b executes a closing bracket output process (step S105).

ソースコード生成部140bは、列を1つ進め(ステップS106)、行を0行目に戻す(ステップS107)。ソースコード生成部140bは、インデントを0に戻し(ステップS108)、ステップS102に移行する。ここで、インデントは、ソースコード130b上の位置を示すものである。インデントを0に戻すとは、ソースコード130bのインデントの位置を、左端によせることを意味する。   The source code generation unit 140b advances the column by 1 (step S106) and returns the row to the 0th row (step S107). The source code generation unit 140b returns the indent to 0 (step S108), and proceeds to step S102. Here, the indent indicates a position on the source code 130b. Returning the indent to 0 means that the position of the indent of the source code 130b is at the left end.

ソースコード生成部140bは、行の終わりでない場合に(ステップS103,No)、左端の列であるか否かを判定する(ステップS109)。デシジョンテーブル130aの左端の列は、0列目に対応する。   If it is not the end of the line (step S103, No), the source code generation unit 140b determines whether the column is the leftmost column (step S109). The leftmost column of the decision table 130a corresponds to the 0th column.

ソースコード生成部140bは、左端の列ではない場合には(ステップS109,No)、図7のステップS118に移行する。一方、ソースコード生成部140bは、左端の列である場合には(ステップS109,Yes)、セルがyであるか否かを判定する(ステップS110)。   If the source code generation unit 140b is not the leftmost column (step S109, No), the source code generation unit 140b proceeds to step S118 in FIG. On the other hand, when it is the leftmost column (step S109, Yes), the source code generation unit 140b determines whether the cell is y (step S110).

ソースコード生成部140bは、セルがyである場合には(ステップS110,Yes)、”if”と、現在のセルの行に対応する条件記述領域の文字とを出力する(ステップS111)。例えば、図2のデシジョンテーブ130aの0行目、0列目のセルはyである。現在のセルが0行目、0列目のセルである場合には、ソースコード生成部140bは、図4の2行目に示すように「if(t[-1][i]==""){」を出力する。   When the cell is y (step S110, Yes), the source code generation unit 140b outputs “if” and the character in the condition description area corresponding to the row of the current cell (step S111). For example, the cell in the 0th row and the 0th column of the decision table 130a in FIG. 2 is y. When the current cell is the cell in the 0th row and the 0th column, the source code generation unit 140b performs “if (t [-1] [i] ==” as shown in the second row in FIG. ") {" Is output.

ソースコード生成部140bは、インデントを1つ進める(ステップS112)。インデントを1つ進めることは、ソースコード上のインデントを右側に1つ進めることを意味する。ソースコード生成部140bは、行を1つ進め(ステップS113)、ステップS102に移行する。   The source code generation unit 140b advances the indent by one (step S112). To advance the indent by one means to advance the indent on the source code by one to the right. The source code generation unit 140b advances one line (step S113), and proceeds to step S102.

ソースコード生成部140bは、セルがyではない場合には(ステップS110,No)、セルがnであるか否かを判定する(ステップS114)。ソースコード生成部140bは、セルがnである場合には(ステップS114,Yes)、”else”を出力し(ステップS115)、ステップS112に移行する。例えば、図2のデジションテーブル130aの0行目、1列目のセルはnである。現在のセルが0行目、1列目のセルである場合には、ソースコード生成部140bは、図4の2行目に示す「}else{」を出力する。   If the cell is not y (step S110, No), the source code generation unit 140b determines whether the cell is n (step S114). When the number of cells is n (Yes at Step S114), the source code generation unit 140b outputs “else” (Step S115), and proceeds to Step S112. For example, the cell in the 0th row and the 1st column of the decision table 130a in FIG. When the current cell is the cell in the 0th row and the 1st column, the source code generation unit 140b outputs “} else {” shown in the second row in FIG.

ソースコード生成部140bは、セルがnではない場合には(ステップS114,No)、セルがxであるか否かを判定する(ステップS116)。ソースコード生成部140bは、セルがxである場合には(ステップS116,Yes)、末尾再帰判定処理を実行し(ステップS117)、ステップS113に移行する。一方、ソースコード生成部140bは、セルがxではない場合には(ステップS116,No)、ステップS113に移行する。   When the cell is not n (step S114, No), the source code generation unit 140b determines whether the cell is x (step S116). If the cell is x (step S116, Yes), the source code generation unit 140b executes tail recursion determination processing (step S117), and proceeds to step S113. On the other hand, when the cell is not x (step S116, No), the source code generation unit 140b proceeds to step S113.

図7の説明に移行する。ソースコード生成部140bは、現在のセルの情報が、左隣のセルの情報と同じか否かを判定する(ステップS118)。例えば、図2のデシジョンテーブル130aの0行目、2列目のセルの情報は、左隣のセルの情報と同じである。   Shifting to the description of FIG. The source code generation unit 140b determines whether the information on the current cell is the same as the information on the left adjacent cell (step S118). For example, the information of the cell in the 0th row and the 2nd column of the decision table 130a in FIG. 2 is the same as the information of the cell on the left side.

ソースコード生成部140bは、左隣のセルの情報と同じ場合には(ステップS118,Yes)、セルがyであるか否かを判定する(ステップS119)。ソースコード生成部140bは、セルがyである場合には(ステップS119,Yes)、インデントを1つ進める(ステップS120)。ソースコード生成部140bは、行を1つ進め(ステップS121)、図6のステップS102に移行する。   When the source code generation unit 140b is the same as the information on the left adjacent cell (step S118, Yes), the source code generation unit 140b determines whether the cell is y (step S119). When the cell is y (step S119, Yes), the source code generation unit 140b advances the indent by one (step S120). The source code generation unit 140b advances one line (step S121), and proceeds to step S102 in FIG.

一方、ソースコード生成部140bは、セルがyではない場合には(ステップS119,No)、セルがnであるか否かを判定する(ステップS122)。ソースコード生成部140bは、セルがnである場合には(ステップS122,Yes)、ステップS120に移行する。   On the other hand, when the cell is not y (step S119, No), the source code generation unit 140b determines whether the cell is n (step S122). If the number of cells is n (step S122, Yes), the source code generation unit 140b proceeds to step S120.

一方、ソースコード生成部140bは、セルがnではない場合には(ステップS122,No)、セルがxであるか否かを判定する(ステップS123)。ソースコード生成部140bは、セルがxではない場合には(ステップS123,No)、ステップS121に移行する。   On the other hand, if the cell is not n (step S122, No), the source code generation unit 140b determines whether the cell is x (step S123). When the cell is not x (step S123, No), the source code generation unit 140b proceeds to step S121.

一方、ソースコード生成部140bは、セルがxである場合には(ステップS123,Yes)、末尾再帰判定処理を実行し(ステップS124)、ステップS121に移行する。   On the other hand, when the cell is x (step S123, Yes), the source code generation unit 140b executes tail recursion determination processing (step S124), and proceeds to step S121.

図7のステップS118の説明に戻る。ソースコード生成部140bは、左隣のセルの情報と異なる場合には(ステップS118,No)、セルがyであるか否かを判定する(ステップS125)。   Returning to the description of step S118 in FIG. If the source code generation unit 140b is different from the information of the cell on the left (No at Step S118), the source code generation unit 140b determines whether the cell is y (Step S125).

ソースコード生成部140bは、セルがyである場合には(ステップS125,Yes)、”if”と、現在のセルの行に対応する条件記述領域の文字とを出力する(ステップS126)。ソースコード生成部140bは、インデントを1つ進め(ステップS127)、ステップS121に移行する。   If the cell is y (step S125, Yes), the source code generation unit 140b outputs “if” and the character in the condition description area corresponding to the current cell row (step S126). The source code generation unit 140b advances the indent by one (step S127), and proceeds to step S121.

一方、ソースコード生成部140bは、セルがyではない場合には(ステップS125,No)、セルがnであるか否かを判定する(ステップS128)。ソースコード生成部140bは、セルがnである場合には(ステップS128,Yes)、”else”を出力し(ステップS129)、ステップS127に移行する。   On the other hand, when the cell is not y (step S125, No), the source code generation unit 140b determines whether the cell is n (step S128). When the number of cells is n (Yes at Step S128), the source code generation unit 140b outputs “else” (Step S129), and proceeds to Step S127.

一方、ソースコード生成部140bは、セルがnではない場合には(ステップS128,No)、セルがxであるか否かを判定する(ステップS130)。ソースコード生成部140bは、セルがxではない場合には(ステップS130,No)、ステップS121に移行する。   On the other hand, when the cell is not n (step S128, No), the source code generation unit 140b determines whether the cell is x (step S130). If the cell is not x (step S130, No), the source code generation unit 140b proceeds to step S121.

一方、ソースコード生成部140bは、セルがxである場合は(ステップS130,Yes)、現在のセルの行に対応する動作記述領域の文字を出力し(ステップS131)、ステップS121に移行する。例えば、図2のデシジョンテーブル130aの12行目、1列目のセルはnである。現在のセルが12行目、1列目のセルである場合には、図4の5行目に示すように、「i--;」を出力する。   On the other hand, when the cell is x (step S130, Yes), the source code generation unit 140b outputs the characters in the behavior description area corresponding to the current cell row (step S131), and proceeds to step S121. For example, the cell in the 12th row and the 1st column of the decision table 130a in FIG. 2 is n. If the current cell is the cell in the 12th row and the 1st column, "i--;" is output as shown in the 5th row in FIG.

次に、図6のステップS105に示した閉じ括弧出力処理について説明する。閉じ括弧出力処理は、「}」を条件に応じて出力する処理である。図8は、閉じ括弧出力処理の処理手順を示すフローチャートである。   Next, the closing parenthesis output process shown in step S105 of FIG. 6 will be described. The closing bracket output process is a process of outputting “}” according to a condition. FIG. 8 is a flowchart showing a processing procedure of the closing bracket output process.

図8に示すように、ソースコード生成部140bは、行が先頭であるか否かを判定する(ステップS151)。図2のデシジョンテーブル130aを例にすると、行の先頭は、0行目に対応する。   As shown in FIG. 8, the source code generation unit 140b determines whether or not the line is the head (step S151). Taking the decision table 130a of FIG. 2 as an example, the top of the line corresponds to the 0th line.

ソースコード生成部140bは、行が先頭ではない場合には(ステップS151,No)、閉じ括弧出力処理を終了する。   When the line is not at the head (No at Step S151), the source code generation unit 140b ends the closing bracket output process.

ソースコード生成部140bは、行が先頭である場合には(ステップS151,Yes)、セルがyであるか否かを判定する(ステップS152)。ソースコード生成部140bは、セルがyである場合には(ステップS152,Yes)、閉じ括弧出力処理を終了する。   When the line is at the head (Yes in step S151), the source code generation unit 140b determines whether the cell is y (step S152). When the cell is y (step S152, Yes), the source code generation unit 140b ends the closing bracket output process.

ソースコード生成部140bは、セルがyでない場合には(ステップS152,No)、セルがnであるか否かを判定する(ステップS153)。ソースコード生成部140bは、セルがnである場合には(ステップS153,Yes)、インデントを1つ戻す(ステップS154)。インデントを1つ戻すことは、ソースコード上のインデントを左側に1つ戻すことを意味する。   If the cell is not y (step S152, No), the source code generation unit 140b determines whether the cell is n (step S153). If the number of cells is n (step S153, Yes), the source code generation unit 140b returns one indent (step S154). Returning one indent means returning one indent on the source code to the left.

ソースコード生成部140bは、”}”を出力し(ステップS155)、行を1つ進め(ステップS156)、ステップS151に移行する。   The source code generation unit 140b outputs “}” (step S155), advances one line (step S156), and proceeds to step S151.

一方、ソースコード生成部140bは、セルがnでない場合には(ステップS153,No)、行を1つ戻し(ステップS157)、ステップS151に移行する。   On the other hand, when the cell is not n (step S153, No), the source code generation unit 140b returns one row (step S157), and proceeds to step S151.

次に、図6および図7のステップS117、S124に示した末尾再帰判定処理について説明する。実施例1の末尾再帰判定処理は、デシジョンテーブル130aの末尾の行で再帰の動作を行う情報が指定されたセルを検出した場合に、繰り返しを実行するコード「goto文」を出力する処理である。図9は、本実施例1に係る末尾再帰判定処理の処理手順を示すフローチャートである。   Next, the tail recursion determination process shown in steps S117 and S124 of FIGS. 6 and 7 will be described. The tail recursion determination process according to the first embodiment is a process for outputting a code “goto statement” for performing repetition when a cell in which information for performing recursion is specified in the last row of the decision table 130a is detected. . FIG. 9 is a flowchart of the process procedure of the tail recursion determination process according to the first embodiment.

図9に示すように、ソースコード生成部140bは、現在のセルの行が末尾であるか否かを判定する(ステップS181)。図2に示すデシジョンテーブル130aを例にすると、末尾となる行は、17行目となる。   As illustrated in FIG. 9, the source code generation unit 140b determines whether or not the current cell row is the end (step S181). Taking the decision table 130a shown in FIG. 2 as an example, the last line is the 17th line.

ソースコード生成部140bは、現在のセルの行が末尾である場合には(ステップS181,Yes)、現在のセルの行に対応する動作記述領域の動作が再帰であるか否かを判定する(ステップS182)。   If the current cell row is at the end (Yes in step S181), the source code generation unit 140b determines whether or not the operation in the behavior description area corresponding to the current cell row is recursive ( Step S182).

ステップS182において、ソースコード生成部140bが再帰であるか否かを判定する処理の一例について説明する。ソースコード生成部140bは、現在のセルの行に対応する動作記述領域の動作を示す文字列に対して構文解析を実行する。ソースコード生成部140bは、構文解析した文字列と、デシジョンテーブル130aの−1行目−1列目の文字列とが等しい場合に、再帰の動作であると判定する。   An example of processing for determining whether or not the source code generation unit 140b is recursive in step S182 will be described. The source code generation unit 140b performs syntax analysis on the character string indicating the operation in the operation description area corresponding to the current cell row. The source code generation unit 140b determines that the operation is a recursive operation when the parsed character string is equal to the character string in the -1st row and the 1st column of the decision table 130a.

例えば、デシジョンテーブル130aの17行目の文字列「dt()」と、デシジョンテーブル130aの−1行目−列の文字列「dt()」とは等しい文字である。このため、デシジョンテーブル130aの17行目の文字列「dt()」の動作は、再帰を示す。   For example, the character string “dt ()” on the 17th line of the decision table 130a and the character string “dt ()” on the −1st line−column of the decision table 130a are the same character. Therefore, the operation of the character string “dt ()” on the 17th line of the decision table 130a indicates recursion.

なお、ソースコード生成部140bは、その他の如何なる従来技術を利用して、動作が再帰であるか否かを判定しても良い。例えば、該当する動作にcall文などが付与され、デシジョンテーブルを呼び出している場合にも、再帰の動作であると判定しても良い。   The source code generation unit 140b may determine whether the operation is recursive using any other conventional technique. For example, even when a call statement or the like is given to the corresponding operation and a decision table is called, it may be determined that the operation is a recursive operation.

図9のステップS182の説明に戻る。ソースコード生成部140bは、再帰である場合には(ステップS182,Yes)、goto文を出力し(ステップS183)、末尾再帰判定処理を終了する。   Returning to the description of step S182 in FIG. If it is recursive (Yes in step S182), the source code generating unit 140b outputs a goto statement (step S183), and ends the tail recursive determination process.

例えば、図2のデシジョンテーブル130aにおいて、17行目1列目のセルは、該当する行が末尾であり、行に対応する動作が再帰「dt()」である。このため、ソースコード生成部140bは、現在のセルがデシジョンテーブル130aの17行目1列目の場合には、図4の10行目に示すように「goto dt;」を出力する。   For example, in the decision table 130a of FIG. 2, the cell in the 17th row and the first column has the corresponding row at the end, and the operation corresponding to the row is recursion “dt ()”. Therefore, when the current cell is the 17th row and the 1st column of the decision table 130a, the source code generation unit 140b outputs “goto dt;” as shown in the 10th row of FIG.

ところで、ソースコード生成部140bは、ステップS181において、現在のセルの行が末尾ではない場合には(ステップS181,No)、動作記述領域の文字を出力し(ステップS184)、末尾再帰判定処理を終了する。   By the way, when the current cell row is not the end in step S181 (step S181, No), the source code generation unit 140b outputs the character in the operation description area (step S184), and performs the end recursion determination process. finish.

また、ソースコード生成部140bは、ステップS182において、再帰でない場合には(ステップS182,No)、ステップS184に移行する。   If the source code generation unit 140b is not recursive in step S182 (step S182, No), the source code generation unit 140b proceeds to step S184.

次に、本実施例1に係るソースコード生成装置100の効果について説明する。ソースコード生成装置100は、デシジョンテーブル130aからソースコード130bを生成する場合において、デシジョンテーブル130aのセルを順次走査して、デシジョンテーブル130aの末尾の行で再帰の動作を行う情報が指定されたセルを検出する。ソースコード生成装置100は、再帰の検出結果を基にして、繰り返しを実行するコードを出力する。このような処理を、ソースコード生成装置100が実行することで、繰り返しの動作を含むデシジョンテーブル130aをソースコード130bに変換することができる。   Next, effects of the source code generation device 100 according to the first embodiment will be described. When the source code generation device 100 generates the source code 130b from the decision table 130a, the cell that sequentially scans the cells of the decision table 130a and the information that performs the recursive operation in the last row of the decision table 130a is designated. Is detected. The source code generation device 100 outputs a code for executing repetition based on the recursion detection result. By executing such processing by the source code generation device 100, the decision table 130a including repeated operations can be converted into the source code 130b.

上記の実施例1のソースコード生成装置100は、デシジョンテーブル130aからC、C++等に対応するソースコード130bを生成した。実施例2のソースコード生成装置200は、Java(登録商標)等に対応するソースコードを生成する。   The source code generation device 100 according to the first embodiment generates the source code 130b corresponding to C, C ++, and the like from the decision table 130a. The source code generation device 200 according to the second embodiment generates a source code corresponding to Java (registered trademark) or the like.

本実施例2に係るソースコード生成装置について説明する。図10は、本実施例2に係るソースコード生成装置の構成を示す機能ブロック図である。図10に示すように、ソースコード生成装置200は、入力部210、表示部220、記憶部230、制御部240を有する。入力部210、表示部220に関する説明は、図1に示した入力部110、表示部120に関する説明と同様である。   A source code generation apparatus according to the second embodiment will be described. FIG. 10 is a functional block diagram illustrating the configuration of the source code generation device according to the second embodiment. As illustrated in FIG. 10, the source code generation device 200 includes an input unit 210, a display unit 220, a storage unit 230, and a control unit 240. The description about the input unit 210 and the display unit 220 is the same as the description about the input unit 110 and the display unit 120 shown in FIG.

記憶部230は、デシジョンテーブル230aおよびソースコード230bを記憶する。記憶部230は、例えば、RAM、ROM、フラッシュメモリなどの半導体メモリ素子、またはハードディスク、光ディスクなどの記憶装置に対応する。   The storage unit 230 stores a decision table 230a and source code 230b. The storage unit 230 corresponds to, for example, a semiconductor memory device such as a RAM, a ROM, or a flash memory, or a storage device such as a hard disk or an optical disk.

デシジョンテーブル230aは、どのような条件の場合に、どのような動作を行うのかを定義するテーブルである。デシジョンテーブル230aのデータ構造は、図2に示すものと同様である。   The decision table 230a is a table that defines what kind of operation is performed under what conditions. The data structure of the decision table 230a is the same as that shown in FIG.

ソースコード230bは、デシジョンテーブル230aに定義された各条件による動作をコンピュータに実行させるためのソースコードである。図11は、本実施例2に係るソースコードのデータ構造の一例を示す図である。デシジョンテーブル230aから図11の1行目から72行目までのソースコードが生成される。   The source code 230b is source code for causing a computer to execute an operation according to each condition defined in the decision table 230a. FIG. 11 is a diagram illustrating an example of the data structure of the source code according to the second embodiment. Source codes from the first line to the 72nd line in FIG. 11 are generated from the decision table 230a.

制御部240は、管理部240a、ソースコード生成部240bを有する。制御部240は、例えば、ASICや、FPGAなどの集積装置に対応する。また、制御部240は、例えば、CPUやMPU等の電子回路に対応する。   The control unit 240 includes a management unit 240a and a source code generation unit 240b. The control unit 240 corresponds to, for example, an integrated device such as an ASIC or FPGA. Moreover, the control part 240 respond | corresponds to electronic circuits, such as CPU and MPU, for example.

管理部240aに関する説明は、実施例1に示した管理部140aに関する説明と同様である。   The description regarding the management unit 240a is the same as the description regarding the management unit 140a illustrated in the first embodiment.

ソースコード生成部240bは、デシジョンテーブル230aを基にして、ソースコード230bを生成する処理部である。ソースコード生成部240bは、設定部241、再帰検出部242、変更部243、出力部244を有する。   The source code generation unit 240b is a processing unit that generates the source code 230b based on the decision table 230a. The source code generation unit 240b includes a setting unit 241, a recursion detection unit 242, a change unit 243, and an output unit 244.

設定部241は、デジションテーブル230aからソースコード230bを生成する段階で、初期設定を行う処理部である。設定部241は、デシジョンテーブル230aにbreak文の行を追加する処理と、ソースコード230bに無限ループのコードを出力する処理を実行する。   The setting unit 241 is a processing unit that performs initial setting at the stage of generating the source code 230b from the decision table 230a. The setting unit 241 executes processing for adding a break statement line to the decision table 230a and processing for outputting an infinite loop code to the source code 230b.

設定部241が、デシジョンテーブル230aにbreak文の行を追加する処理について説明する。設定部241は、デシジョンテーブル230aの行の終わりに対応する動作記述領域に「break」を設定する。break文は、無限ループを中断するための動作である。また、設定部241は、デシジョンテーブル230aの行の終わりに対応する動作指定領域に「x」を設定する。   A process in which the setting unit 241 adds a break statement line to the decision table 230a will be described. The setting unit 241 sets “break” in the behavior description area corresponding to the end of the line of the decision table 230a. The break statement is an operation for interrupting the infinite loop. In addition, the setting unit 241 sets “x” in the operation designation area corresponding to the end of the line of the decision table 230a.

図12は、break文の行を追加したデシジョンテーブルのデータ構造の一例を示す図である。図12に示すように、デシジョンテーブル230aの18行目の動作記述領域に「break」が設定される。また、デシジョンテーブル230aの18行目の1列目から14列目まで「x」が設定される。   FIG. 12 is a diagram illustrating an example of a data structure of a decision table to which a break statement line is added. As shown in FIG. 12, “break” is set in the action description area on the 18th line of the decision table 230a. In addition, “x” is set from the first column to the 14th column of the 18th row of the decision table 230a.

再帰検出部242は、デシジョンテーブル230aのセルを0行目0列目から順次走査して、デシジョンテーブル230aの末尾の行で再帰の動作を行う情報が指定されたセルを検出する処理部である。なお、本実施例2では、図12に示すデシジョンテーブル230aの17行目を、末尾とする。   The recursion detection unit 242 is a processing unit that sequentially scans cells of the decision table 230a from the 0th row and the 0th column, and detects cells in which information for performing recursion is specified in the last row of the decision table 230a. . In the second embodiment, the 17th line of the decision table 230a shown in FIG.

変更部243は、再帰検出部242の検出結果を基にして、break文が設定された行に対応する動作指定領域のセルの情報を、breakの動作を実行しない旨の情報に変更する。例えば、変更部243は、再帰検出部242の検出結果を基にして、該当するセルから「x」を削除する。   Based on the detection result of the recursion detection unit 242, the change unit 243 changes the cell information in the operation designation area corresponding to the row in which the break statement is set to information indicating that the break operation is not executed. For example, the changing unit 243 deletes “x” from the corresponding cell based on the detection result of the recursive detection unit 242.

出力部244は、デシジョンテーブルのセルを順次走査し、動作記述領域の動作を実行する旨の情報がセルに含まれている場合には、該セルの行に対応する動作を出力する。   The output unit 244 sequentially scans the cells of the decision table, and outputs information corresponding to the row of the cell when information indicating that the operation in the operation description area is executed is included in the cell.

ここで、ソースコード生成部240bに含まれる設定部241、再帰検出部242、変更部243、出力部244が協働して、デシジョンテーブル230aからソースコード230bを生成する処理手順について具体的に説明する。図13および図14は、本実施例2に係るソースコード生成部の処理手順を示すフローチャートである。ソースコード生成部240bは、デシジョンテーブル230aの0行0列のセルから、走査を開始する。   Here, a processing procedure for generating the source code 230b from the decision table 230a in cooperation with the setting unit 241, the recursion detection unit 242, the changing unit 243, and the output unit 244 included in the source code generation unit 240b will be specifically described. To do. 13 and 14 are flowcharts illustrating a processing procedure of the source code generation unit according to the second embodiment. The source code generation unit 240b starts scanning from the cell at row 0 and column 0 of the decision table 230a.

図13に示すように、ソースコード生成部240bは、無限ループのコードを出力する(ステップS201)。ステップS201において、例えば、ソースコード生成部240bは、図11の1行目に示す「for(;;){」と、72行目に示す「}」を無限ループのコードとして出力する。   As illustrated in FIG. 13, the source code generation unit 240b outputs an infinite loop code (step S201). In step S201, for example, the source code generation unit 240b outputs “for (;;) {” shown in the first line of FIG. 11 and “}” shown in the 72nd line as an infinite loop code.

ソースコード生成部240bは、動作記述領域にbreakを設定し、該当する動作指定領域を全て「x」に設定する(ステップS202)。ソースコード生成部240bは、列の終わりであるか否かを判定する(ステップS203)。図12に示すデシジョンテーブル230aを例にすると、列の終わりは、14行目に対応する。   The source code generation unit 240b sets break in the behavior description area and sets all corresponding action designation areas to “x” (step S202). The source code generation unit 240b determines whether it is the end of the sequence (step S203). Taking the decision table 230a shown in FIG. 12 as an example, the end of the column corresponds to the 14th row.

ソースコード生成部240bは、列の終わりである場合には(ステップS203,Yes)、処理を終了する。一方、列の終わりではない場合には(ステップS203,No)、行の終わりか否かを判定する(ステップS204)。図12に示すデシジョンテーブル230aを例にすると、行の終わりは、19行目に対応する。   The source code generation unit 240b ends the process when it is the end of the column (step S203, Yes). On the other hand, if it is not the end of the column (step S203, No), it is determined whether or not it is the end of the row (step S204). Taking the decision table 230a shown in FIG. 12 as an example, the end of the line corresponds to the 19th line.

ソースコード生成部240bは、行の終わりである場合には(ステップS204,Yes)、行を1つ戻し(ステップS205)、閉じ括弧出力処理を実行する(ステップS206)。ソースコード生成部240bは、列を1つ進め(ステップS207)、行を0に戻す(ステップS208)。ソースコード生成部240bは、インデントを0に戻し(ステップS209)、ステップS203に移行する。   When it is the end of the line (step S204, Yes), the source code generation unit 240b returns one line (step S205) and executes the closing parenthesis output process (step S206). The source code generation unit 240b advances the column by 1 (step S207) and returns the row to 0 (step S208). The source code generation unit 240b returns the indent to 0 (step S209), and proceeds to step S203.

一方、ソースコード生成部240bは、行の終わりではない場合には(ステップS204,No)、左端の列であるか否かを判定する(ステップS210)。ソースコード生成部240bは、左端の列ではない場合には(ステップS210,No)、図14のステップS219に移行する。   On the other hand, when it is not the end of the line (step S204, No), the source code generation unit 240b determines whether the column is the leftmost column (step S210). If the source code generation unit 240b is not the leftmost column (step S210, No), the source code generation unit 240b proceeds to step S219 in FIG.

一方、ソースコード生成部240bは、左端の列である場合には(ステップS210,Yes)、セルがyであるか否かを判定する(ステップS211)。ソースコード生成部240bは、セルがyである場合には(ステップS211,Yes)、”if”と、現在のセルの行に対応する条件記述領域の文字とを出力する(ステップS212)。   On the other hand, if the source code generation unit 240b is the leftmost column (step S210, Yes), the source code generation unit 240b determines whether the cell is y (step S211). When the cell is y (step S211, Yes), the source code generation unit 240b outputs “if” and the character in the condition description area corresponding to the row of the current cell (step S212).

ソースコード生成部240bは、インデントを1つ進める(ステップS213)。インデントを1つ進めることは、ソースコード上のインデントを右側に1つ進めることを意味する。ソースコード生成部240bは、行を1つ進め(ステップS214)、ステップS203に移行する。   The source code generation unit 240b advances the indent by one (step S213). To advance the indent by one means to advance the indent on the source code by one to the right. The source code generation unit 240b advances one line (step S214), and proceeds to step S203.

ソースコード生成部240bは、セルがyではない場合には(ステップS211,No)、セルがnであるか否かを判定する(ステップS215)。ソースコード生成部240bは、セルがnである場合には(ステップS215,Yes)、”else”を出力し(ステップS216)、ステップS213に移行する。   If the cell is not y (step S211, No), the source code generation unit 240b determines whether the cell is n (step S215). If the cell is n (step S215, Yes), the source code generation unit 240b outputs “else” (step S216), and proceeds to step S213.

ソースコード生成部240bは、セルがnではない場合には(ステップS215,No)、セルがxであるか否かを判定する(ステップS217)。ソースコード生成部240bは、セルがxである場合には(ステップS217,Yes)、末尾再帰判定処理を実行し(ステップS218)、ステップS214に移行する。一方、ソースコード生成部240bは、セルがxではない場合には(ステップS217,No)、ステップS214に移行する。   If the cell is not n (step S215, No), the source code generation unit 240b determines whether the cell is x (step S217). When the cell is x (step S217, Yes), the source code generation unit 240b executes tail recursion determination processing (step S218), and proceeds to step S214. On the other hand, when the cell is not x (No in step S217), the source code generation unit 240b proceeds to step S214.

図14の説明に移行する。ソースコード生成部240bは、現在のセルの情報が、左隣のセルの情報と同じか否かを判定する(ステップS219)。例えば、図12のデシジョンテーブル230aの0行目、2列目のセルの情報は、左隣のセルの情報と同じである。   The description shifts to the description of FIG. The source code generation unit 240b determines whether the information on the current cell is the same as the information on the left adjacent cell (step S219). For example, the information of the cell in the 0th row and the 2nd column of the decision table 230a in FIG. 12 is the same as the information of the cell on the left.

ソースコード生成部240bは、左隣のセルの情報と同じ場合には(ステップS219,Yes)、セルがyであるか否かを判定する(ステップS220)。ソースコード生成部240bは、セルがyである場合には(ステップS220,Yes)、インデントを1つ進める(ステップS221)。ソースコード生成部240bは、行を1つ進め(ステップS222)、図13のステップS203に移行する。   When the information is the same as the information on the left adjacent cell (step S219, Yes), the source code generating unit 240b determines whether the cell is y (step S220). If the cell is y (step S220, Yes), the source code generation unit 240b advances the indent by one (step S221). The source code generation unit 240b advances one line (step S222), and proceeds to step S203 in FIG.

一方、ソースコード生成部240bは、セルがyではない場合には(ステップS220,No)、セルがnであるか否かを判定する(ステップS223)。ソースコード生成部240bは、セルがnである場合には(ステップS223,Yes)、ステップS221に移行する。   On the other hand, when the cell is not y (step S220, No), the source code generation unit 240b determines whether the cell is n (step S223). If the number of cells is n (step S223, Yes), the source code generation unit 240b proceeds to step S221.

一方、ソースコード生成部240bは、セルがnではない場合には(ステップS223,No)、セルがxであるか否かを判定する(ステップS224)。ソースコード生成部240bは、セルがxではない場合には(ステップS224,No)、ステップS222に移行する。   On the other hand, if the cell is not n (step S223, No), the source code generation unit 240b determines whether the cell is x (step S224). If the cell is not x (step S224, No), the source code generation unit 240b proceeds to step S222.

一方、ソースコード生成部240bは、セルがxである場合には(ステップS224,Yes)、末尾再帰判定処理を実行し(ステップS225)、ステップS222に移行する。   On the other hand, when the cell is x (step S224, Yes), the source code generation unit 240b executes tail recursion determination processing (step S225), and proceeds to step S222.

図14のステップS219の説明に戻る。ソースコード生成部240bは、左隣のセルの情報と異なる場合には(ステップS219,No)、セルがyであるか否かを判定する(ステップS226)。   Returning to the description of step S219 in FIG. When the source code generation unit 240b is different from the information of the cell on the left (No at Step S219), the source code generation unit 240b determines whether the cell is y (Step S226).

ソースコード生成部240bは、セルがyである場合には(ステップS226,Yes)、”if”と、現在のセルの行に対応する条件記述領域の文字とを出力する(ステップS227)。ソースコード生成部240bは、インデントを1つ進め(ステップS228)、ステップS222に移行する。   When the cell is y (step S226, Yes), the source code generation unit 240b outputs “if” and the character in the condition description area corresponding to the row of the current cell (step S227). The source code generation unit 240b advances the indent by one (step S228), and proceeds to step S222.

一方、ソースコード生成部240bは、セルがyではない場合には(ステップS226,No)、セルがnであるか否かを判定する(ステップS229)。ソースコード生成部240bは、セルがnである場合には(ステップS229,Yes)、”else”を出力し(ステップS230)、ステップS228に移行する。   On the other hand, when the cell is not y (step S226, No), the source code generation unit 240b determines whether the cell is n (step S229). When the number of cells is n (step S229, Yes), the source code generation unit 240b outputs “else” (step S230), and proceeds to step S228.

一方、ソースコード生成部240bは、セルがnではない場合には(ステップS229,No)、セルがxであるか否かを判定する(ステップS231)。ソースコード生成部240bは、セルがxではない場合には(ステップS231,No)、ステップS222に移行する。   On the other hand, when the cell is not n (No at Step S229), the source code generation unit 240b determines whether the cell is x (Step S231). If the cell is not x (step S231, No), the source code generation unit 240b proceeds to step S222.

一方、ソースコード生成部240bは、セルがxである場合は(ステップS231,Yes)、現在のセルの行に対応する動作記述領域の文字を出力し(ステップS232)、ステップS222に移行する。   On the other hand, when the cell is x (step S231, Yes), the source code generation unit 240b outputs the characters in the behavior description area corresponding to the current cell row (step S232), and proceeds to step S222.

ここで、図13のステップS206に示した閉じ括弧出力処理は、図8で説明した閉じ括弧出力処理と同様である。   Here, the closing bracket output process shown in step S206 of FIG. 13 is the same as the closing bracket output process described in FIG.

次に、図13および図14のステップS218、S225に示した末尾再帰判定処理について説明する。図15は、本実施例2に係る末尾再帰判定処理の処理手順を示すフローチャートである。実施例2の末尾再帰判定処理は、デシジョンテーブル230aの末尾の行で再帰の動作を行う情報が指定されたセルを検出した場合に、break文が設定された行に対応する動作指定領域のセルの情報を、breakの動作を実行しない旨の情報に変更することで、再帰動作を実行可能とする。なお、上記のように、実施例2では、図12のデシジョンテーブル230aにおいて、末尾の行を17行目とする。   Next, the tail recursion determination process shown in steps S218 and S225 of FIGS. 13 and 14 will be described. FIG. 15 is a flowchart of the process procedure of the tail recursion determination process according to the second embodiment. In the end recursion determination process according to the second embodiment, when a cell in which information for performing recursion is specified in the last row of the decision table 230a is detected, a cell in the operation specification area corresponding to the row in which the break statement is set Is changed to information indicating that the operation of the break is not executed, so that the recursive operation can be executed. As described above, in the second embodiment, the last line is the 17th line in the decision table 230a of FIG.

図15に示すように、ソースコード生成部240bは、現在のセルの行が末尾であるか否かを判定する(ステップS241)。ソースコード生成部240bは、現在のセルの行が末尾である場合には(ステップS241,Yes)、現在のセルの行に対応する動作記述領域の動作が再帰であるか否かを判定する(ステップS242)。   As illustrated in FIG. 15, the source code generation unit 240b determines whether or not the row of the current cell is the end (step S241). If the current cell row is the end (Yes in step S241), the source code generation unit 240b determines whether or not the operation in the behavior description area corresponding to the current cell row is recursive ( Step S242).

ソースコード生成部240bは、再帰である場合には(ステップS242,Yes)、breakの行の該当するxを空白に設定し(ステップS243)、末尾再帰判定処理を終了する。   In the case of recursion (Yes in step S242), the source code generation unit 240b sets the corresponding x in the break line to blank (step S243), and ends the end recursion determination process.

例えば、ソースコード生成部240bは、ステップS242において、現在のセルが17行目1列目で、再帰動作と判定された場合には、18行目1列目のセルに設定された「x」を空白に設定する。また、ソースコード生成部240bは、現在のセルが17行目2列目で、再帰動作と判定された場合には、18行目2列目のセルに設定された「x」を空白に設定する。他の場合も同様にして、ソースコード生成部240bは、xを空白に設定する。このように、再帰を検出した場合に、breakの行のxを空白に設定することで、ソースコードにbreak文が出力されなくなり、ソースコード上で繰り返しを表現できる。   For example, if it is determined in step S242 that the current cell is in the 17th row and the first column and the recursive operation is determined in step S242, the source code generation unit 240b sets “x” set in the cell in the 18th row and the first column. Set to blank. Also, the source code generation unit 240b sets “x” set in the cell in the 18th row and the 2nd column to be blank when the current cell is in the 17th row and the 2nd column and the recursive operation is determined. To do. Similarly, in other cases, the source code generation unit 240b sets x to be blank. As described above, when recursion is detected, by setting x in the break line to blank, the break sentence is not output to the source code, and repetition can be expressed in the source code.

図15の説明に戻る。ソースコード生成部240bは、ステップS241において、現在のセルの行が末尾ではない場合には(ステップS241,No)、動作記述領域の文字を出力し(ステップS244)、末尾再帰判定処理を終了する。   Returning to the description of FIG. If the current cell row is not the end in step S241 (step S241, No), the source code generation unit 240b outputs the characters in the behavior description area (step S244), and ends the end recursion determination process. .

また、ソースコード生成部240bは、ステップS242において、再帰でない場合には(ステップS242,No)、ステップS244に移行する。   If the source code generation unit 240b is not recursive in step S242 (step S242, No), the source code generation unit 240b proceeds to step S244.

次に、本実施例2に係るソースコード生成部240bの効果について説明する。ソースコード生成部240bは、デシジョンテーブル230aからソースコード230bを生成する場合において、無限ループのコードを出力し、動作記述領域にbreak文を設定し、該break文が設定された行に対応する動作指定領域の各セルに、breakの動作を実行する旨の情報を設定する。ソースコード生成部240bは、再帰動作の検出結果を基にして、break文が設定された行に対応する動作指定領域のセルの情報を、breakの動作を実行しない旨の情報に変更する。そして、デシジョンテーブルのセルを順次走査し、動作記述領域の動作を実行する旨の情報がセルに含まれている場合には、該セルの行に対応する動作を出力する。このような処理を、ソースコード生成装置200が実行することで、繰り返し動作を含むデシジョンテーブル230aを、Java(登録商標)等に対応したソースコード230bを生成することができる。   Next, effects of the source code generation unit 240b according to the second embodiment will be described. When generating the source code 230b from the decision table 230a, the source code generation unit 240b outputs an infinite loop code, sets a break statement in the operation description area, and operates corresponding to the line in which the break statement is set Information indicating that the break operation is to be executed is set in each cell in the designated area. Based on the detection result of the recursive operation, the source code generation unit 240b changes the cell information in the operation designation area corresponding to the row in which the break statement is set to information indicating that the break operation is not executed. Then, the cells in the decision table are sequentially scanned, and if the information to execute the operation in the operation description area is included in the cell, the operation corresponding to the row of the cell is output. By executing such processing by the source code generation device 200, it is possible to generate the source code 230b corresponding to Java (registered trademark) or the like from the decision table 230a including the repetitive operation.

ところで、本実施例1、2において説明したソースコード生成装置100、200の処理は一例である。例えば、ソースコード生成装置100、200は、サーバの機能を有していても良い。ソースコード生成装置100、200は、ネットワークを介して、端末装置からデシジョンテーブルのデータを受信し、受信したデシジョンテーブルを基にして上記処理を実行し、ソースコードを生成しても良い。ソースコード生成装置200は、生成したソースコードを、端末装置に送信する。   By the way, the processing of the source code generation devices 100 and 200 described in the first and second embodiments is an example. For example, the source code generation devices 100 and 200 may have a server function. The source code generation devices 100 and 200 may receive the data of the decision table from the terminal device via the network, execute the above processing based on the received decision table, and generate the source code. The source code generation device 200 transmits the generated source code to the terminal device.

本実施例1、2において説明した各処理のうち、自動的におこなわれるものとして説明した処理の全部または一部を手動的におこなうこともでき、あるいは、手動的におこなわれるものとして説明した処理の全部または一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。   Of the processes described in the first and second embodiments, all or part of the processes described as being performed automatically can be performed manually, or the processes described as being performed manually. All or a part of the above can be automatically performed by a known method. In addition, the processing procedure, control procedure, specific name, and information including various data and parameters shown in the above-described document and drawings can be arbitrarily changed unless otherwise specified.

また、図1、10に示したソースコード生成装置100、200の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。なお、本実施例で説明した各種の処理手順は、予め用意されたプログラムをパーソナルコンピュータやワークステーションなどのコンピュータで実行することによって実現することができる。また、上記の実施例1、2で説明した各種の処理は、予め用意されたプログラムをコンピュータで実行することによって実現することができる。   The constituent elements of the source code generation devices 100 and 200 shown in FIGS. 1 and 10 are functionally conceptual, and need not be physically configured as illustrated. The various processing procedures described in this embodiment can be realized by executing a program prepared in advance on a computer such as a personal computer or a workstation. The various processes described in the first and second embodiments can be realized by executing a prepared program on a computer.

100、200 ソースコード生成装置
110、210 入力部
120、220 表示部
130、230 記憶部
140、240 制御部
100, 200 Source code generation device 110, 210 Input unit 120, 220 Display unit 130, 230 Storage unit 140, 240 Control unit

Claims (6)

複数の条件を各行に分けて記述する条件記述領域と、前記条件記述領域の条件が満たされているか否かの情報を行および列により決まるセルに指定する条件指定領域と、複数の動作を各行に分けて記述する動作記述領域と、前記条件記述領域の条件を満たしているか否かに応じて前記動作を実行するか否かの情報を各行および各列により決まるセルに指定する動作指定領域とを有するデシジョンテーブルを記憶する記憶部と、
無限ループのコードを出力し、前記動作記述領域にbreak文を設定し、該break文が設定された行に対応する動作指定領域の各セルに、前記break文の動作を実行する旨の情報を設定する設定部と、
前記デシジョンテーブルのセルを順次走査して、該デシジョンテーブルの末尾の行で再帰の動作を行う情報が指定されたセルを検出する再帰検出部と、
前記再帰検出部の検出結果を基にして、前記break文が設定された行に対応する動作指定領域のセルの情報を、前記break文の動作を実行しない旨の情報に変更する変更部と、
前記再帰検出部の検出結果を基にして、繰り返しを実行するコードを出力し、前記デシジョンテーブルのセルを順次走査し、前記動作記述領域の動作を実行する旨の情報がセルに含まれている場合には、該セルの行に対応する動作を出力する出力部と
を有することを特徴とするソースコード生成装置。
A condition description area that divides a plurality of conditions into each line, a condition designation area that specifies information about whether or not the conditions of the condition description area are satisfied in a cell determined by a row and a column, and a plurality of operations for each line A behavior description area that is described separately, and a behavior designation area that designates information about whether or not to execute the behavior depending on whether or not the condition description area condition is satisfied in a cell determined by each row and each column; A storage unit for storing a decision table having
An infinite loop code is output, a break statement is set in the operation description area, and information indicating that the operation of the break statement is executed in each cell of the operation designation area corresponding to the line in which the break statement is set. A setting section to be set;
A recursion detection unit that sequentially scans the cells of the decision table and detects cells in which information for performing a recursion operation is specified in the last row of the decision table;
Based on the detection result of the recursion detection unit, a change unit that changes the information of the cell in the operation designation area corresponding to the row in which the break statement is set to information indicating that the operation of the break statement is not executed;
Based on the detection result of the recursion detection unit, a code for executing repetition is output , the cells in the decision table are sequentially scanned, and information indicating that the operation in the operation description area is executed is included in the cell. A source code generation device comprising: an output unit that outputs an operation corresponding to the row of the cell .
前記出力部は、前記再帰検出部の検出結果を基にして、ースコードの先頭に移行するgoto文を出力することを特徴とする請求項1に記載のソースコード生成装置。 And the output unit, the recursive detection result of the detection unit based on the source code generating device according to claim 1, characterized in that for outputting a goto statement to migrate to the top of the source Sukodo. コンピュータが実行するソースコード生成方法であって、
複数の条件を各行に分けて記述する条件記述領域と、前記条件記述領域の条件が満たされているか否かの情報を行および列により決まるセルに指定する条件指定領域と、複数の動作を各行に分けて記述する動作記述領域と、前記条件記述領域の条件を満たしているか否かに応じて前記動作を実行するか否かの情報を各行および各列により決まるセルに指定する動作指定領域とを有するデシジョンテーブルを記憶装置から読み出し、
無限ループのコードを出力し、前記動作記述領域にbreak文を設定し、該break文が設定された行に対応する動作指定領域の各セルに、前記break文の動作を実行する旨の情報を設定し、
前記デシジョンテーブルのセルを順次走査して、該デシジョンテーブルの末尾の行で再帰の動作を行う情報が指定されたセルを検出し、
検出結果を基にして、前記break文が設定された行に対応する動作指定領域のセルの情報を、前記break文の動作を実行しない旨の情報に変更し、
検出結果を基にして、繰り返しを実行するコードを出力し、
前記デシジョンテーブルのセルを順次走査し、前記動作記述領域の動作を実行する旨の情報がセルに含まれている場合には、該セルの行に対応する動作を出力する
各処理を実行することを特徴とするソースコード生成方法。
A source code generation method executed by a computer,
A condition description area that divides a plurality of conditions into each line, a condition designation area that specifies information about whether or not the conditions of the condition description area are satisfied in a cell determined by a row and a column, and a plurality of operations for each line A behavior description area that is described separately, and a behavior designation area that designates information about whether or not to execute the behavior depending on whether or not the condition description area condition is satisfied in a cell determined by each row and each column; A decision table having
An infinite loop code is output, a break statement is set in the operation description area, and information indicating that the operation of the break statement is executed in each cell of the operation designation area corresponding to the line in which the break statement is set. Set,
The cells of the decision table are sequentially scanned to detect cells in which information for performing a recursive operation is specified in the last row of the decision table,
Based on the detection result, the cell information of the operation designation area corresponding to the row where the break statement is set is changed to information indicating that the operation of the break statement is not executed,
Based on the detection result, output the code to execute the iteration ,
The cells in the decision table are sequentially scanned, and when the information to execute the operation in the operation description area is included in the cell, each process for outputting the operation corresponding to the row of the cell is executed. A source code generation method characterized by
前記出力する処理は、前記末尾の行で再帰の動作を検出する処理の検出結果を基にして、ースコードの先頭に移行するgoto文を出力することを特徴とする請求項に記載のソースコード生成方法。 Processing of the output source of claim 3, characterized in that for outputting a goto statement based on the detection result of the process of detecting the operation of recursion in the end of the line, the process proceeds to the beginning of the source Sukodo Code generation method. コンピュータに、
複数の条件を各行に分けて記述する条件記述領域と、前記条件記述領域の条件が満たされているか否かの情報を行および列により決まるセルに指定する条件指定領域と、複数の動作を各行に分けて記述する動作記述領域と、前記条件記述領域の条件を満たしているか否かに応じて前記動作を実行するか否かの情報を各行および各列により決まるセルに指定する動作指定領域とを有するデシジョンテーブルを記憶装置から読み出し、
無限ループのコードを出力し、前記動作記述領域にbreak文を設定し、該break文が設定された行に対応する動作指定領域の各セルに、前記break文の動作を実行する旨の情報を設定し、
前記デシジョンテーブルのセルを順次走査して、該デシジョンテーブルの末尾の行で再帰の動作を行う情報が指定されたセルを検出し、
検出結果を基にして、前記break文が設定された行に対応する動作指定領域のセルの情報を、前記break文の動作を実行しない旨の情報に変更し、
検出結果を基にして、繰り返しを実行するコードを出力し、
前記デシジョンテーブルのセルを順次走査し、前記動作記述領域の動作を実行する旨の情報がセルに含まれている場合には、該セルの行に対応する動作を出力する
各処理を実行させることを特徴とするソースコード生成プログラム。
On the computer,
A condition description area that divides a plurality of conditions into each line, a condition designation area that specifies information about whether or not the conditions of the condition description area are satisfied in a cell determined by a row and a column, and a plurality of operations for each line A behavior description area that is described separately, and a behavior designation area that designates information about whether or not to execute the behavior depending on whether or not the condition description area condition is satisfied in a cell determined by each row and each column; A decision table having
An infinite loop code is output, a break statement is set in the operation description area, and information indicating that the operation of the break statement is executed in each cell of the operation designation area corresponding to the line in which the break statement is set. Set,
The cells of the decision table are sequentially scanned to detect cells in which information for performing a recursive operation is specified in the last row of the decision table,
Based on the detection result, the cell information of the operation designation area corresponding to the row where the break statement is set is changed to information indicating that the operation of the break statement is not executed,
Based on the detection result, output the code to execute the iteration ,
The cells of the decision table are sequentially scanned, and if the information to execute the operation in the operation description area is included in the cell, each process for outputting the operation corresponding to the row of the cell is executed. A source code generation program characterized by
前記出力する処理は、前記末尾の行で再帰の動作を検出する処理の検出結果を基にして、ースコードの先頭に移行するgoto文を出力することを特徴とする請求項に記載のソースコード生成プログラム。 Processing of the output source of claim 5, characterized in that for outputting a goto statement based on the detection result of the process of detecting the operation of recursion in the end of the line, the process proceeds to the beginning of the source Sukodo Code generator.
JP2012007144A 2012-01-17 2012-01-17 Source code generation apparatus, source code generation method, and source code generation program Expired - Fee Related JP5812878B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012007144A JP5812878B2 (en) 2012-01-17 2012-01-17 Source code generation apparatus, source code generation method, and source code generation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012007144A JP5812878B2 (en) 2012-01-17 2012-01-17 Source code generation apparatus, source code generation method, and source code generation program

Publications (2)

Publication Number Publication Date
JP2013148964A JP2013148964A (en) 2013-08-01
JP5812878B2 true JP5812878B2 (en) 2015-11-17

Family

ID=49046432

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012007144A Expired - Fee Related JP5812878B2 (en) 2012-01-17 2012-01-17 Source code generation apparatus, source code generation method, and source code generation program

Country Status (1)

Country Link
JP (1) JP5812878B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108304194B (en) * 2017-09-01 2021-08-20 潍柴动力股份有限公司 Program generation method and device and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6379176A (en) * 1986-09-24 1988-04-09 Central Res Inst Of Electric Power Ind Method for producing automatically program by combining parts based on designing specifications
JPH01147621A (en) * 1987-12-04 1989-06-09 Hitachi Ltd Automatic program producing method

Also Published As

Publication number Publication date
JP2013148964A (en) 2013-08-01

Similar Documents

Publication Publication Date Title
US8051371B2 (en) Document analysis system and document adaptation system
CN105677654B (en) Advertisement filtering method and device
US8756214B2 (en) Crawling browser-accessible applications
Vojíř et al. EasyMiner. eu: Web framework for interpretable machine learning based on rules and frequent itemsets
EP3660753A1 (en) Learning method, learning program, learning device, and learning system
JP2019040335A (en) Method for creating teacher data, method for creating learned model, learned model, computer and program
KR20150092880A (en) Method and Apparatus for Re-Configuring Design Decisions after Developing Graphic User Interface
JP2009211551A (en) Information output device and information output processing program
CN113032336A (en) Information processing apparatus, storage medium, and information processing method
JP5812878B2 (en) Source code generation apparatus, source code generation method, and source code generation program
JP2012221389A (en) Circuit simulation method and circuit simulation device
CN106339372A (en) Search engine optimization method and device
JP2016091343A (en) Information processing system, information processing method, and program
CN107608890A (en) A kind of method of the event handling function model generation gui software test case based on Weight
Manfrini et al. A novel efficient mutation for evolutionary design of combinational logic circuits
JP2013148965A (en) Editing device, editing method, and editing program
KR100970092B1 (en) Apparatus and method for generating substation configuration description language
US7082589B2 (en) Method of generating a schematic driven layout for a hierarchical integrated circuit design
JP6996360B2 (en) Report creation program and report creation method
JP2004094950A (en) Device and method for programming programmable device
Fayzrakhmanov WPPS: A novel and comprehensive framework for web page understanding and information extraction
Gamzayev et al. Knowledge-oriented information technology to variability management at the domain analysis stage in software development
JP2014174899A (en) Gui program automatic change device, automatic change method, and automatic change program
KR102645454B1 (en) System and method for generating synthetic data automatically
JP2008276363A (en) Circuit simulation device and circuit simulation program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140911

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150527

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150602

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150729

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20150908

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150915

R150 Certificate of patent or registration of utility model

Ref document number: 5812878

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees