JP2000132387A - Object directing program generation support device - Google Patents

Object directing program generation support device

Info

Publication number
JP2000132387A
JP2000132387A JP10301122A JP30112298A JP2000132387A JP 2000132387 A JP2000132387 A JP 2000132387A JP 10301122 A JP10301122 A JP 10301122A JP 30112298 A JP30112298 A JP 30112298A JP 2000132387 A JP2000132387 A JP 2000132387A
Authority
JP
Japan
Prior art keywords
program
unit
information
convention
input
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
JP10301122A
Other languages
Japanese (ja)
Other versions
JP2000132387A5 (en
Inventor
Yuji Hotta
勇次 堀田
Shigeki Naota
繁樹 直田
Satoru Nakajima
哲 中島
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 JP10301122A priority Critical patent/JP2000132387A/en
Publication of JP2000132387A publication Critical patent/JP2000132387A/en
Publication of JP2000132387A5 publication Critical patent/JP2000132387A5/ja
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To analyze an input program for pointing out a violation against the rule of the program, thereby generating the example of a code fitted to the rule. SOLUTION: A syntax analysis part 2 analyzes the syntax of an input program 1 and outputs syntax analysis information 3 being the syntax analysis result of the input program 1. A rule collation part 5 collates syntax analysis information with rule information 4. An analysis information normalization part 6 outputs a code fitted to a rule based on analysis information based on syntax analysis information 3 and rule information 4. An output part 7 outputs a collation result obtained by collation in the rule collation part 5 or a fitted code example which the analysis information normalization part 6 generates.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、オブジェクト指向
プログラムの開発の生産性向上をはかるオブジェクト指
向プログラム作成支援装置に関する。
[0001] 1. Field of the Invention [0002] The present invention relates to an object-oriented program creation support device for improving the productivity of object-oriented program development.

【0002】[0002]

【従来の技術】作成したプログラムをコンパイルしたと
き、プログラムにエラーがあるとエラーメッセージが表
示される。一般に、コンパイル等によるエラーメッセー
ジはエラーの位置と文法の説明程度の情報の提示であ
り、プログラム作成者は、このエラーメッセージ基づき
プログラムを検証しエラーの修正を行っていた。
2. Description of the Related Art When a created program is compiled, an error message is displayed if there is an error in the program. Generally, an error message generated by compiling or the like is information indicating the position of an error and an explanation of a grammar, and a program creator verifies a program based on the error message and corrects the error.

【0003】[0003]

【発明が解決しようとする課題】以上のように従来のエ
ラーメッセージはエラーの位置と文法の説明程度の情報
の提示でしか行っておらず、プログラム作成上のガイド
としては不十分なことが多かった。また、プログラムが
文法的に間違いではなくとも、不適切な書き方がなされ
ていた場合もユーザは気づかないため、プログラムにバ
グが混入しやすいといった問題があった。このため、オ
ブジェクト指向プログラム中に、上記不適切な書き方が
成されていると、プログラム中にバグが混入する可能性
が増大し、予期しない動作をする場合があった。本発明
の上記した事情に鑑みなされたものであって、本発明の
目的は、入力プログラムを解析してプログラムの規約に
対する違反を指摘することができ、また、規約に適合し
たコードの例を生成することができるオブジェクト指向
プログラム作成支援装置を提供することである。
As described above, the conventional error message is provided only by presenting information such as the position of the error and the explanation of the grammar, and is often insufficient as a guide in creating a program. Was. Further, even if the program is not grammatically incorrect, the user does not notice that the program is improperly written, so that there is a problem that a bug is easily mixed in the program. For this reason, if the inappropriate writing is performed in the object-oriented program, the possibility that a bug is mixed in the program increases, and an unexpected operation may be performed. In view of the above circumstances of the present invention, an object of the present invention is to analyze an input program and point out violations of program rules, and to generate an example of code conforming to the rules. It is an object of the present invention to provide an object-oriented program creation support device capable of performing such operations.

【0004】[0004]

【課題を解決するための手段】図1は本発明の原理構成
を示す図である。同図に示すように、本発明のオブジェ
クト指向プログラム作成支援装置は、構文解析部2、構
文解析情報3および規約情報4を格納する格納部8、規
約照合部5、解析情報正規化部6および出力部7を備え
ている。上記構文解析部2は、入力プログラム1の構文
を解析して、入力プログラム1の構文解析結果である構
文解析情報3を出力する。規約照合部5は、構文解析情
報3と規約情報4とを照合する。解析情報正規化部6
は、規約照合部5において照合された構文解析情報3と
規約情報4とに基づき、解析した情報を正規化して、解
析情報を元にした規約に適合するコードを出力する。出
力部7は、規約照合部6において照合した照合結果また
は解析情報正規化部6が生成した適合コード例を出力す
る。規約照合部5および解析情報正規化部6は、構文解
析部2の解析結果に基づき以下のチェックを行い、出力
部6から照合結果を出力し、また、解析情報正規化部6
は適合コード例の生成が有効になっている場合、適合コ
ード例を生成し、出力部6から出力する。
FIG. 1 is a diagram showing the principle configuration of the present invention. As shown in FIG. 1, the object-oriented program creation support device of the present invention includes a parsing unit 2, a storage unit 8 for storing parsing information 3 and protocol information 4, a protocol matching unit 5, an analysis information normalizing unit 6, An output unit 7 is provided. The syntax analysis unit 2 analyzes the syntax of the input program 1 and outputs syntax analysis information 3 which is a result of the syntax analysis of the input program 1. The rule checking unit 5 checks the syntax analysis information 3 and the rule information 4. Analysis information normalization unit 6
Normalizes the analyzed information based on the syntax analysis information 3 and the convention information 4 collated by the convention collation unit 5, and outputs a code conforming to the convention based on the analysis information. The output unit 7 outputs the collation result collated by the agreement collation unit 6 or the conforming code example generated by the analysis information normalization unit 6. The rule checking unit 5 and the analysis information normalizing unit 6 perform the following check based on the analysis result of the syntax analysis unit 2, output the matching result from the output unit 6, and
When the generation of the conforming code example is enabled, the conforming code example is generated and output from the output unit 6.

【0005】上記規約照合部5はプログラムのコードの
規約に対する次の違反をチェックし、また、解析情報正
規化部6は、利用者の設定によりコードの生成が有効に
なっている場合、次のような適合コード例を生成する。 (1)有効でない多重定義の宣言がないかチェックす
る。また、チェック結果に基づき、宣言が有効になるコ
ードを自動的、あるいは対話的に生成する。 (2)異なるスコープ(上位か下位)で同じ宣言を行っ
ていないかチェックする。また、チェック結果に基づ
き、同じ宣言にならないコードを自動的、あるいは対話
的に生成する。 (3)名前を導入する宣言と同じ宣言が異なるスコープ
に存在しないかチェックする。また、チェック結果に基
づき、同じ宣言にならないコードを自動的、あるいは対
話的に生成する。 (4)名前空間の宣言で候補が曖昧になる宣言を行って
いないかをチェックする。 (5)名前を導入済みの宣言を多重定義していないかチ
ェックする。また、チェック結果に基づき、名前を再度
導入するコードを自動的、あるいは対話的に生成する。 (6)名前を導入済みのテンプレート部分特殊化定義を
おこなっていないかをチェックする。 (7)テンプレートの仮引数の開始終了記号と同じ記号
がテンプレート定義の仮引数定義内で使用されていない
かチェックする。 (8)テンプレートの実引数の開始終了記号と同じ記号
がテンプレートのインスタンスの実引数定義内で使用さ
れていないかチェックする。 (9)メンバテンプレートと同じ名前のメンバ名を、明
示的にテンプレートと指定せずに使用していないかチェ
ックする。また、チェック結果に基づき、テンプレート
付きのコードを自動的、あるいは対話的に生成する。 (10)べースクラスの仮想関数をテンプレート関数で
オーバーライドしようとしていないかチェックする。 (11)テンプレート名を使ったメンバでテンプレート
仮引数が省略されたものがないかチェックする。また、
チェック結果に基づき、テンプレー卜仮引数を省略して
いないコードを自動的、あるいは対話的に生成する。 (12)テンプレートパラメータが隠されるようなテン
プレートを宣言していないかチェックする。また、チェ
ック結果に基づき、テンプレートパラメータが隠されな
いコードを自動的、あるいは対話的に生成する。 (13)テンプレートパラメータが他の名前を隠してし
まうようなテンプレートを宣言していないかチェックす
る。また、チェック結果に基づき、テンプレートパラメ
ータが隠さないコードを自動的、あるいは対話的に生成
する。 (14)例外処理の出現を検出し、正しく関数で受け取
られているかをチェックする。また、チェック結果に基
づき、正しい関数を使うコードを自動的、あるいは対話
的に出力する。 (15)代入演算子を検出し、正しい復帰値を返してい
るかをチェックする。また、チェック結果に基づき、正
しい復帰値を返すコードを自動的、あるいは対話的に生
成する。 (16)評価順序が不定なグローバルオブジェクトが存
在しないかチェックする。
[0005] The rule checking unit 5 checks the next violation of the rules of the code of the program, and the analysis information normalizing unit 6 checks the following when the code generation is enabled by the setting of the user. Generate a compliant code example like this: (1) Check for invalid overloaded declarations. Also, based on the check result, the code that makes the declaration valid is generated automatically or interactively. (2) Check whether the same declaration is made in different scopes (upper or lower). Also, based on the check result, automatically or interactively generate code that does not have the same declaration. (3) Check if the same declaration as the one introducing the name exists in a different scope. Also, based on the check result, automatically or interactively generate code that does not have the same declaration. (4) Check if the declaration of the namespace has made a declaration that makes the candidate ambiguous. (5) Check if a declaration with a name has been overloaded. Further, based on the check result, a code for re-introducing the name is automatically or interactively generated. (6) Check whether a template partial specialization definition whose name has been introduced is not performed. (7) Check whether the same symbol as the start / end symbol of the formal parameter of the template is used in the formal parameter definition of the template definition. (8) Check whether the same symbol as the start / end symbol of the actual argument of the template is used in the actual argument definition of the instance of the template. (9) Check whether a member name having the same name as the member template is used without explicitly designating it as a template. Further, based on the check result, a code with a template is automatically or interactively generated. (10) Check whether the virtual function of the base class is going to be overridden by the template function. (11) Check if there is any member using the template name and the template parameter is omitted. Also,
Based on the check result, code that does not omit the template parameter is automatically or interactively generated. (12) Check whether a template that declares a template parameter is not declared. Further, based on the check result, a code in which the template parameter is not hidden is automatically or interactively generated. (13) Check whether the template parameter declares a template that hides another name. Further, based on the check result, a code that does not hide the template parameters is automatically or interactively generated. (14) The occurrence of exception processing is detected, and it is checked whether it has been correctly received by the function. It also automatically or interactively outputs code that uses the correct function based on the check results. (15) Detect an assignment operator and check whether a correct return value is returned. Further, based on the check result, a code that returns a correct return value is automatically or interactively generated. (16) Check whether there is any global object whose evaluation order is uncertain.

【0006】[0006]

【発明の実施の形態】以下、本発明の実施の形態をプロ
グラミング言語C++での入力例について説明する。図
2は本発明の実施例のオブジェクト指向プログラム作成
支援装置の構成を示す図である。同図において、構文解
析部2は入力プログラム1が入力されると、クラス名、
クラスの各データメンバについて、それぞれ名前、型等
を、各メンバ関数についてはパラメータの型情報や復帰
情報をそれぞれ検出する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to an input example in a programming language C ++. FIG. 2 is a diagram showing the configuration of the object-oriented program creation support device according to the embodiment of the present invention. In FIG. 1, when the input program 1 is input, the parsing unit 2 receives a class name,
For each data member of the class, the name and type are detected, and for each member function, the type information and return information of the parameter are detected.

【0007】更に、クラスの演算子オブジェクトのメモ
リ操作を実行する式、クラスの継承関係、大域変数につ
いての情報を検出しこれらを構文解析情報3としてまと
める。規約照合部5は構文解析情報3を参照しながら、
入力プログラム1のコーディングの規約となっている部
分を規約情報4と照合し、規約から外れた部分を出力部
7に出力する。また、解析情報正規化部6は構文解析情
報3中のプログラム情報を規約情報4に沿う形に正規化
することで、プログラムの修正例を出力部7に出力す
る。
[0007] Further, information about the expression for executing the memory operation of the operator object of the class, the inheritance relation of the class, and the global variable are detected, and these are collected as syntax analysis information 3. The rule checking unit 5 refers to the syntax analysis information 3
A part of the coding of the input program 1 which is a rule of the coding is collated with the rule information 4, and a part out of the rule is output to the output unit 7. Further, the analysis information normalizing unit 6 normalizes the program information in the syntax analysis information 3 so as to conform to the rule information 4, and outputs a modified example of the program to the output unit 7.

【0008】次に、構文解析部2が出力する構文解析情
報3について、図3を参照して説明する。図3は、図示
してあるC++で記述されたプログラム例を構文解析し
た結果を示す図である。構文解析結果を示す構文解析情
報3は、グローバル情報、クラス定義情報、ベースクラ
ス情報、関数定義リスト、式情報、メンバ定義表、デー
タ定義情報等から構成される。グローバル情報はクラ
ス、関数、変数等の種別を含み、これらの定義情報が規
定される。例えば、クラスの場合、クラス定義情報とし
てメンバ定義表とべースクラスリストを含む。メンバ定
義表は、構造体(struct)を構成するメンバの種別、す
なわちメンバ関数(手続きに相当)やデータメンバ(デ
ータ構造に相当)ごとに定義情報を含む。
Next, the syntax analysis information 3 output by the syntax analyzer 2 will be described with reference to FIG. FIG. 3 is a diagram showing a result of parsing an example of a program described in C ++ as shown. The syntax analysis information 3 indicating the syntax analysis result includes global information, class definition information, base class information, function definition list, formula information, member definition table, data definition information, and the like. The global information includes types such as classes, functions, variables, and the like, and these definition information is defined. For example, in the case of a class, a member definition table and a base class list are included as class definition information. The member definition table includes definition information for each type of members constituting a structure (struct), that is, for each member function (corresponding to a procedure) and each data member (corresponding to a data structure).

【0009】メンバ関数の定義情報は関数定義リストを
有する。関数定義リストは、呼び出し形式、復帰コード
等を含む。またデータメンバはデータ定義情報として、
型やポインタを含む。またベースクラスリストは、ベー
スクラス情報として、アクセスの種別やクラスを含む。
アクセス”private ”は、そのクラス内でしかアクセス
できないことを意味する。また、アクセス”public”は
他のクラスからもアクセスできることを意味する。関数
定義リストは呼び出し形式、式情報を含む。式情報は、
具体的な式の情報を含む。
The definition information of the member function has a function definition list. The function definition list includes a call format, a return code, and the like. The data member is defined as data definition information.
Including types and pointers. The base class list includes the type and class of access as base class information.
Access "private" means that access is possible only within that class. Also, access "public" means that it can be accessed from other classes. The function definition list includes a call format and expression information. Expression information is
Contains specific formula information.

【0010】図4は、規約情報4の構造を示す図であ
る。規約情報4は記憶部8内においては、規約構造とし
て格納されている。規約構造は、図4に示すように規約
インデックスと処理とを規定する。例えば、public T
1 v1に対しては処理P34の処理インデックスが規定
されている。解析情報正規化部6の正規化処理は、この
処理インデックスに対応する処理内容を記述しておき、
処理インデックスが与えられたとき記述されている処理
内容を実行することである。規約照合部5は、図2に示
した構文解析情報3から必要な情報を取り出して、規約
の形式に変換する。図4に示すように、グローバル(ト
ップレベル)の規約情報として、クラス、グローバル変
数等がある。これらを規約項目とよぶ。各規約項目は1
個以上の複数の規約を持つ。クラスならばクラス全般の
規約があるが、そのデータメンバ、メンバ関数等に関す
る規約として内部規約を持つ。規約は解析情報を正規化
するための処理を規定する。
FIG. 4 is a diagram showing the structure of the rule information 4. The rule information 4 is stored in the storage unit 8 as a rule structure. The rule structure defines a rule index and a process as shown in FIG. For example, public T
The processing index of the processing P34 is defined for 1v1. In the normalization processing of the analysis information normalization unit 6, the processing content corresponding to the processing index is described, and
When the processing index is given, the processing content described is executed. The rule checking unit 5 extracts necessary information from the syntax analysis information 3 shown in FIG. 2 and converts it into a rule format. As shown in FIG. 4, the global (top-level) contract information includes a class, a global variable, and the like. These are called contract items. Each rule item is 1
It has more than one convention. If it is a class, there are general rules for the class, but there are internal rules as rules for data members, member functions, and the like. The rules specify processing for normalizing analysis information.

【0011】図5に、規約照合部5における処理を示
す。ここでは、図6に示す入力プログラム例とその構文
解析した結果を用いて図5の処理を説明する。規約照合
部5は解析情報を読み込み(ステップS1)、解析情報
の有無を判断する(ステップS2)。図6の例の場合、
ますグローバル情報からクラスBoxについて処理を開
始する。次に、規約照合部5は、解析情報に対応する規
約があるかどうかを調べる。(ステップS3)。クラス
や関数等は対応する変換処理を持ち、その処理の実行に
より解析情報を規約形式に変換する。図6の解析情報B
oxの場合、クラスに対応する処理の有無を調べ、処理
がある場合にはそれを内部のメモリ等へ記憶しておく。
FIG. 5 shows a process in the rule checking unit 5. Here, the processing of FIG. 5 will be described using the example of the input program shown in FIG. 6 and the result of the syntax analysis. The rule checking unit 5 reads the analysis information (step S1) and determines whether or not there is the analysis information (step S2). In the case of the example of FIG.
First, processing is started for the class Box from global information. Next, the rule checking unit 5 checks whether there is a rule corresponding to the analysis information. (Step S3). Classes, functions, and the like have a corresponding conversion process, and execute the process to convert the analysis information into a convention format. Analysis information B in FIG.
In the case of ox, the presence or absence of a process corresponding to the class is checked, and if there is a process, it is stored in an internal memory or the like.

【0012】規約照合部5は、まず、変換に必要な情報
を収集する(ステップS4)。クラスに対応する規約形
式への変換処理は図3に示したBoxのクラス定義情報
から情報を辿り、解析情報の規約形式(規約インデック
ス)への変換に必要な情報を収集する。次に、規約照合
部5は、解析情報を規約形式に変換し、規約インデック
ス情報を生成する(ステップS5)。次いで、規約照合
部5は、解析情報と一般化情報の対応づけを行う(ステ
ップS6)。すなわち、クラス固有の「 value t 」
「 value_x 」等は一般的な表現形式「T1」「v1」
等に変換し、これを保存する。
First, the rule collating unit 5 collects information necessary for conversion (step S4). The conversion process to the convention format corresponding to the class traces information from the Box class definition information shown in FIG. 3 and collects information necessary for converting the analysis information into the convention format (rule index). Next, the rule collating unit 5 converts the analysis information into a rule format and generates rule index information (step S5). Next, the rule checking unit 5 associates the analysis information with the generalized information (step S6). That is, the class-specific "value t "
"Value_x" etc. are general expression forms "T1""v1"
And save it.

【0013】次に、規約照合部5は、規約構造から処理
を取り出す(ステップS7)。すなわち、規約構造の情
報を図4に示す規約インデックスで照合し、対応する正
規化処理を取り出す。次に、規約照合部5は、取り出し
た処理インデックスで照合し、図4の正規化処理から処
理内容を取り出す(ステップS8)。解析情報正規化部
6は、処理内容を実行して入力プログラムを変換し、正
規化したプログラム(適合コード例)を生成する(ステ
ップ9)。最後に、通知処理を行う(ステップS1
0)。すなわち、この正規化したプログラムを出力部7
から出力する。
Next, the rule checking unit 5 extracts a process from the rule structure (step S7). That is, the information of the rule structure is collated with the rule index shown in FIG. 4, and the corresponding normalization processing is extracted. Next, the rule collation unit 5 collates with the extracted processing index, and extracts processing contents from the normalization processing of FIG. 4 (step S8). The analysis information normalizing unit 6 executes the processing contents, converts the input program, and generates a normalized program (example of conforming code) (step 9). Finally, a notification process is performed (step S1).
0). That is, the normalized program is output to the output unit 7.
Output from

【0014】以下、具体的実施例として、プログラミン
グ言語C++での入力例と、生成されるコード例につい
て説明する。 (1)例1 有効でない多重定義の宣言がないかチェックする。利用
者の設定によりコードの生成が有効になっている場合、
チェック結果に基づき、宣言が有効になるコードを自動
的、あるいは対話的に生成する。
Hereinafter, as a specific embodiment, an example of input in a programming language C ++ and an example of generated code will be described. (1) Example 1 Check for invalid overloaded declarations. If code generation is enabled by user settings,
Based on the results of the check, the code that makes the declaration valid is generated automatically or interactively.

【0015】 注1:foo(int)を呼び出す意図でも”A.h ”のインクル
ード(# include "A.h" )により関数foo(char) を実行
してしまう。意図と反した誤った手続きの実行の可能性
があるため通知。
[0015] Note 1: Even if you intend to call foo (int), the function foo (char) will be executed by including "Ah"(#include"Ah"). Notice due to possibility of performing wrong procedure contrary to intention.

【0016】図7に例1における構文解析情報、規約情
報を示す。構文解析結果は、同図(a)に示すようにな
り、この例の場合、”foo (10) ”により、関数foo(in
t)を呼び出す意図でも”A.h ”のインクルード(# incl
ude "A.h" )により関数foo(char) を実行してしまう。
前記規約照合部5は上記構文解析情報を規約形式に変換
し、規約情報を検索する。この場合、図7(b)に示す
ように”有効でない多重定義”に対応する規約インデッ
クスとして”all headers ”が取り出され、対応する処
理p50が取り出される。このように多重定義により、
意図と反した誤った手続きの実行の可能性がある場合に
は、出力部7から、その旨が通知される。また、利用者
の設定により適合コード例の生成が有効になっている場
合には、解析情報正規化部6は、適合コード例を生成
し、出力部7から出力する。この例の場合には、次のよ
うに、”# include "B.h" "を追加する。これによ
り、”foo(int)”を呼び出すことができる。
FIG. 7 shows syntax analysis information and convention information in Example 1. The result of the syntax analysis is as shown in FIG. 9A. In this example, the function foo (in) is obtained by “foo (10)”.
Include "Ah"(# incl
ude "Ah") executes the function foo (char).
The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 7B, "all headers" is extracted as the rule index corresponding to "invalid overload", and the corresponding process p50 is extracted. Thus, by overloading,
If there is a possibility that an erroneous procedure contrary to the intention is performed, the output unit 7 notifies the fact. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In this case, add "# include" Bh "" as follows. Thus, "foo (int)" can be called.

【0017】 注1:追加。 注2:B.h インクルードによりfoo(int)が実行される。[0017] Note 1: Added. Note 2: foo (int) is executed by Bh include.

【0018】(2)例2 異なるスコープ(上位か下位)で同じ宣言を行っていな
いかチェックする。利用者の設定によりコードの生成が
有効になっている場合、チェック結果に基づき、同じ宣
言にならないコードを自動的、あるいは対話的に生成す
る。
(2) Example 2 It is checked whether the same declaration is made in different scopes (upper or lower). If code generation is enabled by user settings, code that does not have the same declaration is automatically or interactively generated based on the check result.

【0019】 注1:N::c 注2:上位のスコープと同じ宣言なので通知。 注3:Nest::c に対する処理。[0019] Note 1: N :: c Note 2: Notification because it is the same declaration as the higher-level scope. Note 3: Processing for Nest :: c.

【0020】図8に例2における構文解析情報、規約情
報を示す。構文解析結果は、同図(a)に示すようにな
り、この例の場合、” namespace Nest ”における”in
t c”が上位のスコープ” namespace N ”における”
int c”と同じ宣言であり、Nest::c に対する処理にお
いて、Nest::c の宣言位置によっては意図しない操作に
なる可能性がある。前記規約照合部5は上記構文解析情
報を規約形式に変換し、規約情報を検索する。この場
合、図8(b)に示すように”異なるスコープで同じ宣
言”に対応する規約インデックスとして”S1::d1 S1::
* S2::d1”が取り出され、対応する処理p51が取り出
される。
FIG. 8 shows syntax analysis information and convention information in Example 2. The result of the syntax analysis is as shown in FIG. 9A. In this example, “in” in “namespace Nest” is used.
tc ”is in the upper scope“ namespace N ”
int c ", and in the processing for Nest :: c, there is a possibility that an unintended operation may be performed depending on the declaration position of Nest :: c. The rule checking unit 5 converts the syntax analysis information into a rule format. In this case, as shown in Fig. 8B, "S1 :: d1 S1 ::" is converted as a rule index corresponding to "the same declaration in different scopes".
* S2 :: d1 ”is extracted, and the corresponding process p51 is extracted.

【0021】このように異なるスコープ(上位か下位)
で同じ宣言を行っており意図しない操作になる可能性が
ある場合には、出力部7から、その旨が通知される。ま
た、利用者の設定により適合コード例の生成が有効にな
っている場合には、解析情報正規化部6は、適合コード
例を生成し、出力部7から出力する。この例の場合に
は、次の出力例のように、”namespace Nest ”におけ
る”int c”、”void boo(){c++;}”を”int c_
gen ”、” void boo(c gen++;)”のように変更す
る。
Different scopes (upper or lower)
In the case where the same declaration is made and there is a possibility that an unintended operation is performed, the output unit 7 notifies the fact. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In the case of this example, as shown in the following output example, “int c” and “void boo ()} c ++;}” in “namespace Nest” are replaced with “int c_
gen ”,” void boo (c gen ++;) ”.

【0022】 注1:名前を変更。 注2:名前を変更。[0022] Note 1: Rename. Note 2: Rename.

【0023】(3)例3 名前を導入する宣言(friend)と同じ宣言が異なるスコ
ープに存在しないかチェックする。利用者の設定により
コードの生成が有効になっている場合、チェック結果に
基づき、同じ宣言にならないコードを自動的、あるいは
対話的に生成する。
(3) Example 3 Check whether the same declaration as the declaration (friend) for introducing a name exists in a different scope. If code generation is enabled by user settings, code that does not have the same declaration is automatically or interactively generated based on the check result.

【0024】 注1:最も内側のnamespace メンバのN::foo()がfriend
となる。::foo() をfriendとする意図である可能性があ
るので通知する。
[0024] Note 1: N :: foo () of the innermost namespace member is friend
Becomes Notify that :: foo () may be intended to be a friend.

【0025】図9に例3における構文解析情報、規約情
報を示す。構文解析結果は、同図(a)に示すようにな
り、この例の場合、導入対象外の同名宣言があり〔関数
定義情報に関数”N::foo()”があり、グローバル情報に
も”::foo() ”がある〕、意図しない操作になる可能性
がある。前記規約照合部5は上記構文解析情報を規約形
式に変換し、規約情報を検索する。この場合、図9
(b)に示すように”導入対象外の同名宣言”に対応す
る規約インデックスとして”f1 N1:: * C1::f1”が取り
出され、対応する処理p52が取り出される。このよう
に、導入対象外の同名宣言を行っており意図しない操作
になる可能性がある場合には、出力部7から、その旨が
通知される。
FIG. 9 shows syntax analysis information and convention information in Example 3. The result of the syntax analysis is as shown in FIG. 9A. In this example, there is a declaration of the same name that is not to be introduced [the function definition information includes the function “N :: foo ()”, and the global information also ":: foo ()"), which may result in unintended operations. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, FIG.
As shown in (b), “f1 N1 :: * C1 :: f1” is extracted as the rule index corresponding to “declaration of the same name not to be introduced”, and the corresponding process p52 is extracted. As described above, when there is a possibility that an unintended operation is performed because the same name declaration is excluded from the introduction target, the output unit 7 notifies that fact.

【0026】この例の場合、最も内側の”namespace N
”のメンバの”N::foo()”がfriendとなるが、外側
の”::foo() ”をfriendとする意図である可能性がある
ので、その旨を通知する。また、利用者の設定により適
合コード例の生成が有効になっている場合には、解析情
報正規化部6は、適合コード例を生成し、出力部7から
出力する。すなわち、次の出力例3のように、最も内側
の”namespace N ”のメンバN において” foo gen ”
のように名前を変更して(名前を変更しない場合もあ
る)宣言を追加するとともに、”class C ”の”foo
()”を” foo gen()”のように名前を変更する。
In this example, the innermost "namespace N
"N :: foo ()" of "" is a friend, but there is a possibility that the outer ":: foo ()" is intended to be a friend. When the generation of the conforming code example is enabled by the setting of the above, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. That is, as in the following output example 3, , In the member N of the innermost "namespace N" gen ”
Add a declaration by changing the name (may not change the name) as well as "foo" of "class C"
() ”To“ foo Change the name to something like "gen ()".

【0027】 注1:名前を変更して宣言を追加(名前を変更しない設
定もある)。 注2:名前を変更。
[0027] Note 1: Add declaration by changing the name (some settings do not change the name). Note 2: Rename.

【0028】(4)例4 名前空間(namespace )の宣言で候補が曖昧になる宣言
を行っていないかをチェックする。
(4) Example 4 It is checked whether or not a declaration that makes a candidate ambiguous in a declaration of a namespace is made.

【0029】 注1:f によりA::(int)とA::(char) が候補 注2:f によりB::(int)とb::(long) が候補[0029] Note 1: A: :( int) and A: :( char) are candidates by f Note 2: B: :( int) and b: :( long) are candidates by f

【0030】図10に例4における構文解析情報、規約
情報を示す。構文解析結果は、同図(a)に示すように
なり、この例の場合、曖昧候補を導入する宣言を行って
おり、意図しない操作になる可能性がある。前記規約照
合部5は上記構文解析情報を規約形式に変換し、規約情
報を検索する。この場合、図10(b)に示すように”
曖昧候補を導入する宣言”に対応する規約インデックス
として”N1::f(t) N2::f(t) using N1::f N2::f ”が取
り出される。このように、導入対象外の同名宣言を行っ
ており意図しない操作になる可能性がある場合には、出
力部7から、その旨が通知される。この例の場合、usin
g A::f; によりA::(int)とA::(char) が候補になり、us
ing B::fによりB::(int)とB::(long) が候補になる。こ
の時点ではエラーにならないが、後でf(int)が使われた
とき、曖昧になるので、そのような宣言がある旨を通知
する。
FIG. 10 shows syntax analysis information and convention information in Example 4. The result of the syntax analysis is as shown in FIG. 7A. In this example, a declaration to introduce an ambiguous candidate has been made, and there is a possibility that an unintended operation may be performed. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG.
“N1 :: f (t) N2 :: f (t) using N1 :: f N2 :: f” is extracted as the contract index corresponding to the “declaration to introduce an ambiguous candidate”. If there is a possibility that an unintended operation may occur due to the declaration of the same name, the effect is notified from the output unit 7. In this example, usin
g A :: f; makes A: :( int) and A: :( char) candidates, and
ing B :: f makes B: :( int) and B: :( long) candidates. There is no error at this point, but when f (int) is used later, it will be ambiguous, so let us know that there is such a declaration.

【0031】(5)例5 名前を導入済みの宣言を多重定義していないかチェック
する。利用者の設定によりコードの生成が有効になって
いる場合、チェック結果に基づき、名前を再度導入する
コードを自動的、あるいは対話的に生成する。
(5) Example 5 It is checked whether a declaration in which a name has been introduced is not overloaded. If code generation is enabled by the user's settings, the code for re-introducing the name is automatically or interactively generated based on the check result.

【0032】 注1: fはA::f(int) を指す。 注2:using A::fにより隠される多重定義として通知。 注3: f(char)ではなくf(int)を呼ぶ。[0032] Note 1: f indicates A :: f (int). Note 2: Notified as overloaded by using A :: f. Note 3: Call f (int) instead of f (char).

【0033】図11に例5における構文解析情報、規約
情報を示す。構文解析結果は、同図(a)に示すように
なり、この例の場合、名前導入後の多重定義〔f(char)
は隠される多重定義となる〕を行っており意図しない操
作になる可能性がある。前記規約照合部5は上記構文解
析情報を規約形式に変換し、規約情報を検索する。この
場合、図11(b)に示すように”名前導入後の多重定
義”に対応する規約インデックスとして”N::f(t1) usi
ng N::f N::f(t2)”が取り出され、対応する処理p53
が取り出される。このように、名前導入後の多重定義を
行っており意図しない操作になる可能性がある場合に
は、出力部7から、その旨が通知される。
FIG. 11 shows syntax analysis information and convention information in Example 5. The result of the syntax analysis is as shown in FIG. 7A. In this example, the overloaded definition [f (char)
Is a hidden overloaded definition], which may result in unintended operations. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 11B, “N :: f (t1) usi” is a contract index corresponding to “multiple definition after name introduction”.
ng N :: f N :: f (t2) ”is taken out and the corresponding processing p53
Is taken out. As described above, when there is a possibility that an unintended operation may occur due to overloading after the introduction of the name, the output unit 7 notifies that fact.

【0034】この例の場合、using A::fによりf(int)が
定義されているので、f('a')は、f(char) ではなくf(in
t)を呼ぶことになる。したがって、f(char) は隠される
多重定義として通知する。また、利用者の設定により適
合コード例の生成が有効になっている場合には、解析情
報正規化部6は、適合コード例を生成し、出力部7から
出力する。この場合、次のように、using A::fにより再
度名前を導入する。これにより、f('a')は意図通りf(ch
ar) を呼ぶようになる。
In this example, since f (int) is defined by using A :: f, f ('a') is not f (char) but f (in).
t). Thus, f (char) signals as a hidden overload. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In this case, the name is introduced again by using A :: f as follows. Thus, f ('a') becomes f (ch
ar).

【0035】 注1:再度名前を導入。 注2:意図通りf(char) を呼ぶようになる。[0035] Note 1: The name is introduced again. Note 2: f (char) will be called as intended.

【0036】(6)例6 名前を導入済みのテンプレートの部分特殊化定義をおこ
なっていないかをチェックする。
(6) Example 6 It is checked whether a partial specialization definition of a template in which a name has been introduced is not performed.

【0037】 〔入力例6〕 template<class TI,class T2 > class Temp { };// (注1) template<class T > class Temp<T,T*>{ };//(注2) Temp<char, char* >t; // (注3) 注1:primary 注2:部分特殊化 注3:部分特殊化があるとどのテンプレートを使えばい
いか不明瞭になるので、特殊化定義を利用していること
を通知する。
[Input Example 6] template <class TI, class T2> class Temp {/; // (Note 1) template <class T> class Temp <T, T *>{}; // (Note 2) Temp <Char, char *>t; // (Note 3) Note 1: primary Note 2: Partial specialization Note 3: It is unclear which template to use if there is partial specialization. Notify that you are using it.

【0038】図12に例6における構文解析情報、規約
情報を示す。構文解析結果は、同図(a)に示すように
なり、この例の場合、不明瞭な部分特殊化を行っており
意図しない操作になる可能性がある。前記規約照合部5
は上記構文解析情報を規約形式に変換し、規約情報を検
索する。この場合、図12(b)に示すように”不明瞭
な部分特殊化”に対応する規約インデックスとして”te
mplate class T p-special T”が取り出される。このよ
うに、不明瞭な部分特殊化を行っており意図しない操作
になる可能性がある場合には、出力部7から、その旨が
通知される。この場合、Temp<char, char* >t でどの
テンプレートを使えばよいか不明瞭になるので、特殊化
定義を利用していることを通知する。
FIG. 12 shows syntax analysis information and convention information in Example 6. The result of the syntax analysis is as shown in FIG. 7A. In this example, an unclear operation is performed due to unclear partial specialization. The rule collation unit 5
Converts the parsing information into a convention format and retrieves the convention information. In this case, as shown in FIG. 12B, the rule index corresponding to “unclear partial specialization” is “te”.
mplate class T p-special T ”is extracted. In this way, if there is a possibility that an unintended operation is performed due to unclear partial specialization, the output unit 7 notifies the fact. In this case, it is unclear which template to use for Temp <char, char *> t, so it is notified that a specialization definition is used.

【0039】(7)例7 テンプレートの仮引数の開始終了記号(<,>)と同じ記号
がテンプレート定義の仮引数定義内で使用されていない
かチェックする。 〔入力例7〕template <int i=5 <<10> class
A{..};
(7) Example 7 It is checked whether the same symbol as the start / end symbol (<,>) of the formal parameter of the template is used in the formal parameter definition of the template definition. [Input Example 7] template <int i = 5 <<10> class
A {..};

【0040】図13に例7における構文解析情報、規約
情報を示す。構文解析結果は、同図(a)に示すように
なり、この例の場合、定義と混同しやすい初期値があり
〔5<<10 における< がテンプレート仮引数の開始記号<
と混同しやすい〕意図しない操作になる可能性がある。
前記規約照合部5は上記構文解析情報を規約形式に変換
し、規約情報を検索する。この場合、図13(b)に示
すように”定義と混同しやすい初期値”に対応する規約
インデックスとして”template param v=v1 << v2 ”が
取り出され、対応する処理p54が取り出される。この
ように、定義と混同しやすい初期値があり意図しない操
作になる可能性がある場合には、出力部7から、その旨
が通知される。この例の場合、上記のように5<<10 (5
を10ビット左シフト)における< がテンプレート仮引
数の開始記号< と混同しやすいため通知する。また、利
用者の設定により適合コード例の生成が有効になってい
る場合には、解析情報正規化部6は、適合コード例を生
成し、出力部7から出力する。この場合は次のように、
5<<10 を括弧で囲う。これにより誤解がなくなる。
FIG. 13 shows syntax analysis information and convention information in Example 7. The result of the syntax analysis is as shown in FIG. 7A. In this example, there is an initial value which is easily confused with the definition [<in 5 << 10 is the start symbol <of the template parameter.
[It is easy to confuse with].
The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 13B, “template param v = v1 << v2” is extracted as the rule index corresponding to “the initial value that is easily confused with the definition”, and the corresponding process p54 is extracted. As described above, when there is a possibility that an unintended operation may occur due to an initial value that is easily confused with the definition, the output unit 7 notifies the fact. In this example, as described above, 5 << 10 (5
Is shifted by 10 bits to the left), because <is easily confused with the start symbol <of the template dummy argument. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In this case,
Enclose 5 << 10 in parentheses. This eliminates misunderstandings.

【0041】〔出力例7〕 template<in i= (5<<10)> class A{ };[Output Example 7] template <in i = (5 << 10)> class A {};

【0042】(8)例8 テンプレートの実引数の開始終了記号と同じ記号がテン
プレートのインスタンスの実引数定義内で使用されてい
ないかチェックする。
(8) Example 8 It is checked whether the same symbol as the start / end symbol of the actual argument of the template is used in the actual argument definition of the instance of the template.

【0043】〔入力例8〕 template<class T> class C { }; C <X <3 >> 2> > c2; // (注1) 注1:テンプレート実引数がどれか判別しずらいので通
知する。
[Input Example 8] template <class T> class C {}; C <X <3 >>2>>c2; // (Note 1) Note 1: It is difficult to determine the actual template argument. Notice.

【0044】図14に例8における構文解析情報、規約
情報を示す。構文解析結果は、同図(a)に示すように
なり、この例の場合、不明瞭なテンプレート実引数があ
り意図しない操作になる可能性がある。前記規約照合部
5は上記構文解析情報を規約形式に変換し、規約情報を
検索する。この場合、図14(b)に示すように”不明
瞭なテンプレート実引数”に対応する規約インデックス
として”template arg T<v1>>v2>”が取り出され、対応
する処理p55が取り出される。このように、不明瞭な
テンプレート実引数があり意図しない操作になる可能性
がある場合には、出力部7から、その旨が通知される。
この例の場合、実引数の開始終了記号と同じ記号がテン
プレートのインスタンスの実引数定義 <3 >> 2> 内に含
まれており、混同しやすいので、その旨を通知する。ま
た、利用者の設定により適合コード例の生成が有効にな
っている場合には、解析情報正規化部6は、適合コード
例を生成し、出力部7から出力する。この場合には、次
のように、"3 >> 2 " を括弧で囲う。これにより誤解が
なくなる。
FIG. 14 shows syntax analysis information and convention information in Example 8. The result of the syntax analysis is as shown in FIG. 7A. In this example, there is a possibility that an unintended operation may occur due to an unclear template actual argument. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 14B, “template arg T <v1 >>v2>” is extracted as a rule index corresponding to “unclear template actual argument”, and a corresponding process p55 is extracted. As described above, when there is a possibility that an unintended operation may occur due to an unclear template actual argument, the output unit 7 notifies the fact.
In this example, the same symbol as the start / end symbol of the actual argument is included in the actual argument definition <3 >>2> of the template instance, and it is easy to get confused. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In this case, "3 >>2" is enclosed in parentheses as follows. This eliminates misunderstandings.

【0045】〔出力例8〕 template <class T> class C {}; C <X < (3 >>2)> > c3; //(注1) 注1:意図が明瞭なコード。[Output Example 8] template <class T> class C {}; C <X <(3 >> 2)>> c3; // (Note 1) Note 1: Code with clear intention.

【0046】(9)例9 メンバテンプレートと同じ名前のメンバ名を、明示的に
templateと指定せずに使用していないかチェックする。
利用者の設定によりコードの生成が有効になっている場
合、チェック結果に基づき、template付きのコードを自
動的、あるいは対話的に生成する。
(9) Example 9 A member name having the same name as the member template is explicitly specified.
Check if it is not used without specifying template.
If the code generation is enabled by the user setting, the code with template is generated automatically or interactively based on the check result.

【0047】 注1:< を1ess than と解釈できるため通知[0047] Note 1: Notice that <can be interpreted as 1ess than

【0048】図15に例9における構文解析情報、規約
情報を示す。構文解析結果は、同図(a)に示すように
なり、この例の場合、異なる解釈となるメンバがあり
〔明示的にtemplateと指定せずにget <10>(20) を使
用〕、意図しない操作になる可能性がある。前記規約照
合部5は上記構文解析情報を規約形式に変換し、規約情
報を検索する。この場合、図15(b)に示すように”
異なる解釈となるメンバ”に対応する規約インデックス
として”v1→[template] f1<v1>(v3) ”が取り出され、
対応する処理p56が取り出される。このように、異な
る解釈となるメンバがあり意図しない操作になる可能性
がある場合には、出力部7から、その旨が通知される。
この例の場合、C* p2=P1- >get <10>(20);におい
て、明示的にtemplateと指定せずにget <10>(20) を
使用しており、これは、演算式と解釈され<は1ess tha
n と解釈できるので、その旨を通知する。また、利用者
の設定により適合コード例の生成が有効になっている場
合には、解析情報正規化部6は、適合コード例を生成
し、出力部7から出力する。この場合には、次のよう
に、明示的にtemplateと指定した出力をする。
FIG. 15 shows syntax analysis information and convention information in Example 9. The result of the syntax analysis is as shown in FIG. 9A. In this example, there are members having different interpretations (use get <10> (20) without explicitly specifying template), and May not be an operation. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG.
“V1 → [template] f1 <v1> (v3)” is extracted as the contract index corresponding to the member that has a different interpretation.
The corresponding process p56 is extracted. As described above, when there is a possibility that an unintended operation may occur due to a member having a different interpretation, the output unit 7 notifies that fact.
In this example, in C * p2 = P1-> get <10>(20);, get <10> (20) is used without explicitly specifying a template. Interpreted <is 1ess tha
Since it can be interpreted as n, we will notify that effect. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In this case, output is explicitly specified as template as follows.

【0049】 〔出力例9〕 Class C{ Public: template <int > C * get(int); }; void foo (C * p1){ C * p2 =p1- >template get<10>(20)//(注1) } 注1:誤解のないコード[Output Example 9] Class C Public: template <int> C * get (int);}; void foo (C * p1) {C * p2 = p1-> template get <10> (20) / / (Note 1)} Note 1: Code without misunderstanding

【0050】(10)例10 べースクラスの仮想関数をテンプレート関数でオーバー
ライド(ベースクラスの仮想関数を派生クラスで上書
き)しようとしていないかチェックする。
(10) Example 10 It is checked whether an attempt is made to override a virtual function of a base class with a template function (overwrite a virtual function of a base class with a derived class).

【0051】 注1:べ−スクラスの関数をオーバーライドする意図で
定義しているかもしれないので通知(オーバライドでき
ない)。
[0051] Note 1: Notification (cannot be overridden) because it may be defined with the intention of overriding the base class functions.

【0052】図16に例10における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、隠蔽するオーバライドがあり、
意図しない操作になる可能性がある。前記規約照合部5
は上記構文解析情報を規約形式に変換し、規約情報を検
索する。この場合、図16(b)に示すように”隠蔽す
るオーバライド”に対応する規約インデックスとして”
vir C1::f,C1::C2::f ”が取り出され、隠蔽するオーバ
ライドがある旨が出力部7から通知される。
FIG. 16 shows syntax analysis information and convention information in Example 10. The result of the syntax analysis is as shown in FIG. 7A. In this example, there is an override to hide,
Unintended operation may occur. The rule collation unit 5
Converts the parsing information into a convention format and retrieves the convention information. In this case, as shown in FIG. 16B, the rule index corresponding to the “concealed override” is “
vir C1 :: f, C1 :: C2 :: f "are extracted, and the output unit 7 notifies that there is an override to hide.

【0053】(11)例11 テンプレート名を使ったメンバでテンプレート仮引数が
省略されたものがないかチェックする。利用者の設定に
よりコードの生成が有効になっている場合、チェック結
果に基づき、テンプレー卜仮引数を省略していないコー
ドを自動的、あるいは対話的に生成する。
(11) Example 11 It is checked whether there is any member using the template name and the template parameter is omitted. If code generation is enabled by the user's settings, a code that does not omit the template parameter is automatically or interactively generated based on the check result.

【0054】 注1: A<T>*x と解釈されるが、その意図が明瞭でない
ため通知。
[0054] Note 1: Interpreted as A <T> * x, but noticed because the intent is not clear.

【0055】図17に例11における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、省略された宣言があり、意図し
ない操作になる可能性がある。前記規約照合部5は上記
構文解析情報を規約形式に変換し、規約情報を検索す
る。この場合、図17(b)に示すように”省略された
宣言”に対応する規約インデックスとして”template<t
1> T2[<T1>] T3”が取り出され、対応する処理p57が
取り出される。このように、省略された宣言があり意図
しない操作になる可能性がある場合には、出力部7か
ら、その旨が通知される。この例の場合、A *x; は A <
T>*xと解釈されるが、その意図が明瞭でないため通知す
る。また、利用者の設定により適合コード例の生成が有
効になっている場合には、解析情報正規化部6は、適合
コード例を生成し、出力部7から出力する。この場合に
は、次のように、明示的にA <T>*x とコードを生成す
る。
FIG. 17 shows syntax analysis information and convention information in Example 11. The result of the syntax analysis is as shown in FIG. 7A. In this example, there is a declaration omitted, and an unintended operation may be performed. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 17B, “template <t
1> T2 [<T1>] T3 ”is extracted, and the corresponding process p57 is extracted. As described above, if there is a possibility that an unintended operation is performed due to the omitted declaration, the output unit 7 outputs In this case, A * x; becomes A <
Interpreted as T> * x, but will be notified because the intent is not clear. When the generation of the conforming code example is enabled by the setting of the user, the analysis information normalizing unit 6 generates the conforming code example and outputs it from the output unit 7. In this case, A <T> * x is explicitly generated as follows.

【0056】 注1:明示的にA <T > *x とコードを生成。[0056] Note 1: A <T> * x and code are explicitly generated.

【0057】(12)例12 テンプレートパラメータが隠されるようなテンプレート
を宣言していないかチェックする。利用者の設定により
コードの生成が有効になっている場合、チェック結果に
基づき、テンプレートパラメータが隠されないコードを
自動的、あるいは対話的に生成する。
(12) Example 12 It is checked whether a template that hides template parameters is declared. If code generation is enabled by the user's settings, a code that does not hide template parameters is automatically or interactively generated based on the check result.

【0058】 〔入力例12〕 template<class T> class Outer { class Inner {}; }; template<class Inner >void Outer<Inner >::foo() { Inner i;//(注1) } 注1:テンプレートパラメータではなくouter::Innerが
使われるが、それを認識せずに使用している可能性があ
るため通知する。
[Input Example 12] template <class T> class Outer {class Innerer; {}; template <class Inner> void Outer <Inner> :: foo () {Inner i; // (Note 1) (Note 1: Outer :: Inner is used instead of the template parameter, but it is notified because it may be used without recognizing it.

【0059】図18に例12における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、テンプレート仮引数名の隠蔽が
あり意図しない操作になる可能性がある。前記規約照合
部5は上記構文解析情報を規約形式に変換し、規約情報
を検索する。この場合、図18(b)に示すように”テ
ンプレート仮引数名の隠蔽”に対応する規約インデック
スとして”template<T> C::f{C::T v}" が取り出さ
れ、対応する処理p58が取り出される。このように、
テンプレート仮引数名の隠蔽があり意図しない操作にな
る可能性がある場合には、出力部7から、その旨が通知
される。
FIG. 18 shows syntax analysis information and convention information in Example 12. The result of the syntax analysis is as shown in FIG. 9A. In this example, there is a possibility that the operation is not intended because the template parameter name is hidden. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 18B, “template <T> C :: f {C :: T v}” is extracted as a contract index corresponding to “concealment of template parameter name”, and the corresponding processing is performed. p58 is taken out. in this way,
If there is a possibility that an unintended operation may occur due to concealment of the template parameter name, the output unit 7 notifies that fact.

【0060】この例の場合、テンプレートパラメータで
はなくouter::Innerが使われるが、”template<class
Inner >void Outer<Inner >::foo() ”において、そ
れを認識せずに使用している可能性があるため、その旨
を通知する。また、利用者の設定により適合コード例の
生成が有効になっている場合には、解析情報正規化部6
は、適合コード例を生成し、出力部7から出力する。こ
の例の場合、次のように、テンプレートパラメータの名
前を” Inner_sub”と変更して、ローカルクラス名と
区別する適合コード例を生成し、出力部6から出力す
る。
In this example, outer :: Inner is used instead of the template parameter, but “template <class
Inner> void Outer <Inner> :: foo () ”", it may be used without recognizing it. If it is enabled, the analysis information normalization unit 6
Generates a conforming code example and outputs it from the output unit 7. In the case of this example, the name of the template parameter is changed to “Inner_sub” as follows, and a conforming code example that is distinguished from the local class name is generated and output from the output unit 6.

【0061】 〔出力12〕 template<class T> class Outer { class Inner i; }; template<class Inner_sub>void Outer<Inner_sub >::foo() { //(注1) Inner i; } 注1:テンプレートパラメータの名前を変更してローカ
ルクラス名と区別する
[Output 12] template <class T> class Outer {class Inner i;}; template <class Inner_sub> void Outer <Inner_sub> :: foo () {// (Note 1) Inner i;} Note 1: Rename template parameters to distinguish them from local class names

【0062】(13)例13 テンプレートパラメータが他の名前を隠してしまうよう
なテンプレートを宣言していないかチェックする。利用
者の設定によりコードの生成が有効になっている場合、
チェック結果に基づき、テンプレートパラメータが隠さ
ないコードを自動的、あるいは対話的に生成する。
(13) Example 13 It is checked whether a template parameter declares a template that hides another name. If code generation is enabled by user settings,
Based on the check result, automatically or interactively generate code that does not hide template parameters.

【0063】 〔入力例13〕 namespace N { class A {}; template <class T> class B { void foo (T); }; } template<class A >void N::B <A >::f(A) { A a;//(注1) } 注1:前の例とは逆に、namespace の場合はここでのA
はN::Aではなく、テンプレートパラメータのA となる。
前の例のように意図している可能性を考慮して通知す
る。
[Input Example 13] namespace N {class A {}; template <class T> class B {void foo (T);};} template <class A> void N :: B <A> :: f ( A) {A a; // (Note 1)} Note 1: Contrary to the previous example, in the case of namespace, A here
Becomes the template parameter A instead of N :: A.
Notify in consideration of the possibility of intention as in the previous example.

【0064】図19に例13における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、クラス名の隠蔽があり意図しな
い操作になる可能性がある。前記規約照合部5は上記構
文解析情報を規約形式に変換し、規約情報を検索する。
この場合、図19(b)に示すように”クラス名の隠
蔽”に対応する規約インデックスとして”namespace
N::C,template<C>:: f{C v }" が取り出され、対応す
る処理p59が取り出される。このように、クラス名の
隠蔽があり意図しない操作になる可能性がある場合に
は、出力部7から、その旨が通知される。この例の場
合、例12とは逆に、namespace の場合は、ここでのA
はN::Aではなく、テンプレートパラメータのA となる。
そこで、例12の例のように意図している可能性を考慮
して、その旨を通知する。利用者の設定によりコードの
生成が有効になっている場合には、解析情報正規化部6
は、次のように、テンプレートパラメータの名前を変更
したコード” A sub a " を生成し、変数の型をテンプレ
ートパラメータに合わせて変更した適正コード例を生成
し、出力部6から出力する。
FIG. 19 shows syntax analysis information and rules in Example 13.
Show about information. The result of the syntax analysis is as shown in FIG.
In this case, the class name is hidden and unintended.
Operation may be difficult. The contract collation unit 5 is configured as described above.
Converts sentence analysis information into a convention format and searches for convention information.
In this case, as shown in FIG.
"Namespace" as a contract index corresponding to
N :: C, template <C> :: f {C v} "
The process p59 is taken out. Thus, the class name
When there is a possibility of unintended operation due to concealment
Is notified from the output unit 7 to that effect. In this example
In the case of namespace, contrary to Example 12, A
Becomes the template parameter A instead of N :: A.
Therefore, consider the possibility of intention as in the example of Example 12.
And notify that effect. Depending on user settings,
If the generation is enabled, the analysis information normalization unit 6
Renamed template parameters as follows
Code “A sub a "and generate a template
Generates an appropriate code example changed according to the
Then, the data is output from the output unit 6.

【0065】 〔出力例13〕 namespace N{ Class A {}; template<class T> class B{ void foo(T); }; } template<class A sub >void N::B <A sub >::f(A){ //(注1) A sub a;//(注2) } 注1:テンプレートパラメータの名前を変更したコード
を生成。 注2:変数の型をテンプレートパラメータに合わせて変
[Output Example 13] namespace N {Class A {}; template <class T> class B {void foo (T);};} template <class A sub> void N :: B <A sub> :: f (A) {// (Note 1) A sub a; // (Note 2)} Note 1: Generated code with changed template parameter names. Note 2: Change the variable type to match the template parameter

【0066】(14)例14 例外処理の出現を検出し、正しくthrow (例外が起こっ
たときに呼び出す関数の定義)で受け取られているかを
チェックする。利用者の設定によりコードの生成が有効
になっている場合、チェック結果に基づき、throw を使
うコードを自動的、あるいは対話的に出力する。
(14) Example 14 The occurrence of exception handling is detected, and it is checked whether the exception is correctly received by throw (definition of a function to be called when an exception occurs). If code generation is enabled by the user setting, the code that uses throw is output automatically or interactively based on the check result.

【0067】 注1:W は例外の指定(X) にないのでunexpected()を呼
び出す。指定していると思い込んでいるかもしれないの
で通知する。
[0067] Note 1: Call unexpected () because W is not in exception specification (X). Notify that you may have assumed that you have specified it.

【0068】図20に例14における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、宣言のないthrow があり意図し
ない操作になる可能性がある。前記規約照合部5は上記
構文解析情報を規約形式に変換し、規約情報を検索す
る。この場合、図19(b)に示すように”宣言のない
throw ”に対応する規約インデックスとして”f throw
(T1) {throw T2}" が取り出され、対応する処理p6
0が取り出される。この例の場合、W は例外の指定(X)
にないのでunexpected()を呼び出す。そこで、ユーザが
例外の指定していると思い込んでいるかもしれないの
で、その旨を通知する。また、利用者の設定によりコー
ドの生成が有効になっている場合には、解析情報正規化
部6は、次のように、throw に wを追加したコードを生
成し、出力部6から出力する。
FIG. 20 shows syntax analysis information and convention information in Example 14. The result of the syntax analysis is as shown in FIG. 7A. In this example, there is a possibility that there is an undeclared throw and an unintended operation is performed. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG.
"f throw" as a contract index corresponding to "throw"
(T1) {throw T2} "is taken out and the corresponding processing p6
0 is taken out. In this case, W is the exception specification (X)
Call unexpected () because it is not. Therefore, the user may assume that an exception has been designated, so that the user is notified. When code generation is enabled by the user's settings, the analysis information normalization unit 6 generates a code in which w is added to throw and outputs it from the output unit 6 as follows. .

【0069】 注1:w を追加したコードを生成[0069] Note 1: Generate code with w added

【0070】(15)例15 代入演算子を検出し、正しく*thisを返しているかをチ
ェックする。利用者の設定によりコードの生成が有効に
なっている場合、チェック結果に基づき、*thisを返す
コードを自動的、あるいは対話的に出力する。
(15) Example 15 An assignment operator is detected, and it is checked whether * this is correctly returned. If code generation is enabled by user settings, the code that returns * this is automatically or interactively output based on the check result.

【0071】 注1:最後に *thisを返していないため通知[0071] Note 1: Notification because * this is not returned at the end

【0072】図21に例15における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、演算子の復帰値が正しく*this
を返していないので、意図しない操作になる可能性があ
る。前記規約照合部5は上記構文解析情報を規約形式に
変換し、規約情報を検索する。この場合、図21(b)
に示すように”演算子の復帰値”に対応する規約インデ
ックスとして”operator=return v " が取り出され、対
応する処理p61が取り出される。この例の場合、” r
eturn rhs; ”で *thisを返していないため通知する。
利用者の設定によりコードの生成が有効になっている場
合には、解析情報正規化部6は、次のように、 return
*thisとし、 *thisを返すコードを生成し、出力部6か
ら出力する。
FIG. 21 shows syntax analysis information and convention information in Example 15. The result of the syntax analysis is as shown in FIG. 11A. In this example, the return value of the operator is * this
Is not returned, there is a possibility that the operation will be unintended. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, FIG.
As shown in (2), "operator = return v" is extracted as a rule index corresponding to "return value of operator", and a corresponding process p61 is extracted. In this case, "r
eturn rhs; ”does not return * this.
If code generation is enabled by the user's setting, the analysis information normalization unit 6 returns
A code that returns * this and * this is generated and output from the output unit 6.

【0073】 注1: *thisを返すコードを生成[0073] Note 1: Generate code that returns * this

【0074】(16)例16 評価順序が不定なグローバルオブジェクトが存在しない
かチェックする。
(16) Example 16 It is checked whether there is any global object whose evaluation order is uncertain.

【0075】 注1:b1はb に依存しているが、b が先に初期化されて
いるとは限らないので通知。
[0075] Note 1: b1 depends on b, but is notified because b is not always initialized first.

【0076】図22に例16における構文解析情報、規
約情報を示す。構文解析結果は、同図(a)に示すよう
になり、この例の場合、評価順序が不定な変数定義があ
るので、意図しない操作になる可能性がある。前記規約
照合部5は上記構文解析情報を規約形式に変換し、規約
情報を検索する。この場合、図21(b)に示すよう
に”評価順序が不定な変数定義”に対応する規約インデ
ックスとして”global T1 v1,global T2 v2,v1=v2"が取
り出される。この例の場合、”B b1=b "におけるb1は、
b に依存しているが、ファイルB.hとファイルB.ccの実
行順序がわからないので、b が先に初期化されていると
は限らないので、出力部6からその旨を通知する。
FIG. 22 shows syntax analysis information and convention information in Example 16. The result of the syntax analysis is as shown in FIG. 9A. In this example, since there is a variable definition whose evaluation order is uncertain, an unintended operation may be performed. The rule checking unit 5 converts the syntax analysis information into a rule format and searches for the rule information. In this case, as shown in FIG. 21B, “global T1 v1, global T2 v2, v1 = v2” is extracted as a rule index corresponding to “variable definition whose evaluation order is undefined”. In this example, b1 in "B b1 = b" is
Although it depends on b, since the execution order of the file Bh and the file B.cc is not known, b is not always initialized first, and the output unit 6 notifies the fact.

【0077】[0077]

【発明の効果】以上説明したように本発明においては、
オブジェクト指向プログラム作成支援装置において、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを設け、構文解析部の
解析結果を利用して、規約照合機能により、プログラム
のコードの規約に対する違反の有無をチェックし、規約
に適合したコードを生成しているので、入力プログラム
を解析してプログラムの規約に対する違反を指摘するこ
とができ、また、規約に適合したコードの例を生成する
ことが可能となる。
As described above, in the present invention,
An object-oriented program creation support device, comprising: a rule checking unit that checks a syntax analysis result of an input program against rule information; and an analysis information normalizing unit that outputs a program corrected based on the matching result. Using the result of the analysis, the rule checking function checks for violations of the rules of the program code, and generates code that conforms to the rules. It is possible to generate an example of code that can be pointed out and conforms to the convention.

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

【図1】本発明の原理構成図である。FIG. 1 is a principle configuration diagram of the present invention.

【図2】本発明の実施例のオブジェクト指向プログラム
作成支援装置の構成を示す図である。
FIG. 2 is a diagram illustrating a configuration of an object-oriented program creation support device according to an embodiment of the present invention.

【図3】構文解析を説明する図である。FIG. 3 is a diagram illustrating syntax analysis.

【図4】規約情報4の構造を説明する図である。FIG. 4 is a diagram illustrating the structure of agreement information 4.

【図5】規約照合部5における処理を示すフロチャート
である。
FIG. 5 is a flowchart showing processing in a contract collation unit 5;

【図6】解析結果例を示す図である。FIG. 6 is a diagram showing an example of an analysis result.

【図7】例1における解析結果例と、規約情報を示す図
である。
FIG. 7 is a diagram showing an example of an analysis result in Example 1 and rule information.

【図8】例2における解析結果例と、規約情報を示す図
である。
FIG. 8 is a diagram showing an example of an analysis result in Example 2 and rule information.

【図9】例3における解析結果例と、規約情報を示す図
である。
FIG. 9 is a diagram illustrating an example of an analysis result in Example 3 and rule information.

【図10】例4における解析結果例と、規約情報を示す
図である。
FIG. 10 is a diagram illustrating an example of an analysis result in Example 4 and rule information.

【図11】例5における解析結果例と、規約情報を示す
図である。
FIG. 11 is a diagram illustrating an example of an analysis result in Example 5 and rule information.

【図12】例6における解析結果例と、規約情報を示す
図である。
FIG. 12 is a diagram illustrating an example of an analysis result in Example 6 and rule information.

【図13】例7における解析結果例と、規約情報を示す
図である。
FIG. 13 is a diagram illustrating an example of an analysis result in Example 7 and rule information.

【図14】例8における解析結果例と、規約情報を示す
図である。
FIG. 14 is a diagram illustrating an example of an analysis result in Example 8 and rule information.

【図15】例9における解析結果例と、規約情報を示す
図である。
FIG. 15 is a diagram illustrating an example of an analysis result in Example 9 and rule information.

【図16】例10における解析結果例と、規約情報を示
す図である。
FIG. 16 is a diagram showing an example of an analysis result in Example 10 and rule information.

【図17】例11における解析結果例と、規約情報を示
す図である。
FIG. 17 is a diagram showing an example of an analysis result in Example 11 and rule information.

【図18】例12における解析結果例と、規約情報を示
す図である。
FIG. 18 is a diagram illustrating an example of an analysis result in Example 12 and rule information.

【図19】例13における解析結果例と、規約情報を示
す図である。
FIG. 19 is a diagram illustrating an example of an analysis result in Example 13 and rule information.

【図20】例14における解析結果例と、規約情報を示
す図である。
FIG. 20 is a diagram illustrating an example of an analysis result in Example 14 and rule information.

【図21】例15における解析結果例と、規約情報を示
す図である。
FIG. 21 is a diagram illustrating an example of an analysis result in Example 15 and rule information.

【図22】例16における解析結果例と、規約情報を示
す図である。
FIG. 22 is a diagram illustrating an example of an analysis result in Example 16 and rule information.

【符号の説明】[Explanation of symbols]

1 入力プログラム 2 構文解析部 3 構文解析情報 4 規約情報 5 規約照合部 6 解析情報正規化部 7 出力部 8 格納部 DESCRIPTION OF SYMBOLS 1 Input program 2 Syntax analysis part 3 Syntax analysis information 4 Convention information 5 Convention matching part 6 Analysis information normalization part 7 Output part 8 Storage part

フロントページの続き (72)発明者 中島 哲 神奈川県川崎市中原区上小田中4丁目1番 1号 富士通株式会社内 Fターム(参考) 5B042 GA02 HH10 5B076 EC03 Continuation of front page (72) Inventor Tetsu Nakajima 4-1-1, Kamidadanaka, Nakahara-ku, Kawasaki-shi, Kanagawa F-term in Fujitsu Limited (Reference) 5B042 GA02 HH10 5B076 EC03

Claims (16)

【特許請求の範囲】[Claims] 【請求項1】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、構文解析部の解析結果を利用して、
規約照合機能により、有効でない多重定義の宣言がない
かチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、上記チェック結果に基づ
き、宣言が有効になるコードを自動的、あるいは対話的
に生成することを特徴とするオブジェクト指向プログラ
ム作成支援装置。
An object-oriented program is input and a syntax analysis unit for analyzing the input program, a storage unit for storing convention information describing a convention of the program, and a result of syntax analysis of the input program are compared with the convention information. An object-oriented program creation support device having a rule collating unit and an analysis information normalizing unit that outputs a program corrected based on a result of the collation, wherein the rule collating unit uses an analysis result of the syntax analyzing unit. hand,
The rules collation function checks if there is no invalid overloaded declaration. If the code generation is enabled by the user setting, the analysis information normalization unit validates the declaration based on the above check result. An object-oriented program creation support device characterized by automatically or interactively generating a code that becomes
【請求項2】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、構文解析部の解析結果を利用して、
規約照合機能により、異なるスコープで同じ宣言を行っ
ていないかチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
同じ宣言にならないコードを自動的、あるいは対話的に
生成する。ことを特徴とするオブジェクト指向プログラ
ム作成支援装置。
2. A syntax analysis unit for analyzing an input program by using an object-oriented program as an input, a storage unit for storing convention information describing a convention of the program, and comparing a syntax analysis result of the input program with the convention information. An object-oriented program creation support device having a rule collating unit and an analysis information normalizing unit that outputs a program corrected based on a result of the collation, wherein the rule collating unit uses an analysis result of the syntax analyzing unit. hand,
Check whether the same declaration is made in different scopes by the rule matching function.If the code generation is enabled by the user setting, the analysis information normalization unit
Automatically or interactively generate code that does not have the same declaration. An object-oriented program creation support device, characterized in that:
【請求項3】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、名前を導入する宣言と同じ宣言が異なるスコー
プに存在しないかチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
同じ宣言にならないコードを自動的、あるいは対話的に
生成することを特徴とするオブジェクト指向プログラム
作成支援装置。
3. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. The function checks whether the same declaration as the one that introduces the name exists in a different scope.If the code generation is enabled by the user's settings, the analysis information normalization unit checks based on the check result.
An object-oriented program creation support device characterized in that codes that do not have the same declaration are automatically or interactively generated.
【請求項4】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、名前空間の宣言で候補が曖昧になる宣言を行っ
ていないかをチェックすることを特徴とするオブジェク
ト指向プログラム作成支援装置。
4. A syntax analysis unit for analyzing an input program with an object-oriented program as an input, a storage unit for storing convention information describing a convention of the program, and checking a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. An object-oriented program creation support device characterized in that it checks whether or not a declaration that makes a candidate ambiguous in a namespace declaration is made by a function.
【請求項5】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、名前を導入済みの宣言を多重定義していないか
チェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
名前を再度導入するコードを自動的、あるいは対話的に
生成することを特徴とするオブジェクト指向プログラム
作成支援装置。
5. A syntax analysis unit for analyzing an input program by using an object-oriented program as an input, a storage unit for storing convention information describing a convention of the program, and checking a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. The function checks whether the declaration with the name already introduced is not overloaded.If the code generation is enabled by the user setting, the analysis information normalization unit
An object-oriented program creation support device characterized in that a code for re-introducing a name is automatically or interactively generated.
【請求項6】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、名前を導入済みのテンプレート部分特殊化定義
をおこなっていないかをチェックすることを特徴とする
オブジェクト指向プログラム作成支援装置。
6. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. An object-oriented program creation support device characterized by checking whether a template partial specialization definition whose name has been introduced is performed by a function.
【請求項7】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、テンプレートの仮引数の開始終了記号と同じ記
号がテンプレート定義の仮引数定義内で使用されていな
いかチェックすることを特徴とするオブジェクト指向プ
ログラム作成支援装置。
7. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. An object-oriented program creation support device, characterized in that the function checks whether the same symbol as the start / end symbol of the template parameter is used in the template parameter definition.
【請求項8】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、テンプレートの実引数の開始終了記号と同じ記
号がテンプレートのインスタンスの実引数定義内で使用
されていないかチェックすることを特徴とするオブジェ
クト指向プログラム作成支援装置。
8. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. An object-oriented program creation support device characterized in that the function checks whether the same symbol as the start / end symbol of the actual argument of the template is used in the actual argument definition of the instance of the template.
【請求項9】 オブジェクト指向プログラムを入力とし
て、入力プログラムを解析する構文解析部と、プログラ
ムの規約を記述する規約情報を格納する格納部と、入力
プログラムの構文解析結果と規約情報とを照合する規約
照合部と、照合した結果に基づき修正されたプログラム
を出力する解析情報正規化部とを有するオブジェクト指
向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、メンバテンプレートと同じ名前のメンバ名を、
明示的にテンプレートと指定せずに使用していないかチ
ェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
テンプレート付きのコードを自動的、あるいは対話的に
生成することを特徴とするオブジェクト指向プログラム
作成支援装置。
9. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. By the function, the member name of the same name as the member template,
Check if it is not used without explicitly designating it as a template. If the code generation is enabled by the user's setting, the analysis information normalization unit
An object-oriented program creation support device characterized by automatically or interactively generating a code with a template.
【請求項10】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、べースクラスの仮想関数をテンプレート関数で
オーバーライドしようとしていないかチェックすること
を特徴とするオブジェクト指向プログラム作成支援装
置。
10. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. An object-oriented program creation support device characterized by checking whether a function of a base class is to be overridden by a template function by a function.
【請求項11】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、テンプレート名を使ったメンバでテンプレート
仮引数が省略されたものがないかチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
テンプレー卜仮引数を省略していないコードを自動的、
あるいは対話的に生成することを特徴とするオブジェク
ト指向プログラム作成支援装置。
11. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. The function checks whether the template parameter is omitted in the member using the template name. If the code generation is enabled by the user setting, the analysis information normalization unit checks the result. Based on
Code that does not omit template parameters is automatically
Alternatively, an object-oriented program creation support device characterized by generating interactively.
【請求項12】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、テンプレートパラメータが隠されるようなテン
プレートを宣言していないかチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
テンプレートパラメータが隠されないコードを自動的、
あるいは対話的に生成することを特徴とするオブジェク
ト指向プログラム作成支援装置。
12. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. Check if the template declares a template parameter that is hidden by the function.If the code generation is enabled by the user's settings, the analysis information normalization unit
Automatically hide code where template parameters are not hidden,
Alternatively, an object-oriented program creation support device characterized by generating interactively.
【請求項13】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、テンプレートパラメータが他の名前を隠してし
まうようなテンプレートを宣言していないかチェック
し、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
テンプレートパラメータが隠さないコードを自動的、あ
るいは対話的に生成することを特徴とするオブジェクト
指向プログラム作成支援装置。
13. An object-oriented program as an input, a syntax analysis section for analyzing the input program, a storage section for storing convention information describing the conventions of the program, and collating the syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. The function checks whether the template parameter declares a template that hides other names.If the code generation is enabled by the user, the analysis information normalization unit checks Based on the results,
An object-oriented program creation support device characterized by automatically or interactively generating a code in which template parameters are not hidden.
【請求項14】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、例外処理の出現を検出し、正しい関数で受け取
られているかをチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
正しい関数を使うコードを自動的、あるいは対話的に生
成することを特徴とするオブジェクト指向プログラム作
成支援装置。
14. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. The function detects the occurrence of exception processing and checks whether it has been received by the correct function.If the code generation is enabled by the user setting, the analysis information normalization unit ,
An object-oriented program creation support device characterized by automatically or interactively generating code using a correct function.
【請求項15】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、規約照合機能により代入演算子を検出し、正し
い復帰値を返しているかをチェックし、 上記解析情報正規化部は、利用者の設定によりコードの
生成が有効になっている場合、チェック結果に基づき、
正しい復帰値を返すコードを自動的、あるいは対話的に
生成することを特徴とするオブジェクト指向プログラム
作成支援装置。
15. A syntax analysis unit that analyzes an input program with an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. According to the function, the assignment operator is detected by the rule collation function, and it is checked whether the return value is correct.If the code generation is enabled by the user setting, the analysis information normalization unit checks Based on the results,
An object-oriented program creation support device for automatically or interactively generating a code that returns a correct return value.
【請求項16】 オブジェクト指向プログラムを入力と
して、入力プログラムを解析する構文解析部と、プログ
ラムの規約を記述する規約情報を格納する格納部と、入
力プログラムの構文解析結果と規約情報とを照合する規
約照合部と、照合した結果に基づき修正されたプログラ
ムを出力する解析情報正規化部とを有するオブジェクト
指向プログラム作成支援装置であって、 上記規約照合部は、解析結果を利用して、規約照合機能
により、評価順序が不定なグローバルオブジェクトが存
在しないかチェックすることを特徴とするオブジェクト
指向プログラム作成支援装置。
16. A syntax analysis unit that analyzes an input program by using an object-oriented program as an input, a storage unit that stores convention information describing a convention of the program, and compares a syntax analysis result of the input program with the convention information. What is claimed is: 1. An object-oriented program creation support device comprising: a rule collating unit; and an analysis information normalizing unit for outputting a program corrected based on a result of the collation. An object-oriented program creation support device characterized by checking whether there is a global object whose evaluation order is uncertain by a function.
JP10301122A 1998-10-22 1998-10-22 Object directing program generation support device Pending JP2000132387A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10301122A JP2000132387A (en) 1998-10-22 1998-10-22 Object directing program generation support device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10301122A JP2000132387A (en) 1998-10-22 1998-10-22 Object directing program generation support device

Publications (2)

Publication Number Publication Date
JP2000132387A true JP2000132387A (en) 2000-05-12
JP2000132387A5 JP2000132387A5 (en) 2004-12-02

Family

ID=17893102

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10301122A Pending JP2000132387A (en) 1998-10-22 1998-10-22 Object directing program generation support device

Country Status (1)

Country Link
JP (1) JP2000132387A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002073369A (en) * 2000-06-12 2002-03-12 Fujitsu Ltd Support device for improving efficiency of object- oriented program and recording medium and program
WO2002046921A1 (en) * 2000-12-08 2002-06-13 Fujitsu Limited Sequence analysis method and sequence analysis apparatus
JP2007249264A (en) * 2006-03-13 2007-09-27 Fujitsu Ltd Program, method and apparatus for analyzing program
JP2010140407A (en) * 2008-12-15 2010-06-24 Nomura Research Institute Ltd Source code inspection device
JP2014134962A (en) * 2013-01-10 2014-07-24 Fujitsu Marketing Ltd Source code conversion device, source code conversion method, and source code conversion program

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002073369A (en) * 2000-06-12 2002-03-12 Fujitsu Ltd Support device for improving efficiency of object- oriented program and recording medium and program
WO2002046921A1 (en) * 2000-12-08 2002-06-13 Fujitsu Limited Sequence analysis method and sequence analysis apparatus
US7062751B2 (en) 2000-12-08 2006-06-13 Fujitsu Limited Sequence analysis method and apparatus
JP2007249264A (en) * 2006-03-13 2007-09-27 Fujitsu Ltd Program, method and apparatus for analyzing program
JP2010140407A (en) * 2008-12-15 2010-06-24 Nomura Research Institute Ltd Source code inspection device
JP2014134962A (en) * 2013-01-10 2014-07-24 Fujitsu Marketing Ltd Source code conversion device, source code conversion method, and source code conversion program

Similar Documents

Publication Publication Date Title
Odersky et al. The Scala language specification
US7398516B2 (en) Method and system for detecting race condition vulnerabilities in source code
Murphy et al. An empirical study of static call graph extractors
Deursen et al. Language Prototyping: an algebraic specification approach
US7865870B2 (en) Automatic content completion of valid values for method argument variables
US8156483B2 (en) Method and system for detecting vulnerabilities in source code
US7293261B1 (en) Language-neutral representation of software code elements
Rodriguez et al. Comparing libraries for generic programming in Haskell
US20040194072A1 (en) Multi-language compilation
JP2008251033A (en) Method for generic object oriented description of structured data (gdl)
Bravenboer et al. Preventing injection attacks with syntax embeddings
Badros et al. A framework for preprocessor‐aware C source code analyses
JPH1185496A (en) Support device for production of object-oriented program
US20080141230A1 (en) Scope-Constrained Specification Of Features In A Programming Language
JP2000132387A (en) Object directing program generation support device
Kleppe Towards the generation of a text-based IDE from a language metamodel
Kohn et al. Dynamic pattern matching with Python
Koskimies et al. The design of a language processor generator
Petrescu et al. Do names echo semantics? A large-scale study of identifiers used in C++’s named casts
Nakamaru et al. Generating fluent embedded domain-specific languages with subchaining
Rózsa et al. Don't DIY: Automatically transform legacy Python code to support structural pattern matching
Papurt Inside the Object Model: the sensible Use of C++
Graver The evolution of an object‐oriented compiler framework
Parr Language translation using PCCTS and C++(a reference guide)
Zingaro Modern extensible languages

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060814

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060822

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061019

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20061226