JPH11232122A - Method for converting extended identifier in source program - Google Patents

Method for converting extended identifier in source program

Info

Publication number
JPH11232122A
JPH11232122A JP4098098A JP4098098A JPH11232122A JP H11232122 A JPH11232122 A JP H11232122A JP 4098098 A JP4098098 A JP 4098098A JP 4098098 A JP4098098 A JP 4098098A JP H11232122 A JPH11232122 A JP H11232122A
Authority
JP
Japan
Prior art keywords
identifier
conversion
source program
extension
conversion table
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
JP4098098A
Other languages
Japanese (ja)
Inventor
Nobutaka Fujimaki
信隆 藤巻
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.)
KEYSTONE SYSTEM RESERCH KK
Original Assignee
KEYSTONE SYSTEM RESERCH KK
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 KEYSTONE SYSTEM RESERCH KK filed Critical KEYSTONE SYSTEM RESERCH KK
Priority to JP4098098A priority Critical patent/JPH11232122A/en
Publication of JPH11232122A publication Critical patent/JPH11232122A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PROBLEM TO BE SOLVED: To enable a Japanese-language programming using Japanese-language identifiers. SOLUTION: A conversion table 10 where conversion identifiers corresponding to Japanese-language identifiers are registered is prepared. A register means 2 searches Japanese-language identifiers in an original source program 1 and retrieves them on the conversion table 10 to check whether they are already registered there or not. If they are not registered yet, corresponding conversion identifiers are automatically generated and are registered in the conversion table 10 together. A conversion means 3 refers to the conversion table 10 to substitute Japanese-language identifiers in the original source program 1 with corresponding conversion identifiers. Thus, the original source program 1 is converted to an object source program 4.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、言語処理系におい
て、識別子(変数、項目名、ラベル等さまざまに呼ばれ
る)として使用できる文字種類又は有効文字数に文法規
約による制限がある場合、ソースプログラム中の前記文
法規約を越えた拡張識別子の変換方法に関する。特に、
日本語プログラミングを許していない言語処理系におい
て、日本語プログラミングを実現する方法に関する。こ
こで、言語処理系とは、コンパイラ及びリンカ等を指
す。また、拡張識別子とは、識別子についての前記文法
規約(文字種類又は有効文字数についての制限)を適切
に拡張・緩和したと仮想したときの識別子という意味で
用いる。例えば、識別子を「8文字以下の英小文字の文
字列」と定義した文法規約を考えた場合、「32文字以
下の英小文字の文字列」又は「16文字以下の英文字又
は「@」文字の文字列」等は、前記識別子についての文
法規約を拡張したものとなるため、拡張識別子である。
BACKGROUND OF THE INVENTION The present invention relates to a language processing system which, when there are restrictions on the character types or the number of valid characters that can be used as identifiers (various names, item names, labels, etc.) in a source program, The present invention relates to a method for converting an extended identifier that exceeds the grammar rules. Especially,
The present invention relates to a method for implementing Japanese programming in a language processing system that does not permit Japanese programming. Here, the language processing system refers to a compiler, a linker, and the like. The extended identifier is used to mean an identifier when it is assumed that the grammatical rule (limitation on character type or the number of valid characters) for the identifier is appropriately expanded and relaxed. For example, considering a grammar rule that defines an identifier as "a lower-case character string of 8 characters or less", "a lower-case character string of 32 characters or less" or "16 characters or less of an alphabetic character or" @ "character The “character string” and the like are extended identifiers because they are extensions of the grammatical rules for the identifiers.

【0002】[0002]

【従来の技術】プログラム開発において、ソースプログ
ラムの日本語化は、プログラムの記述性、判読性を向上
するものとして理解されている。特に、日本国内向けの
アプリケーションプログラムの開発においては必要性が
高い。言語の文法まで含めた完全なる日本語プログラミ
ング法のレベルでなくとも、既存のコンピュータ言語で
日本語文字による日本語識別子が使えることは重要であ
る。ここで、日本語識別子とは、通常の識別子の文字種
類に日本語文字を追加した識別子という意味で用いる。
日本語文字とはひらがな、カタカナ、漢字、及びその他
の文字・記号を意味し、通常1バイト文字以外の文字で
ある。1バイト文字にはASCIIコード文字、及びE
BCDICコード文字等があり、1バイト文字以外の文
字にはJISコード、シフトJISコード、及びEUC
コード等のマルチバイト文字がある。
2. Description of the Related Art In program development, Japanese translation of a source program is understood as improving program descriptiveness and readability. In particular, there is a great need for the development of application programs for Japan. It is important that existing computer languages be able to use Japanese identifiers with Japanese characters, even if they are not at the level of complete Japanese programming, including language grammar. Here, the Japanese identifier is an identifier obtained by adding Japanese characters to the character type of a normal identifier.
Japanese characters mean hiragana, katakana, kanji, and other characters and symbols, and are usually characters other than single-byte characters. ASCII code characters and E
There are BCDIC code characters, etc. Characters other than 1-byte characters are JIS code, shift JIS code, and EUC
There are multi-byte characters such as codes.

【0003】日本語プログラミングが可能であるかどう
かは、個々のコンピュータシステムの言語処理系に依存
する。このため、日本語プログラミングの可能でない言
語処理系で日本語プログラミングを可能とするには、プ
リプロセッサ方式が通常用いられる。すなわち、ソース
プログラム上の日本語表記部分を目的とする言語処理系
に合わせて変換したものを、その言語処理系に渡すので
ある。プリプロセッサ方式による日本語プログラミング
において、特に重要なのが日本語識別子をその目的とす
る言語処理系の文法規約に従った識別子の形に変換する
部分である。
Whether Japanese programming is possible depends on the language processing system of each computer system. For this reason, in order to enable Japanese language programming in a language processing system in which Japanese language programming is not possible, a preprocessor method is usually used. That is, the result obtained by converting the Japanese notation part in the source program according to the target language processing system is passed to the language processing system. Particularly important in Japanese language programming by the preprocessor method is a part that converts a Japanese identifier into an identifier in accordance with a grammar rule of a target language processing system.

【0004】従来の公知技術として、日本語識別子の日
本語2バイト文字を4桁の16進数とみなし1バイト文
字4文字で表記する方法、また日本語2バイト文字を3
2進表記の1バイト文字3文字に変換する方法(平林:
情報処理学会プログラミング言語研究会資料16−2
「C言語の日本語化とその効果」、1988)がある。
一般的に言えば、文法規約上、識別子の有効文字数に制
限があるため、変換後の識別子の文字数が大幅に増える
ことは好ましくない。このため、前記方法を改良した方
法として特開平−225690号公報での方法が提案さ
れている。
As a conventional publicly known technique, Japanese two-byte characters of a Japanese identifier are regarded as four-digit hexadecimal numbers and are represented by four one-byte characters.
How to convert binary notation into three single-byte characters (Hirabayashi:
IPSJ Programming Language Study Group Material 16-2
"Japanese translation of C language and its effects", 1988).
Generally speaking, the number of valid characters of an identifier is limited by the grammar rules, so it is not preferable that the number of characters of the converted identifier be significantly increased. For this reason, a method in JP-A-225690 has been proposed as an improved method of the above method.

【0005】この方法は日本語2バイト文字の使用頻度
の高低に目を付け、1バイト文字による62進表記(数
字10文字、英大文字26文字、英小文字26文字を使
った表記)を使うことにより、使用頻度の高い日本語2
バイト文字を1バイト文字2文字に、使用頻度の低い日
本語2バイト文字を1バイト文字3文字に変換する方法
である。この方法によれば、大部分の日本語識別子が同
じ長さの識別子に変換できるとしている。
This method focuses on the frequency of use of Japanese double-byte characters, and uses a hexadecimal notation of 1-byte characters (10 numeric characters, 26 uppercase letters, 26 lowercase letters). The most frequently used Japanese 2
This is a method of converting byte characters into two single-byte characters, and converting two-byte Japanese characters that are not frequently used into three single-byte characters. According to this method, most Japanese identifiers can be converted to identifiers of the same length.

【0006】[0006]

【発明が解決しようとする課題】しかしながら、これら
従来の技術、日本語識別子を構成する文字単位に変換す
る方法、には種々の問題が存在している。
However, there are various problems with these conventional techniques and methods for converting Japanese identifiers into character units.

【0007】1つは、全ての識別子が日本語文字でのみ
構成されていることを暗黙の条件としていることであ
る。日本語文字と1バイト文字の混在する識別子を想定
すれば、このことは明かである。例えば、前記公報の方
法では、日本語識別子「漢字」は1バイト文字による識
別子「JaV7」に変換されるが、これは本来の1バイ
ト文字のみから成る識別子「JaV7」及び1バイト文
字と日本語文字の混合した識別子「Ja字」と干渉す
る。従って、1バイト文字と日本語文字の混在する識別
子は使えないことになる。
One is that an implicit condition is that all identifiers are composed only of Japanese characters. This is clear if identifiers containing both Japanese characters and single-byte characters are assumed. For example, in the method disclosed in the above publication, the Japanese identifier “Kanji” is converted into an identifier “JaV7” using single-byte characters. It interferes with the identifier "Ja character" in which characters are mixed. Therefore, an identifier in which one-byte characters and Japanese characters are mixed cannot be used.

【0008】2つ目は、文法規約からの一般的な要請
「識別子の最初の文字は英文字で始まる」である。例え
ば、前記公報の方法では、日本語文字「あ」で始まる識
別子は先頭2文字が「4Z」で始まる識別子に変換され
るが、これは文法規約に従った識別子とはなり得ない。
従って、変換後の識別子の先頭文字が数字となる日本語
識別子は使えないことになる。
[0008] The second is a general request from the grammar rules, "The first character of an identifier starts with an alphabetic character." For example, in the method disclosed in the above publication, an identifier starting with the Japanese character "A" is converted into an identifier whose first two characters start with "4Z", but this cannot be an identifier according to the grammatical rules.
Therefore, a Japanese identifier in which the first character of the converted identifier is a numeral cannot be used.

【0009】3つ目は、大文字と小文字の区別をしない
FORTRANのような言語処理系では、識別子の62
進表記が使えないことである。従って、前記公報の方法
は識別子の62進表記が可能な言語処理系でのみ実施で
きる。
Third, in a language processing system such as FORTRAN that does not distinguish between uppercase and lowercase letters, the identifier 62
Hexadecimal notation cannot be used. Therefore, the method disclosed in the above publication can be implemented only in a language processing system capable of expressing a hexadecimal identifier.

【0010】4つ目は、変換後の識別子の文字数が増え
ることである。前記公報の方法にしても使用頻度の低い
日本語文字を使った識別子では変換後の文字数は増える
ことになる。この様に従来の方法には問題が残ってお
り、種々の条件付でしか実施できない。
Fourth, the number of characters of the converted identifier increases. Even in the method disclosed in the above publication, the number of characters after conversion is increased in an identifier using Japanese characters that are not frequently used. As described above, the conventional method still has problems, and can be implemented only under various conditions.

【0011】また、有効文字数の制限及び特殊文字(例
えば「$」、「@」)の使用制限も識別子に関連する問
題であり、本発明の解決しようとする課題の一部であ
る。
The limitation of the number of valid characters and the limitation of the use of special characters (for example, "@" and "@") are also problems related to identifiers, and are part of the problem to be solved by the present invention.

【0012】従って、本発明の目的は、特定の言語処理
系の特性に依存しない汎用的な手法を使うことにより、
一般的なコンピュータシステムにおいて、既存の言語処
理系を変更することなく、拡張識別子の使用を可能にす
ることである。この中には、必然的に、日本語プログラ
ミングを可能にすることも含まれる。また、拡張識別子
の使用が可能なシステムと不可能なシステム間でのプロ
グラムの互換性を保持するための方法についても提供す
る。
Accordingly, an object of the present invention is to use a general-purpose method that does not depend on the characteristics of a specific language processing system.
An object of the present invention is to make it possible to use an extended identifier in a general computer system without changing an existing language processing system. This includes, inevitably, enabling Japanese programming. Also provided is a method for maintaining program compatibility between systems that can and cannot use extended identifiers.

【0013】[0013]

【課題を解決するための手段】ソースプログラムでの識
別子の持つ役割は、プログラマ側から見れば、特定の可
変量に、特定の名称を付け、特定の意味付けをすること
にある。しかし、言語処理系から見れば、識別子の役割
は特定の可変量をその他の可変量から区別することにあ
る。この意味において、識別子が日本語表現であるか、
英語表現であるか、又は単なるランダムな文字の集合で
あるかは本質的な問題ではない。また、識別子の有効文
字数の長短についても同様である。従って、プログラム
中の特定の識別子を、他の識別子と干渉しないという条
件で、別の識別子に換えることができる。この処理は、
従来の技術のように識別子を構成する文字単位毎に行う
必要はなく、識別子単位で行うことができる。
The role of an identifier in a source program is to give a specific name to a specific variable and give a specific meaning from the viewpoint of a programmer. However, from the viewpoint of the language processing system, the role of the identifier is to distinguish a specific variable from other variables. In this sense, if the identifier is a Japanese expression,
It is not essential whether it is an English expression or just a random set of characters. The same applies to the length of the valid characters of the identifier. Therefore, a specific identifier in a program can be replaced with another identifier on the condition that it does not interfere with another identifier. This process
It is not necessary to perform it for each character constituting the identifier as in the related art, but for each identifier.

【0014】この原理をふまえ、本発明を図1及び図2
を使って説明する。
Based on this principle, the present invention is shown in FIGS.
I will explain using.

【0015】本発明は変換テーブル10、登録手段2、
及び変換手段3を有する。変換テーブル10は拡張識別
子の名称変換をするためのテーブルであり、図2に示す
ように、拡張識別子11と対応する変換識別子12より
成る。登録手段2は、原ソースプログラム1中の拡張識
別子を前記変換テーブル10に登録する手段である。変
換手段3は、前記変換テーブル10を用い、原ソースプ
ログラム1を目的ソースプログラム4に変換する手段で
ある。
The present invention provides a conversion table 10, a registration unit 2,
And conversion means 3. The conversion table 10 is a table for converting the name of an extended identifier, and as shown in FIG. 2, is composed of an extended identifier 11 and a corresponding conversion identifier 12. The registration means 2 is a means for registering the extension identifier in the original source program 1 in the conversion table 10. The conversion means 3 is a means for converting the original source program 1 into the target source program 4 using the conversion table 10.

【0016】登録手段2では、原ソースプログラム1を
走査し拡張識別子を探査する。この拡張識別子について
前記変換テーブル10を探し登録判定する。すなわち、
もしこの拡張識別子が前記変換テーブル10に未登録な
ら、登録すべきものとし、あるいは既に登録済みなら、
登録の必要なきものとする。登録すべきものと判定され
たなら、対応する変換識別子を自動生成しこの拡張識別
子と共に変換テーブルに登録する。この処理を原ソース
プログラム1中の全ての拡張識別子について行う。この
結果、変換テーブル10が得られる。また、本登録手段
2の処理では、原ソースプログラム1の処理をある単位
毎(例えば1行単位)に行ってもよく、結果として、原
ソースプログラム1中の全拡張識別子についての変換テ
ーブル10ができればよい。
The registration means 2 scans the original source program 1 and searches for an extended identifier. The conversion table 10 is searched for the extension identifier to determine the registration. That is,
If this extension identifier is not registered in the conversion table 10, it should be registered, or if it has already been registered,
No registration is required. If it is determined that registration is to be performed, a corresponding conversion identifier is automatically generated and registered in the conversion table together with the extension identifier. This process is performed for all extended identifiers in the original source program 1. As a result, a conversion table 10 is obtained. Further, in the processing of the main registration means 2, the processing of the original source program 1 may be performed for each unit (for example, one line unit). As a result, the conversion table 10 for all the extended identifiers in the original source program 1 If possible.

【0017】自動生成する変換識別子は、目的言語処理
系5の文法規約に従い、かつ他の識別子、予約語(キー
ワードとも呼ばれる)と干渉しないという条件で、任意
にその名称を決めることができる。
The name of the automatically generated conversion identifier can be arbitrarily determined in accordance with the grammatical rules of the target language processing system 5 and under the condition that it does not interfere with other identifiers or reserved words (also called keywords).

【0018】本発明では、名称を生成するルールとして
の名称の原型を決め、これに従って前記変換識別子を自
動生成する。名称の原型としては、名称固定部と名称可
変部を持ち、名称固定部には任意に決めた固定文字を対
応させ、名称可変部には基数をnとしたn進表記による
任意の桁数のn進数の連続数を対応させる。nが10の
とき、名称可変部は10進数の連続番号となる(例えば
000、001、002、003、・・・)。ここで、
表記のためのn進数字は必ずしも数字(0、1、2、・
・・)である必要はなく、英字(a、b、c、・・・)
でもよい。例えば、n進数字を「a」、「b」、
「c」、・・・としたら、名称可変部はaaa,aa
b、aac,・・・となる。また、重複しなければ任意
の文字の任意の序列でも可能である。例えば、n進数字
を「g」、「6」、「w」、・・・としたら、名称可変
部はggg,gg6、ggw、・・・となる。さらに、
名称可変部だけで先頭文字が非数字の変換識別子を生成
できるのであれば、名称固定部は必ずしも必須ではな
い。
According to the present invention, a prototype of a name as a rule for generating a name is determined, and the conversion identifier is automatically generated in accordance with the prototype. The prototype of the name has a fixed name part and a variable name part. The fixed name part is made to correspond to an arbitrary fixed character. Corresponds to consecutive n-ary numbers. When n is 10, the name variable part is a serial number in decimal (for example, 000, 001, 002, 003,...). here,
The n-ary digits for notation are not necessarily numbers (0, 1, 2, ...
・ ・) It is not necessary to use alphabets (a, b, c, ...)
May be. For example, if the n-ary digits are "a", "b",
If "c", ..., the name variable part is aaa, aa
b, aac,... Unless they overlap, any order of any character is possible. For example, if the n-ary numbers are “g”, “6”, “w”,..., The name variable parts are ggg, gg6, ggw,. further,
If a conversion identifier whose first character is a non-numeric character can be generated only by the name variable part, the name fixing part is not necessarily required.

【0019】また、識別子としての一意性が保証される
のであれば、名称可変部は必ずしも連続数である必要は
なく、連続して生成される数列でもよい。例えば、長周
期の疑似乱数、又はそれをn進表記したものでもよい。
Further, as long as uniqueness as an identifier is guaranteed, the name variable portion does not necessarily have to be a continuous number, but may be a sequence of numbers generated continuously. For example, it may be a long-period pseudo-random number or an n-ary notation thereof.

【0020】図2では、変換識別子の例として、名称固
定部a及び名称可変部nnn(nnnは001から99
9の10進数)より成る原型annnの型を持つ名称を
使った。もし特定の原型を持つ変換識別子が他の識別子
と干渉する可能性を心配するのであれば、拡張識別子だ
けでなく、原ソースプログラム中の全ての識別子を処理
の対象にすればよい。
In FIG. 2, as an example of the conversion identifier, a name fixed part a and a name variable part nnn (nnn is 001 to 99)
(Decimal number of 9) was used. If there is a concern that a conversion identifier having a specific prototype may interfere with other identifiers, all identifiers in the source program need to be processed, not just extension identifiers.

【0021】変換手段3では、原ソースプログラム1を
走査し拡張識別子を探査する。この拡張識別子について
前記変換テーブル10を探す。拡張識別子は前記登録手
段2で登録してあるので、必ず前記登録テーブル10に
見つかる。対応する変換識別子でこの拡張識別子を置き
換える。この処理を前記原ソースプログラム1の全ての
拡張識別子について行ったものを、目的ソースプログラ
ム4として出力する。また、本変換手段3の処理では、
前記登録手段2と同様に、原ソースプログラム1の処理
をある単位毎(例えば1行単位)に行ってもよく、結果
として原ソースプログラム1を目的ソースプログラム4
に変換できればよい。
The conversion means 3 scans the original source program 1 and searches for an extended identifier. The conversion table 10 is searched for the extension identifier. Since the extension identifier is registered by the registration means 2, it is always found in the registration table 10. Replace this extended identifier with the corresponding conversion identifier. The result of performing this processing for all extended identifiers of the original source program 1 is output as the target source program 4. In the processing of the conversion means 3,
Similar to the registration means 2, the processing of the original source program 1 may be performed for each unit (for example, one line unit).
Anything that can be converted to

【0022】また、登録手段と変換手段を別々に行って
もよいが(2パス方式)、前記2手段を同時平行的に行
ってもよい(1パス方式)。
The registration means and the conversion means may be performed separately (two-pass method), or the two means may be performed simultaneously in parallel (one-pass method).

【0023】目的言語処理系5で、目的ソースプログラ
ム4を処理することにより、実行プログラム6と目的ソ
ースプログラム4に対するメッセージ7が出力される。
逆変換手段8では、変換テーブル10を用い、メッセー
ジ7中の識別子を拡張識別子で置き換える。これによ
り、メッセージ7を原ソースプログラム1に対するメッ
セージ9に読み替えることができる。
The target language processing system 5 processes the target source program 4 to output an execution program 6 and a message 7 for the target source program 4.
The reverse conversion means 8 uses the conversion table 10 to replace the identifier in the message 7 with the extension identifier. As a result, the message 7 can be read as the message 9 for the original source program 1.

【0024】特定の拡張識別子と対応する変換識別子を
変換テーブル10に事前登録しておくことにより、原ソ
ースプログラム1中の特定の拡張識別子を特定の識別子
に指定して変換することができる。このとき、事前登録
のない拡張識別子には自動生成した変換識別子が割り当
てられる。
By pre-registering a conversion identifier corresponding to a specific extension identifier in the conversion table 10, it is possible to specify and convert a specific extension identifier in the original source program 1 to a specific identifier. At this time, an extension identifier that has not been registered in advance is assigned an automatically generated conversion identifier.

【0025】これを意図的に、原ソースプログラム1中
の全識別子について組織的に行うことにより、拡張識別
子の処理可能な言語処理系でのソースプログラムを処理
不可能な言語処理系へ容易に移植できる。逆もまた同様
である。
By intentionally performing this systematically for all identifiers in the original source program 1, a source program in a language processing system capable of processing extended identifiers can be easily ported to a language processing system incapable of processing. it can. The reverse is also true.

【0026】図1に示す通り、登録手段2と逆変換手段
8の間に目的言語処理系5の処理が入る。このため、シ
ングルプロセス方式で本発明を実施するような場合、変
換テーブル10を逆変換手段8の実行時までメモリ上に
保持できない。従って、このような場合には、変換テー
ブル10を一時的にディスク等の外部記憶装置に保存し
ておき、逆変換手段8の実行時にメモリ上に読み込む必
要がある。
As shown in FIG. 1, the processing of the target language processing system 5 enters between the registration means 2 and the inverse conversion means 8. For this reason, when the present invention is implemented by the single process method, the conversion table 10 cannot be held in the memory until the inverse conversion unit 8 is executed. Therefore, in such a case, it is necessary to temporarily store the conversion table 10 in an external storage device such as a disk and read it into the memory when the inverse conversion means 8 is executed.

【0027】[0027]

【実施例】図3はC言語風に書いた拡張識別子を含む原
ソースプログラム1の1例である。これをサンプルプロ
グラムとして、自動生成する変換識別子12の原型をa
nnn(nnnは001から999の10進数)、登録
手段2及び変換手段3を別ステップとする2パス方式の
場合の実施例を、実例に沿って説明する。
FIG. 3 shows an example of an original source program 1 including an extended identifier written in a C language style. Using this as a sample program, the prototype of the conversion identifier 12 automatically generated is a
An embodiment in the case of a two-pass system in which nnn (nnn is a decimal number from 001 to 999), the registration unit 2 and the conversion unit 3 will be described according to an actual example.

【0028】最初、処理のための準備をする。すなわ
ち、変換テーブル10をクリアし、登録してある拡張識
別子の数をゼロにする。図3の原ソースプログラム1を
入力し、メモリ上に読み込む。次の登録手段2及び変換
手段3での、原ソースプログラム1に対しての処理はメ
モリ上にある原ソースプログラム1に対して行うものと
する。また、変換テーブル10もメモリ上にあるものと
する。
First, preparations for processing are made. That is, the conversion table 10 is cleared, and the number of registered extension identifiers is set to zero. The original source program 1 shown in FIG. 3 is input and read into the memory. The processing for the original source program 1 in the registration means 2 and the conversion means 3 is performed on the original source program 1 in the memory. It is also assumed that the conversion table 10 is also on the memory.

【0029】登録手段2で、原ソースプログラム1をC
言語の文法規約に従って走査し拡張識別子を探査する。
実例では、最初の文字列「float」は予約語なので
通過する。次の文字列「面積1」は拡張識別子なので変
換テーブル10を探し登録判定する。「面積1」はこの
時点では未登録なので、対応する変換識別子として「a
001」を自動生成し、共に変換テーブル10に登録す
る。続く「幅1」、「高さ1」、「面積2」、「幅
2」、「高さ2」も同様に変換テーブル10を探し登録
判定する。これらもこの時点では未登録なので、対応す
る変換識別子として「a002」から「a006」を自
動生成し、共に変換テーブル10に登録する。続く「面
積1」について、変換テーブル10を探し登録判定す
る。「面積1」はこの時点で登録済みなので通過する。
続く他の拡張識別子についても同様の処理をする。原ソ
ースプログラム1の全拡張識別子を処理した段階で、図
2に示す変換テーブル10が得られる。後の逆変換手段
8のために、変換テーブル10を外部記憶装置に保存す
る。
The registration means 2 stores the original source program 1 in C
Scan according to language grammar rules for extended identifiers.
In the actual example, the first character string “float” is a reserved word and is passed. Since the next character string “area 1” is an extended identifier, the conversion table 10 is searched for registration judgment. Since “area 1” has not been registered at this time, “a” is used as the corresponding conversion identifier.
001 ”is automatically generated and registered together in the conversion table 10. The subsequent “width 1”, “height 1”, “area 2”, “width 2”, and “height 2” similarly search the conversion table 10 and determine registration. Since these are not registered at this time, "a006" is automatically generated from "a002" as the corresponding conversion identifier, and both are registered in the conversion table 10. For the subsequent “area 1”, the conversion table 10 is searched for registration judgment. "Area 1" has already been registered at this point and will be passed.
The same processing is performed for the other extension identifiers that follow. When all extension identifiers of the original source program 1 have been processed, the conversion table 10 shown in FIG. 2 is obtained. The conversion table 10 is stored in an external storage device for the later inverse conversion means 8.

【0030】変換手段3では、原ソースプログラム1を
もう一度先頭から走査し、拡張識別子を探査する。文字
列「float」は予約語なので通過する。次の拡張識
別子「面積1」について、変換テーブル10を探し対応
する変換識別子「a001」を取り出す、原ソースプロ
グラム1中の前記「面積1」を前記「a001」で置き
換える。続く他の拡張識別子に対しても同様な処理を行
い、それぞれの対応する変換識別子で置き換える。この
結果、図4の目的ソースプログラム4が得られる。目的
ソースプログラム4を出力し、目的言語処理系5に渡
す。
The conversion means 3 scans the original source program 1 again from the beginning and searches for an extended identifier. The character string "float" is a reserved word and passes through. For the next extended identifier “area 1”, the conversion table 10 is searched for the corresponding conversion identifier “a001”, and the “area 1” in the original source program 1 is replaced with the “a001”. The same processing is performed on the other extension identifiers that follow, and replaced with the corresponding conversion identifiers. As a result, the target source program 4 of FIG. 4 is obtained. The target source program 4 is output and passed to the target language processing system 5.

【0031】目的ソースプログラム4を目的言語処理系
5で処理する。目的言語処理系5は実行プログラム6と
メッセージ7を出力する。例として、メッセージ7が
「undefined a008」であるとする。
The target source program 4 is processed by the target language processing system 5. The target language processing system 5 outputs an execution program 6 and a message 7. As an example, assume that the message 7 is “undefined a008”.

【0032】前記登録手段2で作成・保存した変換テー
ブル10をメモリ上に読み込む。逆変換手段8では、変
換テーブル10を用い、前記メッセージ7中の識別子
「a008」を拡張識別子「合計面積」で置き換える。
これにより、メッセージ9「undefined 合計
面積」が得られる。
The conversion table 10 created and stored by the registration means 2 is read into a memory. The inverse conversion means 8 uses the conversion table 10 to replace the identifier “a008” in the message 7 with the extended identifier “total area”.
Thereby, the message 9 “undefined total area” is obtained.

【0033】また、特定の拡張識別子を特定の変換識別
子に指定して、ソースプログラム変換をする例を図5及
び図6に示す。図5の例のように、特定拡張識別子と特
定変換識別子を変換テーブル10に事前登録する。前記
例のソースプログラム1に対し、登録手段2及び変換手
段3を実行することにより、図6の目的ソースプログラ
ム4が得られる。こうして得た目的ソースプログラム4
は拡張識別子をサポートしない言語処理系のシステムへ
移植可能である。
FIGS. 5 and 6 show examples of source program conversion by designating a specific extension identifier as a specific conversion identifier. As in the example of FIG. 5, the specific extension identifier and the specific conversion identifier are registered in the conversion table 10 in advance. By executing the registration unit 2 and the conversion unit 3 on the source program 1 of the above example, the target source program 4 of FIG. 6 is obtained. The target source program 4 thus obtained
Is portable to language processing systems that do not support extended identifiers.

【0034】[0034]

【発明の効果】本発明によれば、ソースプログラム中の
拡張識別子を識別子単位に変換することにより、広範な
システムにおいて、特定の言語に限定せずに、拡張識別
子の使用が可能になる、ひいては日本語プログラミング
も実現できる。その結果、ソースプログラムの記述性及
び判読性が向上し、従って、プログラムの品質の向上、
保守性の改善、及び生産性が向上する。さらに、本発明
はプリプロセッサ方式を使っているため、従来のシステ
ムの言語処理系を変更することなく実施できる。さら
に、拡張識別子の使用が可能なシステムと不可能なシス
テム間での互換性の保持が容易なため、導入に負担がか
からない。
According to the present invention, by converting an extended identifier in a source program into an identifier unit, the extended identifier can be used in a wide range of systems without being limited to a specific language. Japanese programming can also be realized. As a result, the description and readability of the source program are improved, and therefore, the quality of the program is improved,
Improves maintainability and productivity. Further, since the present invention uses the preprocessor system, it can be implemented without changing the language processing system of the conventional system. Furthermore, since it is easy to maintain compatibility between a system that can use the extended identifier and a system that cannot use the extended identifier, there is no burden on the introduction.

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

【図1】本発明の2パス方式による実施例を示す概略ブ
ロック図。
FIG. 1 is a schematic block diagram showing an embodiment according to a two-pass system of the present invention.

【図2】変換テーブルの例を示す図。FIG. 2 is a diagram showing an example of a conversion table.

【図3】C言語風に書いた原ソースプログラムの例を示
す図。
FIG. 3 is a diagram showing an example of an original source program written in a C language style.

【図4】変換処理の結果得られる目的ソースプログラム
の例を示す図。
FIG. 4 is a diagram showing an example of a target source program obtained as a result of a conversion process.

【図5】事前登録した場合の変換テーブルの例を示す
図。
FIG. 5 is a diagram showing an example of a conversion table when pre-registered.

【図6】変換処理の結果得られる目的ソースプログラム
の例を示す図。
FIG. 6 is a diagram showing an example of a target source program obtained as a result of the conversion processing.

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

1 原ソースプログラム 2 登録手段 3 変換手段 4 目的ソースプログラム 5 目的言語処理系 6 実行プログラム 7 目的ソースプログラムに対するメッセージ 8 逆変換手段 9 原ソースプログラムに対するメッセージ 10 変換テーブル 11 拡張識別子 12 変換識別子 Reference Signs List 1 original source program 2 registration means 3 conversion means 4 target source program 5 target language processing system 6 execution program 7 message for target source program 8 inverse conversion means 9 message for original source program 10 conversion table 11 extension identifier 12 conversion identifier

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 原ソースプログラム中の変換すべき拡張
識別子と、これに対応する変換識別子より成る変換テー
ブルを備え、原ソースプログラム中の拡張識別子を探査
し、この拡張識別子が前記変換テーブルに未登録なら、
これに対応する変換識別子を自動生成し、この拡張識別
子と共に前記変換テーブルに登録する登録手段と、前記
原ソースプログラム中の拡張識別子を探査し、この拡張
識別子を前記変換テーブル上に探し、これに対応する変
換識別子で前記原ソースプログラム中のこの拡張識別子
を置き換えたものを作ることにより、前記原ソースプロ
グラムを目的ソースプログラムに変換する変換手段を持
つことを特徴とするソースプログラム変換方法。
A conversion table comprising an extension identifier to be converted in an original source program and a conversion identifier corresponding to the extension identifier; searching for an extension identifier in the original source program; If you register,
A registration means for automatically generating a corresponding conversion identifier and registering the conversion identifier together with the extension identifier in the conversion table, searching for an extension identifier in the original source program, searching for the extension identifier in the conversion table, A source program conversion method, comprising: conversion means for converting the original source program into a target source program by creating a replacement identifier for the extension identifier in the original source program with a corresponding conversion identifier.
【請求項2】 前記対応する変換識別子の自動生成にお
いて、自動生成する変換識別子の名称の名称可変部を、
nを任意の数としたn進数表記による連続数より作成す
ることを特徴とする請求項1記載のソースプログラム変
換方法。
2. A method for automatically generating a corresponding conversion identifier, comprising the steps of:
2. The source program conversion method according to claim 1, wherein the source program is created from a continuous number in n-ary notation where n is an arbitrary number.
【請求項3】 前記対応する変換識別子の自動生成にお
いて、自動生成する変換識別子の名称の名称可変部を、
nを任意の数としたn進数表記による、連続して生成す
る数列より作成することを特徴とする請求項1記載のソ
ースプログラム変換方法。
3. In the automatic generation of the corresponding conversion identifier, a name variable part of a name of the conversion identifier to be automatically generated,
2. The source program conversion method according to claim 1, wherein the program is created from a sequence of numbers continuously generated in n-base notation where n is an arbitrary number.
【請求項4】 前記変換テーブルに、あらかじめ特定の
拡張識別子と対応する変換識別子を事前登録しておくこ
とを特徴とする、請求項1、2又は3記載のソースプロ
グラム変換方法。
4. The source program conversion method according to claim 1, wherein a conversion identifier corresponding to a specific extension identifier is registered in the conversion table in advance.
【請求項5】 請求項1、2、3又は4記載のソースプ
ログラム変換方法で変換した目的ソースプログラムを目
的言語処理系で処理した結果出力されるメッセージにつ
いて、このメッセージ中の識別子を前記変換テーブルの
変換識別子とみなし、このメッセージ中のこの識別子を
前記変換テーブル上に検索し、これに対応する拡張識別
子でこのメッセージ中のこの識別子を置き換えたものを
作ることにより、メッセージの変換を行うことを特徴と
するメッセージ変換方法。
5. A message output as a result of processing a target source program converted by the source program conversion method according to claim 1, by a target language processing system, by using an identifier in the message as the conversion table. Is considered as a conversion identifier of the message, the identifier in the message is searched on the conversion table, and a message obtained by replacing the identifier in the message with an extension identifier corresponding to the identifier is created. Characteristic message conversion method.
JP4098098A 1998-02-09 1998-02-09 Method for converting extended identifier in source program Pending JPH11232122A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4098098A JPH11232122A (en) 1998-02-09 1998-02-09 Method for converting extended identifier in source program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4098098A JPH11232122A (en) 1998-02-09 1998-02-09 Method for converting extended identifier in source program

Publications (1)

Publication Number Publication Date
JPH11232122A true JPH11232122A (en) 1999-08-27

Family

ID=12595590

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4098098A Pending JPH11232122A (en) 1998-02-09 1998-02-09 Method for converting extended identifier in source program

Country Status (1)

Country Link
JP (1) JPH11232122A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012190381A (en) * 2011-03-14 2012-10-04 Nec Engineering Ltd Method for preventing log information leak and log information leak preventing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012190381A (en) * 2011-03-14 2012-10-04 Nec Engineering Ltd Method for preventing log information leak and log information leak preventing device

Similar Documents

Publication Publication Date Title
Hutton Higher-order functions for parsing
US7278100B1 (en) Translating a non-unicode string stored in a constant into unicode, and storing the unicode into the constant
JPH0630066B2 (en) Table type language translation method
EP1352330A1 (en) Method and system for generating structured data from semi-structured data sources
US6055365A (en) Code point translation for computer text, using state tables
US7051278B1 (en) Method of, system for, and computer program product for scoping the conversion of unicode data from single byte character sets, double byte character sets, or mixed character sets comprising both single byte and double byte character sets
US6912516B1 (en) Place name expressing dictionary generating method and its apparatus
JPH10301790A (en) Assemble processing system
JPH11232122A (en) Method for converting extended identifier in source program
Davis et al. Unicode regular expressions
Lee The formal definition of the BASIC language
US20080141230A1 (en) Scope-Constrained Specification Of Features In A Programming Language
Morris et al. A system program generator
Ledgard A formal system for defining the syntax and semantics of computer languages
Oo et al. Implementation of Lexical Analysis on Assignment Statements in C++ Programming Language
US20040117774A1 (en) Linguistic dictionary and method for production thereof
Brooker et al. Trees and routines
Feldman et al. Hybrid semantic tagging for information extraction
Andrieș et al. Design of domain specific language for astrological charts generation-AlakirOl
JPH08123694A (en) C compiler
JP4061283B2 (en) Apparatus, method and program for converting lexical data to data
JP2007004503A (en) Program conversion method, program conversion method, and code conversion program
JPH03164834A (en) System for mutual conversion between programming languages
JP2005275880A (en) Device, method and program for converting word and phrase into data
JP3018579B2 (en) Name search processor