JPH02195438A - Recursive access detecting system in microdevelopment - Google Patents

Recursive access detecting system in microdevelopment

Info

Publication number
JPH02195438A
JPH02195438A JP1014754A JP1475489A JPH02195438A JP H02195438 A JPH02195438 A JP H02195438A JP 1014754 A JP1014754 A JP 1014754A JP 1475489 A JP1475489 A JP 1475489A JP H02195438 A JPH02195438 A JP H02195438A
Authority
JP
Japan
Prior art keywords
macro
source program
expansion
area
name
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
JP1014754A
Other languages
Japanese (ja)
Inventor
Yuzo Iida
飯田 雄三
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP1014754A priority Critical patent/JPH02195438A/en
Publication of JPH02195438A publication Critical patent/JPH02195438A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

PURPOSE:To correctly develope the reculsive access detection of a macro name based upon an ordinary method without using recursive access even when a practically developed result is extremely large by setting up the maximum number of retrievals as the total definition number of macro names. CONSTITUTION:A source program is inputted from an undeveloped source program file by a source program input means 3, and when a macro name is included in the inputted source program, a macro developing means 4 retrieves macros in a macro definition area 1 so that the number of macros concerned does not exceeds the total definition number and obtains the result of the macro development concerned. The result is outputted to a source program film 8 by a source program output means 5. When no macro is searched in the area, the means 4 outputs an error. The shown diagram indicates the developing procedure of the means 4 and the area 1 consists of a macro name storing area 6 and a counter indicating the total definition number of macro names.

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明はマクロ展開における回帰的呼び出し検出方式に
関し、特にコンパイラの処理のマクロ展開における回帰
的呼び出し検出方式に関する。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a recursive call detection method in macro expansion, and more particularly to a recursive call detection method in macro expansion in compiler processing.

(従来の技術) 従来、この種のマクロ展開処理は、コンパイラの処理の
一部であり、ソースプログラム中に現れる定数、名標、
式等を一つの論理的な集合であるマクロとして定義し、
このマクロ名を参照することにより、これら定数、名標
、式等の代わりに記述することを可能とする。
(Prior Art) Conventionally, this type of macro expansion processing has been part of compiler processing, and has been used to process constants, names,
Define expressions as a macro, which is a logical set,
By referring to this macro name, it is possible to write it in place of these constants, names, expressions, etc.

この方式において、マクロ名の回帰的呼び出し時の無限
回参照の検出方式は第2図(a)および第2図(b)で
示すようにマクロを展開する際に展開領域へ展開した結
果を記憶していき、展開結果が展開領域内に納まらない
時にエラーを検出する方式となっていた。
In this method, the method for detecting infinite references when recursively calling a macro name is to store the result of expansion in the expansion area when expanding the macro, as shown in Figure 2 (a) and Figure 2 (b). The method was to detect an error when the expansion result did not fit within the expansion area.

即ち、第2図において、マクロ展開処理は、展開前ソー
スプログラムファイル2からのソースプログラムは、ソ
ースプログラム入力手段3を介して入力され、マクロ展
開が不要と判断されれば、ソースプログラム出力手段5
によりソースプログラムが出力される。一方、マクロ展
開が要と判断されれば、マクロ展開手段7はマクロ定義
領域1を検索して、該当マクロを展開したものを一時、
展開領域に記憶していき、領域を越える展開があるとエ
ラーとなる。展1mf&のソースプログラムは展開後ソ
ースプログラムファイル8に出力される。
That is, in FIG. 2, in the macro expansion process, the source program from the unexpanded source program file 2 is inputted via the source program input means 3, and if it is determined that macro expansion is not necessary, the source program is inputted to the source program output means 5.
The source program is output. On the other hand, if it is determined that macro expansion is necessary, the macro expansion means 7 searches the macro definition area 1 and temporarily expands the corresponding macro.
It is stored in the expansion area, and if there is expansion that exceeds the area, an error will occur. The source program of 1mf& is output to the source program file 8 after being expanded.

このように、従来のマクロ展開手段7は、マクロ展開し
た結果を記憶する展開領域をもち、この領域に展開した
結果が納まらないときに回帰的呼び出しが行われたもの
としていた。
In this manner, the conventional macro expansion means 7 has an expansion area for storing macro expansion results, and when the expanded results cannot be stored in this area, it is assumed that a recursive call is performed.

(発明が解決しようとする課題) 上述した従来のマクロ展開における回帰的呼び出し検出
の方式において、展開領域に展開結果が納まるか否かで
回帰的呼び出しの検出をおこなっているので、実際のマ
クロ展開が、回帰的呼び出しでなく、単に展開した結果
が、展開領域に納まらない場合にもエラーになってしま
い、展r#J領域の大きさに依存してしまうという欠点
がある。
(Problem to be Solved by the Invention) In the conventional method of detecting recursive calls in macro expansion described above, recursive calls are detected based on whether or not the expansion result fits in the expansion area. However, even if the result of simple expansion, rather than a recursive call, does not fit in the expansion area, an error will occur, and there is a drawback that it depends on the size of the expansion r#J area.

また、第2図(C)のようなマクロ参照が結果的に自分
自身を参照してしまうマクロ宣言では、展開領域に記憶
される展開結果がない場合に、回帰的呼び出しが検出で
きないという欠点もある。
In addition, a macro declaration in which a macro reference ends up referencing itself as shown in Figure 2 (C) has the disadvantage that recursive calls cannot be detected if there is no expansion result stored in the expansion area. be.

(課題を解決するための手段) 本発明によるマクロ展開における回帰的呼び出し検出方
式は、ソースプログラム中に現れる定数、名標、式等を
、一つのマクロと呼ぶ論理的な集合とし、この集合をマ
クロ名と呼ばれる名標で定義し、前記定数、名標、式等
の代わりに前記マクロ名を記述することにより、定数、
名標、式等の参照を可能とするコンパイラのマクロ展開
における回帰的呼び出し検出方式において、マクロ名の
参照処理時に前記マクロ名の回帰的呼び出しを予め定め
たマクロ名の総定義回数により制限する。
(Means for Solving the Problems) The recursive call detection method in macro expansion according to the present invention treats constants, names, expressions, etc. that appear in a source program as a logical set called one macro, and defines this set as one macro. By defining a name called a macro name and writing the macro name instead of the constant, name, expression, etc., you can create a constant,
In a recursive call detection method in macro expansion of a compiler that allows references to names, expressions, etc., recursive calls to the macro name are limited by a predetermined total number of definitions of the macro name during macro name reference processing.

(実施例) 次に図面を用いて本発明の一実施例を説明する。(Example) Next, one embodiment of the present invention will be described using the drawings.

第1図(a)は本発明によるマクロ展開における回帰的
呼び出し検出方式の構成を表す図であり、コンパイラ処
理の一部であるマクロ展開処理の概要が示されている。
FIG. 1(a) is a diagram showing the configuration of a recursive call detection method in macro expansion according to the present invention, and shows an overview of macro expansion processing, which is a part of compiler processing.

ソースプログラム入力手段3により展開前ソースプログ
ラムファイル2がらソースプログラムを入力し、入力し
たソースプログラム内にマクロ名があれば、マクロ展開
手段4はマクロ定義領域1内を、該当するマクロを総定
義数を越えない範囲で検索し、該当するマクロ展開の結
果を得、この結果をソースプログラム出力手段5により
展開後ソースプログラムフアイル8に出力するものであ
る。マクロ展開手段4は、上記範囲内検索で探せない場
合はエラーとする。
When a source program is inputted from the source program file 2 before expansion using the source program input means 3, and if there is a macro name in the input source program, the macro expansion means 4 inputs the corresponding macro into the macro definition area 1, with the total number of definitions. The search is performed within a range not exceeding , the result of corresponding macro expansion is obtained, and this result is outputted to the source program file 8 after expansion by the source program output means 5. The macro expansion means 4 determines an error if it cannot be found by the above-mentioned range search.

第1図(b)は、マクロ展開手段4における展開方式を
示すもので、マクロ定義領域1は、マクロ名記憶領域6
およびマクロ名の総定義数を示すカウンタから成ってい
る。この例で示すX=VAL5は1回目の展開でX=V
AL6となり、2回目の展開ではX=VAL5と、通常
の処理方式では無限回繰り返すが、本処理方式では、展
開する回数の最大値をマクロ名の総定義回数とすること
により、無限回繰り返しは行われない、これにより、マ
クロ名展開における回帰的呼び出しを検出している。
FIG. 1(b) shows the expansion method in the macro expansion means 4, where the macro definition area 1 is the macro name storage area 6.
and a counter indicating the total number of defined macro names. X=VAL5 shown in this example is X=V in the first expansion
The result is AL6, and in the second expansion, X = VAL5, which would be repeated infinitely in the normal processing method, but in this processing method, by setting the maximum number of expansions to the total number of times the macro name is defined, infinite repetition is not possible. This detects recursive calls in macro name expansion.

第1図(C)は、第1図(a)におけるマクロ定義領域
1および展開前ソースプログラムファイル2の例を示す
ものである。この例ではマクロ定義領1lil11の6
0および70行の定義においてVAL5.VAL6は結
果的に自分自身を参照するマクロ名の回帰的呼び出しを
示している。従って展開前ソースプログラムファイル2
の1000行目は’30M=1000+2000 ;”
と展開されるが、1100行目は回帰的呼び出しのため
に展開不可能となる。
FIG. 1(C) shows an example of the macro definition area 1 and the unexpanded source program file 2 in FIG. 1(a). In this example, 6 of macro definition area 1lil11
In the definition of lines 0 and 70, VAL5. VAL6 indicates a recursive invocation of a macro name that eventually refers to itself. Therefore, source program file 2 before expansion
The 1000th line of '30M=1000+2000;'
However, the 1100th line cannot be expanded because of the recursive call.

(発明の効果) 以上説明したように本発明によれば、従来方式の展開領
域の大きさに依存してしまうマクロ名の回帰的呼び出し
検出を、最大検索数をマクロ名の総定義数とすることで
、実際に展開した結果がいかに大きくても回帰的呼び出
しとせずに正しく展開ができる効果およびマクロ名が結
果的に自分自身となる宣言においての回帰的呼び出しの
検出を行うことができるという効果がある。
(Effects of the Invention) As explained above, according to the present invention, the recursive call detection of macro names, which depends on the size of the expansion area in the conventional method, is performed by setting the maximum number of searches to the total number of macro name definitions. This has the effect that no matter how large the actual expansion result is, it can be expanded correctly without making it a recursive call, and it is possible to detect recursive calls in declarations where the macro name ends up being itself. There is.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図(a)は本発明による回帰的呼び出し検出方式の
全体図、第1図(b)は第1図(a)におけるマクロ展
開手段4の内容を説明するためのマクロ名記憶領域6の
詳細図、第1図(c)は第1図(a)におけるマクロ定
義1およびソースプログラム2の例を示す図、第2図(
a)は従来のマクロ展開処理の概要を示す図、第2図(
b)は第2図(a)で示す従来のマクロ展開手段7を示
す図である。 1・・・マクロ定義領域、2・・・展開前ソースプログ
ラムファイル、3・・・ソースプログラム入力手段、4
.7.9・・・マクロ展開手段、5・・・ソースプログ
ラム出力手段、6・・・マクロ名記憶領域詳細図、8・
・展開後ソースプログラムファイル。
FIG. 1(a) is an overall diagram of the recursive call detection method according to the present invention, and FIG. 1(b) is a diagram of the macro name storage area 6 for explaining the contents of the macro expansion means 4 in FIG. 1(a). The detailed diagram, FIG. 1(c), is a diagram showing an example of macro definition 1 and source program 2 in FIG. 1(a), and FIG.
a) is a diagram showing an overview of conventional macro expansion processing, and Figure 2 (
b) is a diagram showing the conventional macro expansion means 7 shown in FIG. 2(a). 1... Macro definition area, 2... Source program file before expansion, 3... Source program input means, 4
.. 7.9... Macro expansion means, 5... Source program output means, 6... Macro name storage area details diagram, 8.
- Source program file after expansion.

Claims (1)

【特許請求の範囲】[Claims] ソースプログラム中に現れる定数、名標、式等を、一つ
のマクロと呼ぶ論理的な集合とし、この集合をマクロ名
と呼ばれる名標で定義し、前記定数、名標、式等の代わ
りに前記マクロ名を記述することにより、定数、名標、
式等の参照を可能とするコンパイラのマクロ展開におけ
る回帰的呼び出し検出方式において、マクロ名の参照処
理時に前記マクロ名の回帰的呼び出しを予め定めたマク
ロ名の総定義回数により制限することを特徴とするマク
ロ展開における回帰的呼び出し検出方式。
The constants, names, expressions, etc. that appear in a source program are defined as a logical set called a macro, and this set is defined by a name called a macro name, and instead of the constants, names, expressions, etc. By writing macro names, constants, names,
In a recursive call detection method in macro expansion of a compiler that enables referencing of expressions, etc., the recursive call of the macro name is limited by a predetermined total number of definitions of the macro name during macro name reference processing. A recursive call detection method for macro expansion.
JP1014754A 1989-01-24 1989-01-24 Recursive access detecting system in microdevelopment Pending JPH02195438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1014754A JPH02195438A (en) 1989-01-24 1989-01-24 Recursive access detecting system in microdevelopment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1014754A JPH02195438A (en) 1989-01-24 1989-01-24 Recursive access detecting system in microdevelopment

Publications (1)

Publication Number Publication Date
JPH02195438A true JPH02195438A (en) 1990-08-02

Family

ID=11869886

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1014754A Pending JPH02195438A (en) 1989-01-24 1989-01-24 Recursive access detecting system in microdevelopment

Country Status (1)

Country Link
JP (1) JPH02195438A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011238297A (en) * 2011-08-30 2011-11-24 Hitachi Ltd Software creation method of automobile controller
JP2012160214A (en) * 2005-06-27 2012-08-23 Ab Initio Technology Llc Translation of expressions in computer environment
JP2018120447A (en) * 2017-01-26 2018-08-02 株式会社平和 Game machine

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012160214A (en) * 2005-06-27 2012-08-23 Ab Initio Technology Llc Translation of expressions in computer environment
JP2011238297A (en) * 2011-08-30 2011-11-24 Hitachi Ltd Software creation method of automobile controller
JP2018120447A (en) * 2017-01-26 2018-08-02 株式会社平和 Game machine

Similar Documents

Publication Publication Date Title
US8156471B2 (en) Multi-language execution method
KR950001531A (en) How to copy a string
JPH02195438A (en) Recursive access detecting system in microdevelopment
EP1164477A2 (en) A loop optimization method and a compiler
Baker Inlining semantics for subroutines which are recursive
JP2820184B2 (en) Load module unit test support device
JPS6229816B2 (en)
JP3085309B2 (en) Debug system
JPH07244601A (en) Method and device for accessing relational data base
KR960001081B1 (en) A simulation method for a real time database management
JP3021697B2 (en) Exception handling in programming languages
JPS64725B2 (en)
JPH08249193A (en) Checking system for language specification range of program
JPS63163635A (en) Stacking system for hash table in block unit
JPH02278340A (en) Compiling system
JPH0340042A (en) Multiple accessing device
JPH07129408A (en) Executing system for language processing program
JPH03260865A (en) Vectorization processing system
JPH03235135A (en) Automatic inspection system for program
JPH1063675A (en) Data retrieving method and data retrieving device applying the method
JPH09282177A (en) Program conversion method and compiler
JPH0228839A (en) Load module generating system for routine single test processing system
JPH02157940A (en) Expert system construction supporting device
Norman et al. IOGen: toward an automated tool for production of reliable and valid test suites
JPS63141133A (en) Procedure call method by value delivery of parameter