JPH0439731A - Comment extracting method - Google Patents

Comment extracting method

Info

Publication number
JPH0439731A
JPH0439731A JP14829190A JP14829190A JPH0439731A JP H0439731 A JPH0439731 A JP H0439731A JP 14829190 A JP14829190 A JP 14829190A JP 14829190 A JP14829190 A JP 14829190A JP H0439731 A JPH0439731 A JP H0439731A
Authority
JP
Japan
Prior art keywords
comment
comments
symbol
processing
statement
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
JP14829190A
Other languages
Japanese (ja)
Inventor
Kenji Hirabayashi
平林 健二
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP14829190A priority Critical patent/JPH0439731A/en
Publication of JPH0439731A publication Critical patent/JPH0439731A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

PURPOSE:To easily implement with respect to various coding codes by processing comment symbol correspondence information for showing the correspondence of a comment in a program and a symbol in a chart as data on a memory. CONSTITUTION:A comment deciding part 12 for deciding whether a comment is added to a statement in a program or not, and a comment processing part 14 for processing the comment after the comment is decided are provided, and comment symbol correspondence information 13 for showing the correspondence of the comment in the program and a symbol in the chart is processed as data on a memory. In such a way, by only a change of the part of the end of a syntax rule and a flag operation, the correspondence of the comment and the statement can be taken, therefore, it is possible to implement easily with respect to various codes of how to put the comment.

Description

【発明の詳細な説明】 産業上の利用分野 本発明はプログラムレベルから詳細レベルにドキュメン
ト(構造化チャート)を生成するチャート生成システム
におけるコメント抽出方法に関するものである。
DETAILED DESCRIPTION OF THE INVENTION Field of Industrial Application The present invention relates to a comment extraction method in a chart generation system that generates documents (structured charts) from a program level to a detailed level.

従来の技術 従来より、ソフトウエエ開発環境におけるコーディング
規約を対象にして、チャート生成システムがつくられて
いたため、このコーディング規約は一つに決められてお
り、この規約は簡単には変更できなかった。
BACKGROUND ART Conventionally, chart generation systems have been created based on coding conventions in software development environments, so this coding convention has been determined to be one, and this convention cannot be easily changed.

チャートにおけるコメントは、チャートのシンボルとそ
のシンボル内に記述されているステートメントとの間を
1対1に対応させるものであり、そのコメントに記述さ
れている処理内容を見ることにより、そのチャートに記
述されているモジュールの処理内容が理解できる。
Comments in a chart provide a one-to-one correspondence between a chart symbol and a statement written in that symbol. You can understand the processing contents of the module being used.

発明が解決しようとする課題 従って、チャートに変換しようとするソースプログラム
についても、プログラムの処理内容を説明できるような
コメントのつけ方を規定した規約が必要であっ。
Problems to be Solved by the Invention Accordingly, for a source program to be converted into a chart, there is a need for a convention specifying how to add comments that can explain the processing contents of the program.

また、このコーディング規約は、一つ決めればすべてに
通用するというものではなく、作成するシステムや、ソ
フトウェア環境によってそれぞれに適応した形に変える
必要があった。
Furthermore, these coding conventions were not meant to be universally applicable; they had to be modified to suit each system and software environment to be created.

本発明は以上のようなコメント抽出方法に鑑み、様々な
コーディング規約に対し、容易にインプリメントできる
ようにすることを目的とする。
In view of the comment extraction method as described above, the present invention aims to enable easy implementation of various coding conventions.

課題を解決するための手段 この目的を達成するために、本発明はプログラム中のス
テートメントにコメントが付加されているか否かを判定
するコメント判定部と、コメント判定部の判定後にコメ
ントの処理を行うコメント処理部と、プログラム中のコ
メントとチャート内のシンボルとの対応を示すコメント
シンボル対応情報を具備し、コメントシンボル対応情報
をメモリ上のデータとして処理するように構成されてい
る。
Means for Solving the Problems In order to achieve this object, the present invention includes a comment determining unit that determines whether a comment is added to a statement in a program, and a comment processing unit that processes the comment after the comment determining unit makes a determination. It is equipped with a comment processing section and comment symbol correspondence information indicating the correspondence between comments in the program and symbols in the chart, and is configured to process the comment symbol correspondence information as data on the memory.

作用 本発明は上記構成により、構文規則の末端の部分の変更
とフラグ操作だけで、コメントとステートメントの対応
がとれるため、様々なコメントの付は方の規約に対して
容易にインプリメントすることができる。
Effects of the present invention With the above configuration, the correspondence between comments and statements can be established simply by changing the terminal part of the syntax rules and manipulating flags, so it can be easily implemented for various conventions for adding comments. .

実施例 以下、本発明の一実施例について図面を参照しながら説
明する。
EXAMPLE Hereinafter, an example of the present invention will be described with reference to the drawings.

第1図は本発明によるコメント抽出方法の一実施例を示
すブロック図である。
FIG. 1 is a block diagram showing an embodiment of the comment extraction method according to the present invention.

第1図に示すように、本発明によるコメント抽出方法は
、プログラム中のステートメントにコメントが付加され
ているか否かを判定するコメント判定部12と、判定後
コメントの処理を行うコメント処理部14と、プログラ
ム中のコメントとチャート内のシンボルとの対応を示す
コメントシンボルとの対応情報13を具備し、コメント
とシンボルとの対応情報13をメモリ上のデータとして
処理するように構成される。
As shown in FIG. 1, the comment extraction method according to the present invention includes a comment determining unit 12 that determines whether a comment has been added to a statement in a program, and a comment processing unit 14 that processes comments after the determination. , is provided with comment-symbol correspondence information 13 indicating the correspondence between comments in the program and symbols in the chart, and is configured to process the comment-symbol correspondence information 13 as data on the memory.

チャート生成構文解析部15の構文木の記述において、
終端記号−つ一つに対してコメントのつき方を定義し、
非終端記号とする。さらに、コメントの有無を示すフラ
グを設け、コメントがあった場合は、その非終端記号の
コメントのフラグをセットする。最終的に文を決定する
記述の部分で、フラグを見てコメント付きのステートメ
ントか否かを判定している。
In the description of the syntax tree of the chart generation syntax analysis unit 15,
Define how to add comments to each terminal symbol,
It is a non-terminal symbol. Furthermore, a flag indicating the presence or absence of a comment is provided, and if there is a comment, the comment flag for that non-terminal symbol is set. In the part of the description that ultimately determines the statement, flags are checked to determine whether or not the statement has comments.

次に本発明によるコメント抽出方法の動作について説明
する。なお、構文解析木の記述には、BNF記法(BU
CC[IS−NAUR−FORM rアルゴリズム子デ
ータ構造−PASCALプログラムN1klaus M
irth著片山卓也訳 日本コンピュータ協会コンピュ
ータサイエンス研究書シリーズ40」参照)を用いる。
Next, the operation of the comment extraction method according to the present invention will be explained. Note that the parse tree is written using BNF notation (BU
CC[IS-NAUR-FORM r algorithm child data structure-PASCAL program N1klaus M
irth, translated by Takuya Katayama, Japan Computer Association Computer Science Research Book Series 40).

また、コメントのテキストは、コメントのテキスト格納
用バッファ(コメントバッファと呼ぶ)に格納されてい
るものとする。
It is also assumed that the comment text is stored in a comment text storage buffer (referred to as a comment buffer).

コメントのコーディング規約は第8図のように(a) 
 コメントはステートメントの前につける。
The coding rules for comments are as shown in Figure 8 (a)
Add comments before the statement.

(b)  コメントはステートメントの横につける。(b) Comments should be placed next to the statement.

(C)  コメントはステートメントの後につける。(C) Add comments after the statement.

の3つに大別できる。It can be roughly divided into three types.

(a)のコーディング規約の場合の、構文解析木の記述
は、第2図のようになる。また、(a)の処理フローを
第5図に示す。
The description of the parse tree in the case of the coding convention (a) is as shown in FIG. Further, the processing flow of (a) is shown in FIG.

第2図でCOMMENTは字句解析部11から返される
コメントのトークン、STATEMENTはコメント以
外のステートメントのトークン、RETURNは改行の
トークンを表す。
In FIG. 2, COMMENT represents a comment token returned from the lexical analysis unit 11, STATEMENT represents a statement token other than a comment, and RETURN represents a line feed token.

処理は以下の通りとなる。The processing is as follows.

<1>5tat(第2図中の22)において、ステート
メントにコメントがあれば、コメントフラグをセットす
る(第5図中のステップ51.52)。
<1> At 5tat (22 in FIG. 2), if the statement has a comment, a comment flag is set (steps 51 and 52 in FIG. 5).

く2〉 状態expression (21)に遷移す
る(ステップ53)。
2> Transition to state expression (21) (step 53).

< 3 >  expressionにおいて、コメン
トフラグがセットされていれば、コメントバッファの中
身を出力する(ステップ54.55) 、セントされて
なければ出力しない(ステップ56)。
<3> In expression, if the comment flag is set, the contents of the comment buffer are output (steps 54 and 55); if not, the contents are not output (step 56).

〈4〉 コメントフラグをリセットする(ステップ57
)。
<4> Reset the comment flag (step 57)
).

〈5〉 次のトークンを持つ。<5> Have the following token.

[有])のコーディング規約の場合の構文解析木の記述
は、第3図のようになる。処理は以下の通りとなる。ま
た、(b)の処理フローを第6図に示す。
The description of the parse tree in the case of the coding convention of [Yes] is as shown in Fig. 3. The processing is as follows. Further, the processing flow of (b) is shown in FIG.

<1>  5tat(第3図中の32)において、ステ
ートメントにコメントがあれば、コメントフラグをセッ
トする(第6図中のステップ61.62)。
<1> At 5tat (32 in FIG. 3), if the statement has a comment, a comment flag is set (steps 61 and 62 in FIG. 6).

〈2〉 状態はexpression (31)に遷移
する(ステップ63)。
<2> The state transitions to expression (31) (step 63).

< 3 >  expressionにおいて、コメン
トフラグがセットされていれば、コメントバッファの中
身を出力する(ステップ64.65) 、セットされて
いなければ出力しない(ステップ66)。
<3> In expression, if the comment flag is set, the contents of the comment buffer are output (steps 64 and 65); if not, they are not output (step 66).

く4〉 コメントフラグをリセットする(ステップ67
)。
4> Reset the comment flag (step 67)
).

〈5〉 次のトークンを持つ。<5> Have the following token.

(C)のコーディング規約の場合の、構文解析木の記述
は第4図のようになる。(C)の処理フローを第7図に
示す。
In the case of the coding convention (C), the parse tree is described as shown in FIG. The processing flow of (C) is shown in FIG.

<1>5tat(第4図中の42)において、ステート
メントにコメントがあれば、コメントフラグをセットす
る(第7図中のステップ71.72)〈2〉 状態はe
xpression (41)に遷移する(テップ73
)。
<1> At 5tat (42 in Figure 4), if the statement has a comment, set the comment flag (steps 71 and 72 in Figure 7) <2> Status is e
Transition to xpression (41) (step 73)
).

< 3 >  expressionにおいて、コメン
トフラグがセットされていれば、コメントバッファの中
身を出力する(ステップ74.75) 、セットされて
なければ出力しない(ステップ76)。
<3> If the comment flag is set in expression, the contents of the comment buffer are output (steps 74 and 75); otherwise, they are not output (step 76).

〈4〉 コメントフラグをリセットする(ステップ77
)。
<4> Reset the comment flag (step 77)
).

〈5〉 次のトークンを持つ。<5> Have the following token.

以上のように、どのコーディング規約においても処理は
同じになり、構文解析木の記述も末端部分の修正で対応
ができる。
As mentioned above, the processing is the same regardless of the coding convention, and the description of the parse tree can be handled by modifying the terminal part.

なお、本発明は構造化チャート生成に対応するもので、
そのチャートの種類、対象となる処理言語の差異は、本
発明の範囲、主旨を制限するものではない。
Note that the present invention corresponds to structured chart generation.
Differences in chart types and target processing languages do not limit the scope or gist of the present invention.

発明の効果 以上のように本発明は、プログラム中のステートメント
にコメントが付加されているか否かを判定するコメント
判定部と、コメント判定部の判定後にコメントの処理を
行うコメント処理部と、プログラム中のコメントとチャ
ート内のシンボルとの対応を示すコメントシンボル対応
情報を具備し、コメントシンボル対応情報をメモリ上の
データとして処理するように構成したので、どのような
コメントの付は方の規約を設けても、構文規則の末端部
分の僅かな変更だけで、コメントとステートメントの対
応がとれ、インプリメントが容易となる。
Effects of the Invention As described above, the present invention includes a comment determining unit that determines whether a comment is added to a statement in a program, a comment processing unit that processes comments after the comment determining unit determines, The system is equipped with comment symbol correspondence information that shows the correspondence between comments and symbols in the chart, and is configured to process comment symbol correspondence information as data in memory, so rules for how to attach comments can be established. However, with only a slight change to the end of the syntax rules, comments and statements can be made to correspond, making implementation easier.

【図面の簡単な説明】 第1図は本発明によるコメント抽出方法の一実施例を示
すブロック図、第2図は“コメントはステートメントの
前につける”というコーディング規約がある場合の構文
解析木を示す本発明によるコメント抽出方法の一実施例
の動作を説明する概念図、第3図は“コメントはステー
トメントの横につける”というコーディング規約がある
場合の構文解析木を示す本発明によるコメント抽出方法
の一実施例の動作を説明する概念図、第4図は“コメン
トはステートメントの後につける”というコーディング
規約がある場合の構文解析木う示す本発明によるコメン
ト抽出方法の一実施例の動作を説明する概念図、第5図
は1コメントはステートメントの前につける”コーディ
ング規約に沿って記述した構文木の処理フローチャート
、第6図は“コメントはステートメントの前につける゛
コーディング規約に沿って記述した構文木の処理フロー
チャート、第7図は”コメントはステートメントの前に
つける”コーディング規約に沿って記述した構文木の処
理フローチャート、第8図はコーディング規約の3つの
パターンを図示した概念図である。 11・・・・・・字句解析部、12・・・・・・コメン
ト判定部、13・・・・・・コメントとシンボルとの対
応情報、14・・・・・・コメント処理部、15・・・
・・・チャート生成構文解析部15.21・・・・・・
コメント処理を行う非終端記号定義部分、22・・・・
・・コメントの判定を行う非終端記号定義部分、31・
・・・・・コメント処理を行う非終端記号定義部分、3
2・・・・・・コメントの判定を行う非終端記号定義部
分、41・・・・・・コメント処理を行う非終端記号定
義部分、42・・・・・・コメントの判定を行う非終端
記号定義部分。 代理人の氏名 弁理士 粟野重孝 はか1名第3図 第2図 第4図 第 図 (a) 第 図 (a) 第5図 (b) 第6図 (b) 第 図 (a) 第7図 (b)
[Brief Description of the Drawings] Figure 1 is a block diagram showing an embodiment of the comment extraction method according to the present invention, and Figure 2 shows a parse tree when there is a coding convention that "comments are placed before statements." Figure 3 is a conceptual diagram illustrating the operation of an embodiment of the comment extraction method according to the present invention; A conceptual diagram explaining the operation of one embodiment. FIG. 4 shows a syntax parsing tree when there is a coding convention that “comments are added after the statement.” The operation of one embodiment of the comment extraction method according to the present invention is explained. Figure 5 is a processing flowchart of a syntax tree written in accordance with the coding convention ``Comments should be placed before statements.'' Figure 6 is a conceptual diagram of ``Comments should be placed before statements'' written in accordance with the coding conventions. FIG. 7 is a processing flowchart of a syntax tree written in accordance with the coding convention that "comments are placed before statements." FIG. 8 is a conceptual diagram illustrating three patterns of the coding convention. 11... Lexical analysis unit, 12... Comment determination unit, 13... Correspondence information between comments and symbols, 14... Comment processing unit, 15.・・・
...Chart generation syntax analysis section 15.21...
Non-terminal symbol definition part that performs comment processing, 22...
...Nonterminal symbol definition part for determining comments, 31.
...Nonterminal symbol definition part that performs comment processing, 3
2...Nonterminal symbol definition part that performs comment determination, 41...Nonterminal symbol definition part that performs comment processing, 42...Nonterminal symbol definition part that performs comment determination. Name of agent Patent attorney Shigetaka Awano (1 person) Figure 3 Figure 2 Figure 4 Figure (a) Figure (a) Figure 5 (b) Figure 6 (b) Figure (a) Figure 7 Figure (b)

Claims (1)

【特許請求の範囲】[Claims] プログラム中のステートメントにコメントが付加されて
いるか否かを判定するコメント判定部と、前記コメント
判定部の判定後にコメントの処理を行うコメント処理部
と、プログラム中のコメントとチャート内のシンボルと
の対応を示すコメントシンボル対応情報を具備し、前記
コメントシンボル対応情報をメモリ上のデータとして処
理することを特徴とするコメント抽出方法。
A comment judgment unit that determines whether a comment has been added to a statement in a program, a comment processing unit that processes comments after judgment by the comment judgment unit, and correspondence between comments in the program and symbols in the chart. 1. A comment extraction method comprising: comment symbol correspondence information indicating the comment symbol correspondence information, and processing the comment symbol correspondence information as data on a memory.
JP14829190A 1990-06-05 1990-06-05 Comment extracting method Pending JPH0439731A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP14829190A JPH0439731A (en) 1990-06-05 1990-06-05 Comment extracting method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP14829190A JPH0439731A (en) 1990-06-05 1990-06-05 Comment extracting method

Publications (1)

Publication Number Publication Date
JPH0439731A true JPH0439731A (en) 1992-02-10

Family

ID=15449492

Family Applications (1)

Application Number Title Priority Date Filing Date
JP14829190A Pending JPH0439731A (en) 1990-06-05 1990-06-05 Comment extracting method

Country Status (1)

Country Link
JP (1) JPH0439731A (en)

Similar Documents

Publication Publication Date Title
US9710243B2 (en) Parser that uses a reflection technique to build a program semantic tree
Miles Methods in C
US7739696B2 (en) Message translation systems and methods
US6859810B2 (en) Declarative specification and engine for non-isomorphic data mapping
KR960035260A (en) Method and apparatus for indicating the location of an error detected in a software macro call
JPH02109127A (en) Specification processing method
CN112231068B (en) Custom logic method, system and readable medium using domain specific language
CN110096264A (en) A kind of code operation method and device
Cameron Rex: Xml shallow parsing with regular expressions
JPH0439731A (en) Comment extracting method
KR100305097B1 (en) Compiler capable of reducing interrupt handling in optimization and its optimization method
JP3476881B2 (en) Specification generator
JPH02224132A (en) Automatic generation system for message pursuer
JP3611061B2 (en) Graphic creation device
Pottier Correct, fast LR (1) unparsing
Joisha et al. The Design and Implementation of a Parser and Scanner for the MATLAB Language in the MATCH Compiler
CN117193781B (en) SIMSCRIPT language-oriented abstract syntax tree construction method and device
Scowen Babel and SOAP applications of extensible compilers
JP2006505044A (en) Validation parser accelerated by hardware
Watson et al. Lexical Analysis
CN115981749A (en) Program analysis method of industrial robot and industrial robot control system
JPH0439730A (en) Chart generating method
CN113900657A (en) Method for reading data rule, electronic device and storage medium
CN115421702A (en) Method for realizing code development of dynamic form
Dedourek et al. Scanner design