JPH0644081A - System for outputting error message of compiler - Google Patents
System for outputting error message of compilerInfo
- Publication number
- JPH0644081A JPH0644081A JP3297463A JP29746391A JPH0644081A JP H0644081 A JPH0644081 A JP H0644081A JP 3297463 A JP3297463 A JP 3297463A JP 29746391 A JP29746391 A JP 29746391A JP H0644081 A JPH0644081 A JP H0644081A
- Authority
- JP
- Japan
- Prior art keywords
- error
- error message
- symbol table
- information
- compiler
- 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.)
- Withdrawn
Links
Landscapes
- Stored Programmes (AREA)
- Debugging And Monitoring (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
Description
【0001】[0001]
【産業上の利用分野】本発明は、PASCAL言語で記
述されたソースプログラムの構文解析時にエラーが検出
された場合、変数名及び型名の不一致等からエラーが検
出された場合は、関連する変数名と型名およびソース行
とをエラーメッセージとともに出力することを可能とす
る、コンパイラのエラーメッセージ出力方式に関するも
のである。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a related variable when an error is detected when parsing a source program written in the PASCAL language, or when an error is detected due to a mismatch between a variable name and a type name. The present invention relates to an error message output method of a compiler that enables the output of a name, a type name, and a source line together with an error message.
【0002】[0002]
【従来の技術】従来、PASCAL言語で記述されたソ
ースプログラムをコンパイルした結果、検出されたコン
パイルエラーを出力する場合には、エラーのあった行
と、その行のどこの位置でエラーが発見されたかを示す
記号と、エラーの種類を示すエラー番号と、エラーメッ
セージを1つの単位としてエラーメッセージを出力して
いる。2. Description of the Related Art Conventionally, when a compilation error detected as a result of compiling a source program written in the PASCAL language is output, the error line and the position of the line where the error is found are detected. The error message is output with a symbol indicating whether it is high, an error number indicating the type of error, and an error message as one unit.
【0003】[0003]
【発明が解決しようとする課題】しかしながら、従来、
PASCAL言語で記述されたソースプログラムをコン
パイルした結果、検出したコンパイルエラーを出力する
場合には、エラーのあった行と、その行のどこの位置で
エラーが発見されたかを示す記号と、エラーの種類を示
すエラー番号と、エラーメッセージを1つの単位として
エラーメッセージを出力しているため、1つのコンパイ
ルエラーを解決するためには、変数及び型の宣言部を参
照しなければならないといった作業が生じる欠点があ
る。そこで、本発明の技術的課題は、上記欠点に鑑み、
コンパイルエラーを検出した位置に、変数及び型の不一
致等に関するエラーであればエラーメッセージとともに
その変数名と型名とそのソース行を表示することができ
るため、コンパイラのエラーメッセージ出力方式を提供
することである。[Problems to be Solved by the Invention] However, in the past,
When a detected compilation error is output as a result of compiling a source program written in the PASCAL language, the line in which the error occurred, a symbol indicating where in the line the error was found, and the error Since the error message indicating the type and the error message is output with the error message as one unit, in order to solve one compilation error, the work of having to refer to the variable and type declaration parts occurs. There are drawbacks. Therefore, the technical problem of the present invention, in view of the above drawbacks,
At the position where a compile error is detected, if there is an error related to variable and type mismatch, etc., the variable name, type name and its source line can be displayed together with the error message. Therefore, provide an error message output method of the compiler. Is.
【0004】[0004]
【課題を解決するための手段】本発明によれば、PAS
CAL言語で記述されたソースプログラムのコンパイル
時に出力されるエラーメッセージ出力方式において、前
記ソースプログラムの構文を分析して、前記PASCA
L言語の構文規則とは異なる場合には、コンパイルエラ
ーとして認識する構文分析手段と、該構文分析手段によ
り解析された情報をシンボルテーブルに登録するシンボ
ルテーブル登録手段と、前記コンパイルエラーに関する
エラー情報をエラーテーブルに登録するエラーテーブル
登録手段と前記コンパイルエラーに対応するエラーメッ
セージを予め格納するエラーメッセージテーブルと、前
記シンボルテーブルに登録されている情報を引用すると
共に、前記エラーテーブルに登録されている前記コンパ
イルエラーに対応したエラーメッセージを、前記エラー
メッセージテーブルから引用して、所定の形式に編集す
るエラーメッセージ編集手段とを有することを特徴とす
るコンパイラのエラーメッセージ出力方式が得られる。According to the present invention, a PAS
In the error message output method output at the time of compiling a source program written in the CAL language, the syntax of the source program is analyzed and the PASCA is analyzed.
When the syntax rule of the L language is different, a syntax analysis unit that recognizes as a compilation error, a symbol table registration unit that registers the information analyzed by the syntax analysis unit in a symbol table, and error information related to the compilation error. The error table registering means for registering in the error table, the error message table for pre-storing the error message corresponding to the compilation error, the information registered in the symbol table, and the information registered in the error table are cited. An error message output method of a compiler is provided, which has an error message editing unit that edits an error message corresponding to a compile error from the error message table into a predetermined format.
【0005】また、本発明によれば、前記のコンパイラ
のエラーメッセージ出力方式において、前記シンボルテ
ーブルに登録される情報は、前記ソースプログラムの変
数名および型名を含むことを特徴とするコンパイラのエ
ラーメッセージ出力方式が得られる。According to the present invention, in the error message output method of the compiler, the information registered in the symbol table includes a variable name and a type name of the source program. A message output method is obtained.
【0006】また、本発明によれば、前記のコンパイラ
のエラーメッセージ出力方式において、前記エラー情報
は、コンパイルエラーのあったライン数と、カラム位置
とコンパイルエラーの番号とを含み、前記ソースプログ
ラムの変数名および型名に関連したコンパイルエラーの
場合は、前記シンボルテーブルに規定されるインデック
ス番号を含むことを特徴とするコンパイラのエラーメッ
セージ出力方式が得られる。According to the present invention, in the error message output method of the compiler, the error information includes the number of lines having a compile error, the column position, and the compile error number, and In the case of a compile error related to the variable name and the type name, an error message output method of the compiler is obtained which includes the index number defined in the symbol table.
【0007】即ち、本発明のコンパイラのエラーメッセ
ージ出力方式では、入力されたソースプログラム構文を
解析する構文解析手段と、ソースプログラム中の宣言部
で宣言された変数名及び型名等の情報を作成するシンボ
ルテーブル登録手段と、シンボルテーブル登録手段によ
り作成されるシンボルテーブルと、コンパイラのエラー
メッセージを含むエラーメッセージテーブルと、コンパ
イラの構文解析手段によって検出したエラーとシンボル
テーブル登録手段により登録されたシンボルテーブルを
エラーテーブルに登録するエラーテーブル登録手段と、
エラーテーブル登録手段により情報が登録されるエラー
テーブルと、エラーテーブル登録手段により登録された
エラーテーブルの内容を編集するエラーメッセージ編集
手段と、エラーメッセージ編集手段により編集されたエ
ラーメッセージを出力するエラーメッセージ出力手段と
を有している。That is, in the error message output method of the compiler of the present invention, the syntax analysis means for analyzing the input source program syntax and the information such as the variable name and the type name declared in the declaration section in the source program are created. Symbol table registration means, a symbol table created by the symbol table registration means, an error message table containing an error message of the compiler, an error detected by the syntax analysis means of the compiler, and a symbol table registered by the symbol table registration means Error table registration means for registering
An error table in which information is registered by the error table registration means, an error message editing means for editing the contents of the error table registered by the error table registration means, and an error message for outputting the error message edited by the error message editing means And output means.
【0008】[0008]
【実施例】次に本発明の実施例について図面を参照して
詳細に説明する。Embodiments of the present invention will now be described in detail with reference to the drawings.
【0009】図1は本実施例によるコンパイラのエラー
メッセージ出力方式を実施する一実施例を示すブロック
図である。FIG. 1 is a block diagram showing an embodiment for implementing the error message output system of the compiler according to this embodiment.
【0010】同図においてコンパイラのエラーメッセー
ジ出力方式は、入力ソースプログラム1、構文解析手段
2、シンボルテーブル登録手段3、エラーテーブル登録
手段4、エラーメッセージ編集手段5、エラーメッセー
ジ出力手段6、出力リスト7、シンボルテーブル8、エ
ラーメッセージテーブル9、エラーテーブル10、から
構成されている。In the figure, the error message output method of the compiler is as follows: input source program 1, syntax analysis means 2, symbol table registration means 3, error table registration means 4, error message editing means 5, error message output means 6, output list. 7, a symbol table 8, an error message table 9, and an error table 10.
【0011】構文解析手段2は、PASCAL言語で記
述された入力ソースプログラム1を入力し、PASCA
L言語の構文規則に従い構文解析を行い、構文規則に従
わない場合は、コンパイルエラーとして認識し、コンパ
イルエラーがあった入力ソースプログラム1のソース行
とカラム位置とコンパイルエラーの番号を出力する。The syntactic analysis means 2 inputs the input source program 1 described in the PASCAL language, and then PASCA
Parsing is performed according to the syntax rules of the L language. If the syntax rules are not followed, it is recognized as a compilation error, and the source line and column position of the input source program 1 in which the compilation error occurred and the number of the compilation error are output.
【0012】またシンボルテーブル登録手段3は、変数
名と型名およびそのソース行をシンボルテーブル8に登
録する。Further, the symbol table registration means 3 registers the variable name, the type name and the source line thereof in the symbol table 8.
【0013】変数名および型名の不一致等により検出し
たエラーの場合は、対応する変数名または型名の情報と
してシンボルテーブル8に登録されているインデックス
をエラーテーブル登録手段4によりエラーテーブル10
に登録する。In the case of an error detected due to a mismatch between the variable name and the type name, the index registered in the symbol table 8 as the information of the corresponding variable name or type name is stored in the error table 10 by the error table registration means 4.
Register with.
【0014】エラーメッセージ編集手段5は、エラーテ
ーブル10に登録されている情報とコンパイルエラーの
番号に対応したエラーメッセージをエラーメッセージテ
ーブル9から引用し、さらに変数名および型名に対応し
た情報をシンボルテーブル8から引用し、その結果を編
集する。The error message editing means 5 refers to the error message corresponding to the information registered in the error table 10 and the compile error number from the error message table 9, and symbolizes the information corresponding to the variable name and the type name. Quoting from Table 8 and editing the results.
【0015】編集された結果はエラーメッセージ出力手
段6により、出力リスト7に結果を出力する。The edited result is output to the output list 7 by the error message output means 6.
【0016】図2は、入力ソースプログラムの例11で
ある。FIG. 2 is an example 11 of an input source program.
【0017】図3は、コンパイルエラーが検出された場
合に出力されるコンパイルエラーメッセージが格納され
ている、エラーメッセージテーブル12である。FIG. 3 is an error message table 12 in which a compile error message output when a compile error is detected is stored.
【0018】図4は、変数名および型名の情報が格納さ
れているシンボルテーブル13である。FIG. 4 shows a symbol table 13 in which information on variable names and type names is stored.
【0019】図5は、構文解析手段2によって生成され
た情報を、エラーテーブル登録手段4によってエラーテ
ーブル10に登録した結果生成された、エラーテーブル
10の内部形式の説明図である。FIG. 5 is an explanatory diagram of the internal format of the error table 10 generated as a result of registering the information generated by the syntax analysis unit 2 in the error table 10 by the error table registration unit 4.
【0020】構文解析手段2によって生成されたコンパ
イルエラーのあったライン数とカラム位置とコンパイル
エラーの番号を、それぞれエラーテーブル14のlin
eとcolumnとエラーメッセージNoというフィー
ルドに登録する。The number of lines having a compile error, the column position, and the number of the compile error generated by the syntax analysis unit 2 are stored in the lin of the error table 14, respectively.
Register in the fields e, column, and error message No.
【0021】さらに変数名および型名に関連したコンパ
イルエラーの場合は、エラーテーブル14のシンボルテ
ーブルNoというフィールドにシンボルテーブル8のイ
ンデックス番号を登録する。Further, in the case of a compile error related to the variable name and the type name, the index number of the symbol table 8 is registered in the symbol table No field of the error table 14.
【0022】図6は、入力ソースプログラムの例11を
構文解析手段2に入力し、エラーテーブル登録手段4と
エラーメッセージ編集手段5とエラーメッセージ出力手
段6で処理した結果出力される、出力リストの例15で
ある。FIG. 6 shows an output list output as a result of inputting the example 11 of the input source program to the syntax analysis means 2 and processing it by the error table registration means 4, the error message editing means 5 and the error message output means 6. This is Example 15.
【0023】[0023]
【発明の効果】以上説明したように、本発明では、PA
SCAL言語で記述されたソースプログラムに対して、
コンパイルエラーを検出した位置に、変数名および型名
に関するエラーであればエラーメッセージとともに変数
名と型名およびそのソース行の情報を表示することがで
きるため、ソースプログラムを開発し、コンパイルした
際に検出されたコンパイルエラーに対してソースプログ
ラムの修正が行い易くなるという利点がある。As described above, according to the present invention, the PA
For source programs written in SCAL language,
At the position where a compile error is detected, if the error is related to the variable name and the type name, the variable name and the type name and the information of the source line can be displayed along with the error message. There is an advantage that the source program can be easily corrected for the detected compilation error.
【図1】本発明の全体構成図を示す図である。FIG. 1 is a diagram showing an overall configuration diagram of the present invention.
【図2】PASCAL言語で記述されたプログラム例で
ある。FIG. 2 is an example of a program written in PASCAL language.
【図3】エラーメッセージテーブルの説明図である。FIG. 3 is an explanatory diagram of an error message table.
【図4】シンボルテーブルの説明図である。FIG. 4 is an explanatory diagram of a symbol table.
【図5】エラーテーブルの説明図である。FIG. 5 is an explanatory diagram of an error table.
【図6】実行の結果出力される出力結果の例である。FIG. 6 is an example of an output result output as a result of execution.
1 入力ソースプログラム 2 構文解析手段 3 シンボルテーブル登録手段 4 エラーテーブル登録手段 5 エラーメッセージ編集手段 6 エラーメッセージ出力手段 7 出力リスト 8 シンボルテーブル 9 エラーメッセージテーブル 10 エラーテーブル 11 入力ソースプログラムの例 12 エラーメッセージテーブル 13 シンボルテーブル 14 エラーテーブル 15 出力リストの例 1 input source program 2 syntax analysis means 3 symbol table registration means 4 error table registration means 5 error message editing means 6 error message output means 7 output list 8 symbol table 9 error message table 10 error table 11 input source program example 12 error message Table 13 Symbol table 14 Error table 15 Example of output list
Claims (3)
ログラムのコンパイル時に出力されるエラーメッセージ
出力方式において、 前記ソースプログラムの構文を分析して、前記PASC
AL言語の構文規則とは異なる場合には、コンパイルエ
ラーとして認識する構文分析手段と、 該構文分析手段により解析された情報をシンボルテーブ
ルに登録するシンボルテーブル登録手段と、 前記コンパイルエラーに関するエラー情報をエラーテー
ブルに登録するエラーテーブル登録手段と前記コンパイ
ルエラーに対応するエラーメッセージを予め格納するエ
ラーメッセージテーブルと、 前記シンボルテーブルに登録されている情報を引用する
と共に、前記エラーテーブルに登録されている前記コン
パイルエラーに対応したエラーメッセージを、前記エラ
ーメッセージテーブルから引用して、所定の形式に編集
するエラーメッセージ編集手段とを有することを特徴と
するコンパイラのエラーメッセージ出力方式。1. An error message output method output at the time of compiling a source program written in the PASCAL language, wherein the syntax of the source program is analyzed and the PASC is used.
When the syntax rule differs from the AL language, a syntax analysis unit that recognizes as a compilation error, a symbol table registration unit that registers the information analyzed by the syntax analysis unit in a symbol table, and error information related to the compilation error. An error table registration unit that registers in an error table, an error message table that stores in advance an error message corresponding to the compilation error, a reference to information registered in the symbol table, and the information registered in the error table. An error message output method for a compiler, comprising: an error message editing unit that edits an error message corresponding to a compilation error from the error message table into a predetermined format.
セージ出力方式において、前記シンボルテーブルに登録
される情報は、前記ソースプログラムの変数名および型
名を含むことを特徴とするコンパイラのエラーメッセー
ジ出力方式。2. The compiler error message output method according to claim 1, wherein the information registered in the symbol table includes a variable name and a type name of the source program. .
セージ出力方式において、前記エラー情報は、コンパイ
ルエラーのあったライン数と、カラム位置とコンパイル
エラーの番号とを含み、前記ソースプログラムの変数名
および型名に関連したコンパイルエラーの場合は、前記
シンボルテーブルに規定されるインデックス番号を含む
ことを特徴とするコンパイラのエラーメッセージ出力方
式。3. The compiler error message output method according to claim 2, wherein the error information includes the number of lines having a compile error, the column position and the compile error number, and the variable name of the source program and In the case of a compile error related to a type name, an error message output method of a compiler including an index number defined in the symbol table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP3297463A JPH0644081A (en) | 1991-11-13 | 1991-11-13 | System for outputting error message of compiler |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP3297463A JPH0644081A (en) | 1991-11-13 | 1991-11-13 | System for outputting error message of compiler |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH0644081A true JPH0644081A (en) | 1994-02-18 |
Family
ID=17846823
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP3297463A Withdrawn JPH0644081A (en) | 1991-11-13 | 1991-11-13 | System for outputting error message of compiler |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH0644081A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH1185496A (en) * | 1997-09-03 | 1999-03-30 | Fujitsu Ltd | Support device for production of object-oriented program |
-
1991
- 1991-11-13 JP JP3297463A patent/JPH0644081A/en not_active Withdrawn
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH1185496A (en) * | 1997-09-03 | 1999-03-30 | Fujitsu Ltd | Support device for production of object-oriented program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9710243B2 (en) | Parser that uses a reflection technique to build a program semantic tree | |
KR920020317A (en) | Program processing device and program processing method | |
JPH064344A (en) | System for displaying type of variable referred to in program | |
US20040010780A1 (en) | Method and apparatus for approximate generation of source code cross-reference information | |
JPH0644081A (en) | System for outputting error message of compiler | |
JPH0573331A (en) | Error message output system for compiler | |
JPH04273328A (en) | Generation system for cross-reference list | |
JPH01307832A (en) | System for automatically correcting grammatical error of source program in compiler | |
JP2728504B2 (en) | Input statement checker | |
JPH0695889A (en) | Program correction system | |
JPH04330521A (en) | Cross reference list forming system | |
JP2912479B2 (en) | Parsing control method | |
JPH04177534A (en) | Undefined name mark error processing system | |
JPH0752391B2 (en) | Translation method of source program including multiple database descriptions | |
JPH1173305A (en) | Screen editor having check function | |
Volpano et al. | Empirical investigation of COBOL features | |
JPH0782472B2 (en) | Command analysis processor | |
JPH0546373A (en) | Flow chart generation processor | |
JPH04101229A (en) | Compile error display controlling system | |
JPH0251737A (en) | Display system for symbol defining line of assembler program | |
JPH04237365A (en) | Difference detecting system and automatic editing system for text processor | |
JPH02130636A (en) | Supporting system for developing compiler and program | |
JPH0266631A (en) | Address table output system using japanese label | |
JPH0310327A (en) | Compiler processing system | |
JPH01269133A (en) | Translating system for data base operation instruction |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 19990204 |