JPH05158765A - System for acquiring c language differential information - Google Patents
System for acquiring c language differential informationInfo
- Publication number
- JPH05158765A JPH05158765A JP3322858A JP32285891A JPH05158765A JP H05158765 A JPH05158765 A JP H05158765A JP 3322858 A JP3322858 A JP 3322858A JP 32285891 A JP32285891 A JP 32285891A JP H05158765 A JPH05158765 A JP H05158765A
- Authority
- JP
- Japan
- Prior art keywords
- program
- language
- preprocessing
- logical
- lexical
- 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
Links
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P20/00—Technologies relating to chemical industry
- Y02P20/50—Improvements relating to the production of bulk chemicals
- Y02P20/52—Improvements relating to the production of bulk chemicals using catalysts, e.g. selective catalysts
Landscapes
- Debugging And Monitoring (AREA)
- Devices For Executing Special Programs (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Stored Programmes (AREA)
Abstract
(57)【要約】
【目的】二つのC言語原始プログラムを前処理指令とC
言語の文法に従って比較し,差分情報を取得することに
より,プログラムの処理内容に着目した比較を実現す
る。
【構成】字句解析,前処理指令解析,構文解析を行い,
その結果から前処理指令行及び実プログラムで構成する
論理行を作成し,次に論理行を比較し,その比較結果を
出力する。
【効果】論理行を作成し,比較する方式なので,プログ
ラムの注釈,インデンテーションなどプログラムの処理
内容に直接関係しない不要な差分情報情報の削減に効果
がある。
(57) [Summary] [Purpose] Two C language source programs are preprocessed and C
By comparing according to the grammar of the language and acquiring the difference information, the comparison focusing on the processing contents of the program is realized. [Structure] Lexical analysis, pre-processing command analysis, syntax analysis,
From the result, create a logical line consisting of the preprocessing command line and the actual program, then compare the logical lines and output the comparison result. [Effect] Since it is a method of creating and comparing logical lines, it is effective in reducing unnecessary difference information information that is not directly related to the processing contents of the program, such as program annotations and indentation.
Description
【0001】[0001]
【産業上の利用分野】本発明は,C言語プログラムの差
分情報を前処理指令及び実プログラムを含むプログラム
の処理内容に基づいて取得するC言語プログラム差分情
報取得方式に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a C language program difference information acquisition method for acquiring difference information of a C language program based on processing contents of a program including a preprocessing instruction and an actual program.
【0002】[0002]
【従来の技術】従来の差分情報取得技術には,例えば共
立出版 AT&T UNIXソフトウェア オペレーシ
ョン パシフィック UNIX System V ユ
ーザ・リファレンス・マニュアル第2版 リリース
3.0 第73項のdiffコマンドがある。これは二
つの入力ファイルを行単位に比較し,不一致となる差分
情報を出力する。本技術では,行単位にファイルを直接
比較するため,注釈,インデンテーションのようなプロ
グラムの処理内容と直接関係しない内容まで差分情報と
して出力され,処理内容の差分調査に不便をきたす。そ
こで,注釈,インデンテーションのようなプログラムの
処理内容と直接関係しない内容の差分情報を抑止するた
め,C言語の前処理実行結果の論理行を外部装置に出力
し,その結果をdiffコマンドなどで比較する方法が
使用される。2. Description of the Related Art Conventional difference information acquisition techniques include, for example, Kyoritsu Shuppan AT & T UNIX Software Operation Pacific UNIX System V User Reference Manual, Second Edition Release.
3.0 There is the diff command of Item 73. This compares two input files line by line and outputs the difference information that does not match. In the present technology, since files are directly compared line by line, contents such as annotations and indentations that are not directly related to the processing contents of the program are output as difference information, which makes it inconvenient to check the difference in processing contents. Therefore, in order to suppress the difference information that is not directly related to the processing content of the program such as annotations and indentation, the logical line of the preprocessing execution result of C language is output to the external device and the result is output by the diff command or the like. The method of comparison is used.
【0003】[0003]
【発明が解決しようとする課題】上記従来差分情報取得
技術では,C言語の前処理実行結果の論理行を比較する
場合,注釈,インデンテーションなどC言語で空白類と
定義される情報を一つの空白に置き換え,処理内容に着
目した差分調査を行うが,空白類を空白に置き換えると
同時に#includeによるインクルードファイルの取り込
み,#defineによるマクロ置換,#ifなどによる条件組込
み等の前処理指令を実行するため,前処理指令の差分調
査ができないという問題,前処理を実行する前の原始プ
ログラムとの対比をとることが困難となる問題が発生す
る。In the conventional difference information acquisition technique described above, when comparing the logical lines of the preprocessing execution results in C language, information such as annotations and indentations that are defined as whitespace in C language is used as a single item. Replace with blanks and perform a difference check focusing on the processing contents. At the same time as replacing blanks with blanks, execute the preprocessing directives such as #include include file inclusion, #define macro replacement, and #if etc. conditional inclusion. Therefore, there is a problem that it is not possible to check the difference of the preprocessing command, and it becomes difficult to make a comparison with the source program before the preprocessing is executed.
【0004】本発明では,上記の問題点を解決するた
め,前処理指令と実プログラムを識別し,それぞれの文
法に従ってプログラムの処理内容と直接関係しない内容
の差分情報を抑止することにより,二つのファイルのプ
ログラムの処理内容の差分情報を取得することを目的と
する。In order to solve the above problems, the present invention distinguishes between a preprocessing command and an actual program, and suppresses difference information having contents that are not directly related to the processing contents of the program according to their grammars. The purpose is to acquire the difference information of the processing contents of the program of the file.
【0005】[0005]
【課題を解決するための手段】C言語プログラム差分情
報取得処理方式は,入力した原始プログラムからC言語
で定義した字句と呼ばれる単位に字句を取り出す手段,
字句から前処理指令と実プログラムに分け,前処理指令
を解析する手段,実プログラムをC言語の文法に従い構
文解析する手段,前処理指令と実プログラムから論理行
を生成する手段,生成した論理行を比較する手段を備え
ることで達成される。[Means for Solving the Problem] The C language program difference information acquisition processing method is a means for extracting a lexical unit from an input source program into a unit called a lexical unit defined in C language,
A means for dividing a lexical into a preprocessing instruction and an actual program, a means for analyzing the preprocessing instruction, a means for parsing the actual program according to the C language grammar, a means for generating a logical line from the preprocessing instruction and the actual program, a generated logical line It is achieved by providing a means for comparing
【0006】[0006]
【作用】本発明は,二つのC言語原始プログラムの比較
において,字句解析,前処理解析,構文解析を行い,そ
の結果より論理行を作成し比較することにより,プログ
ラムの処理内容に直接影響の無い注釈,インデンテーシ
ョンなどが異なっても比較結果を一致させることができ
る。The present invention directly affects the processing contents of programs by performing lexical analysis, preprocessing analysis, and syntax analysis in the comparison of two C language source programs, and creating and comparing logical lines from the results. It is possible to match the comparison results even if there are different annotations, indentations, etc.
【0007】[0007]
【実施例】以下,本発明の一実施例を図を参照しつつ説
明する。An embodiment of the present invention will be described below with reference to the drawings.
【0008】図1は本発明を用いたC言語プログラム差
分情報取得処理装置構成図,図2,図3は本発明の具体
例を説明するためのC言語原始プログラムである。FIG. 1 is a block diagram of a C language program difference information acquisition processing device using the present invention, and FIGS. 2 and 3 are C language source programs for explaining a specific example of the present invention.
【0009】図1において,101,102は記憶装置
上に格納されている比較対象の原始プログラム,111
はC言語プログラム差分情報取得処理装置,112は1
01と102の比較結果の差分情報である。C言語プロ
グラム差分取得処理装置111は記憶装置から二つの原
始プログラムを読み込み両者の差分情報を記憶装置上に
生成する。このときC言語プログラム差分情報取得処理
装置の処理について図2,図3の原始プログラムをそれ
ぞれ図1の原始プログラム101,102の例とした時
の動作について説明する。ここで101は変更前の原始
プログラム,102は変更後の原始プログラムである。
字句解析部103は,読み込んだ原始プログラムの字句
解析を行い,字句を前処理指令解析部104に渡す。前
処理指令解析部104は,字句を#から始まる前処理指
令と実プログラムに分け,前処理指令を構成する字句に
は前処理フラグをオン,実プログラムを構成する字句に
は前処理フラグをオフに設定する。構文解析部105は
前処理解析部104で処理を行った字句を入力し,前処
理フラグがオフである実プログラム構成字句をC言語の
文法に従い構文解析を行い,字句のまとまりを”文”と
いう単位で区切る。図4は図3の原始プログラムに対応
する字句”define”,”b”,”if”の例であ
る。論理行生成部106は,前処理指令解析部104,
構文解析部105で処理を行った字句を入力し,前処理
フラグがオンである前処理指令構成字句から前処理指令
論理行,前処理フラグがオフである実プログラム構成字
句から実プログラム論理行を生成する。前処理指令論理
行は#字句から開始し,改行字句で終了する論理的な行
単位に,実プログラム論理行は構文解析部105で区切
った文単位に構成する。比較部107は論理行生成部1
06で生成した前処理指令論理行及び実プログラム論理
行を含む論理行を入力し,比較した結果を記憶装置上に
出力する。In FIG. 1, 101 and 102 are source programs to be compared, which are stored in a storage device, and 111.
Is a C language program difference information acquisition processing device, 112 is 1
It is the difference information of the comparison result of 01 and 102. The C language program difference acquisition processing device 111 reads the two source programs from the storage device and generates the difference information of the two on the storage device. At this time, the operation of the C language program difference information acquisition processing device when the source programs of FIGS. 2 and 3 are used as the source programs 101 and 102 of FIG. 1 will be described. Here, 101 is the original program before the change, and 102 is the original program after the change.
The lexical analysis unit 103 performs lexical analysis of the read source program and passes the lexical information to the preprocessing command analysis unit 104. The preprocessing instruction analysis unit 104 divides the token into a preprocessing instruction starting from # and an actual program, turns on the preprocessing flag for the tokens that make up the preprocessing instruction, and turns off the preprocessing flag for the tokens that make up the actual program. Set to. The syntactic analysis unit 105 inputs the lexical processed by the preprocessing analysis unit 104, parses the actual program constituent lexical for which the preprocessing flag is off according to the C language grammar, and refers to the lexical unit as a "sentence". Separate by unit. FIG. 4 is an example of the tokens "define", "b", "if" corresponding to the source program of FIG. The logical line generation unit 106 includes a preprocessing command analysis unit 104,
The lexical processed by the syntactic analysis unit 105 is input, and the preprocessing instruction composition lexical with the preprocessing flag on is the preprocessing instruction logical line, and the actual program composition lexical with the preprocessing flag is off is the actual program logical line. To generate. The preprocessing command logical line is constructed in logical line units starting from # token and ending in line feed token, and the actual program logical line is composed in sentence units divided by the syntax analysis unit 105. The comparison unit 107 is the logical row generation unit 1.
The logical lines including the preprocessing command logical line and the actual program logical line generated in 06 are input, and the comparison result is output to the storage device.
【0010】図5は論理行生成部106で生成した,図
3の論理行の例である。論理行は,比較の対象となる論
理行501と比較結果が不一致の場合に,元の原始プロ
グラムとの対応をつけて出力するため,もとの入力行番
号502を有している。この例は,原始プログラム図
2,図3は異なるが,プログラムの処理内容が一致する
ので生成した比較の対象となる論理行501は一致す
る。FIG. 5 shows an example of the logical row of FIG. 3 generated by the logical row generator 106. The logical line has the original input line number 502 in order to output the logical line 501 in correspondence with the original program when the comparison result does not match the logical line 501 to be compared. In this example, the original programs shown in FIGS. 2 and 3 are different, but since the processing contents of the programs are the same, the generated logical lines 501 to be compared are the same.
【0011】[0011]
【発明の効果】本発明によれば,二つのC言語プログラ
ムの比較において,プログラムの処理内容に基づいての
比較に効果がある。According to the present invention, when comparing two C language programs, the comparison is effective based on the processing contents of the programs.
【図1】本発明を用いたC言語プログラム差分取得処理
装置構成図である。FIG. 1 is a configuration diagram of a C language program difference acquisition processing device using the present invention.
【図2】本発明の実施例を説明するためのC言語原始プ
ログラムを示す図である。FIG. 2 is a diagram showing a C language source program for explaining an embodiment of the present invention.
【図3】同じくプログラムを示す図である。FIG. 3 is a diagram similarly showing a program.
【図4】本発明の実施例を説明するための字句の形式を
示す図である。FIG. 4 is a diagram showing a lexical format for explaining an embodiment of the present invention.
【図5】本発明の実施例を論理行に組立直した結果を示
す図である。FIG. 5 is a diagram showing a result of reassembling an embodiment of the present invention into logical rows.
───────────────────────────────────────────────────── フロントページの続き (72)発明者 新垣 薫 神奈川県横浜市戸塚区戸塚町5030番地株式 会社日立製作所ソフトウェア開発本部内 (72)発明者 後藤 秀則 宮城県仙台市青葉区一番町二丁目4番1号 日立東北ソフトウェア株式会社内 ─────────────────────────────────────────────────── ─── Continuation of front page (72) Kaoru Aragaki 5030 Totsuka-cho, Totsuka-ku, Yokohama-shi, Kanagawa, Ltd. Software Development Division, Hitachi, Ltd. (72) Hidenori Goto 2-chome, Ichibancho, Aoba-ku, Sendai-shi, Miyagi 4th-1 Hitachi Tohoku Software Co., Ltd.
Claims (1)
句解析部,字句解析結果を前処理指令と原始プログラム
より前処理指令を除いた実プログラムに分ける前処理指
令解析部,実プログラムを構成する字句をC言語の文法
に従い解析する構文解析部,前処理指令と実プログラム
から論理行を生成する論理行生成部,生成した論理行を
比較する比較部を有することを特徴とする,C言語プロ
グラム差分情報取得方式。1. A lexical analysis unit for performing lexical analysis of a C language source program, a preprocessing instruction analysis unit for dividing a lexical analysis result into a preprocessing instruction and an actual program excluding the preprocessing instruction from the source program, and an actual program. A C language program having a syntactic analysis unit for analyzing lexical characters according to the C language grammar, a logical line generation unit for generating a logical line from a preprocessing instruction and an actual program, and a comparison unit for comparing the generated logical lines. Difference information acquisition method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP3322858A JPH05158765A (en) | 1991-12-06 | 1991-12-06 | System for acquiring c language differential information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP3322858A JPH05158765A (en) | 1991-12-06 | 1991-12-06 | System for acquiring c language differential information |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH05158765A true JPH05158765A (en) | 1993-06-25 |
Family
ID=18148394
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP3322858A Pending JPH05158765A (en) | 1991-12-06 | 1991-12-06 | System for acquiring c language differential information |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH05158765A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2439417A (en) * | 2006-06-19 | 2007-12-27 | Hewlett Packard Development Co | Comparing software functions using a comparison matrix |
US7664794B2 (en) | 2000-02-14 | 2010-02-16 | Nice Systems Ltd. | Content-based storage management |
-
1991
- 1991-12-06 JP JP3322858A patent/JPH05158765A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7664794B2 (en) | 2000-02-14 | 2010-02-16 | Nice Systems Ltd. | Content-based storage management |
US8195616B2 (en) | 2000-02-14 | 2012-06-05 | Nice Systems Ltd. | Content-based storage management |
GB2439417A (en) * | 2006-06-19 | 2007-12-27 | Hewlett Packard Development Co | Comparing software functions using a comparison matrix |
US8108315B2 (en) | 2006-06-19 | 2012-01-31 | Hewlett-Packard Development Company, L.P. | Discovering software code subject to licenses |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7992088B2 (en) | Method and system for copy and paste technology for stylesheet editing | |
EP1306775A1 (en) | Machine translation | |
JPH02165378A (en) | Machine translation system | |
JPH0682377B2 (en) | Emotion information extraction device | |
JPH05158765A (en) | System for acquiring c language differential information | |
JPH0877196A (en) | Document information extraction device | |
JPH096790A (en) | Natural language interacting device | |
JP3003459B2 (en) | Program creation support device | |
JPH07121379A (en) | Multilingual compiler | |
JP3251032B2 (en) | Japanese analyzer | |
JP2794919B2 (en) | Machine translation equipment | |
JP3050575B2 (en) | Natural language automatic translator | |
JP2726543B2 (en) | Translation method | |
JPH06162075A (en) | Automatic rewriting device | |
JPH05282138A (en) | Documenter document generation method | |
Kongyuan et al. | A study on the Chinese syntactic analysis | |
JPH04152458A (en) | Word processor | |
KR20010063805A (en) | Method for lexical analysis for c program | |
JPH0689183A (en) | Delayed output control system | |
EP1306774A1 (en) | Machine translation | |
JPH05324711A (en) | Natural language automatic translation system | |
JPH05216922A (en) | Dictionary editing device | |
JPH04336669A (en) | Intermediated code generation system for text | |
JPH0289175A (en) | Syntax analysis method in machine translation | |
JPH05334339A (en) | Machine translation device |