JP2720643B2 - Program generator generator - Google Patents

Program generator generator

Info

Publication number
JP2720643B2
JP2720643B2 JP19940791A JP19940791A JP2720643B2 JP 2720643 B2 JP2720643 B2 JP 2720643B2 JP 19940791 A JP19940791 A JP 19940791A JP 19940791 A JP19940791 A JP 19940791A JP 2720643 B2 JP2720643 B2 JP 2720643B2
Authority
JP
Japan
Prior art keywords
program
character string
specification description
generator
program generator
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.)
Expired - Lifetime
Application number
JP19940791A
Other languages
Japanese (ja)
Other versions
JPH0546368A (en
Inventor
伸明 田中
典行 榎本
亮太 末廣
イ ペッチ イバン
芳彦 鈴木
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 JP19940791A priority Critical patent/JP2720643B2/en
Publication of JPH0546368A publication Critical patent/JPH0546368A/en
Application granted granted Critical
Publication of JP2720643B2 publication Critical patent/JP2720643B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Description

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

【0001】[0001]

【産業上の利用分野】本発明はプログラムジェネレータ
生成装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program generator generator.

【0002】[0002]

【従来の技術】近年、電子計算機のプログラムを作成す
る際に、プログラムジェネレータを利用することが、盛
んに行なわれている。プログラムジェネレータとは、あ
るプログラミング言語で書かれたプログラムを、他のプ
ログラミング言語で書かれたプログラムに変換するもの
である。
2. Description of the Related Art In recent years, a program generator has been actively used to create a program for an electronic computer. A program generator converts a program written in one programming language into a program written in another programming language.

【0003】プログラムジェネレータには、広い意味で
はコンパイラも含まれる。コンパイラとは、プログラミ
ング言語の内でも高級プログラミング言語と呼ばれる
C、フォートラン、パスカルなどで記述されたプログラ
ムを、計算機のハードウエアが直接実行できる形態であ
る機械語、あるいは機械語に簡単に変換できる形態であ
るアセンブラ言語に変換するものである。
[0003] The program generator also includes a compiler in a broad sense. A compiler is a high-level programming language, which is also called a high-level programming language. A program written in C, Fortran, Pascal, etc. is a machine language that can be directly executed by computer hardware, or a form that can be easily converted to a machine language. Into an assembler language.

【0004】従来、広く使われていたプログラムジェネ
レータの大部分はコンパイラであった。つまり、生成す
るプログラムは、アセンブラ言語などの、単純な言語が
主であった。しかし、多くの計算機に、C言語などの一
般的、かつ違う機種の間でもプログラムの互換性が高い
高級プログラミング言語のコンパイラが普及したため、
C言語などよりさらに高級なプログラミング言語や、特
殊なプログラミング言語から、普及しているプログラミ
ング言語、たとえばC言語などへの変換を行なうプログ
ラムジェネレータが使用されるようになった。特に、ミ
チェル・ビーらによる「マッチメーカー:アン インタ
フェース スペシフィケーション ラングェジ フォ
ディストリビューテッド プロセッシング」(Michael
B. Jones, Richard F. Rashid, Mary R. Thompson,"M
atchmaker: An Interface Specification Language for
Distributed Processing", Proceeding of the 12th A
CMSIGACT-SIGPLAN Symposium on Princeples of Progra
mming Language, ACM, January 1985. )に見られるよ
うに、計算機間のデータ通信を行なうためのプログラム
を作成する際には、広くプログラムジェネレータが用い
られるようになった。
In the past, most of the widely used program generators were compilers. That is, the generated program is mainly a simple language such as an assembler language. However, because many computers have become popular with high-level programming languages such as C language, which have high program compatibility between different models,
A program generator that converts a higher-level programming language such as the C language or a special programming language into a widely used programming language such as the C language has been used. In particular, Michel Bee et al., “Matchmaker: Un-Interface Specification
Distributed Processing "(Michael
B. Jones, Richard F. Rashid, Mary R. Thompson, "M
atchmaker: An Interface Specification Language for
Distributed Processing ", Proceeding of the 12th A
CMSIGACT-SIGPLAN Symposium on Princeples of Progra
mming Language, ACM, January 1985.) When creating a program for performing data communication between computers, a program generator has been widely used.

【0005】この場合、プログラムジェネレータは、デ
ータ通信の仕様を記述した仕様記述を読み込み、その記
述に従って、データ通信を行なうためのプログラムを生
成する。
[0005] In this case, the program generator reads a specification description in which data communication specifications are described, and generates a program for performing data communication in accordance with the description.

【0006】このようなプログラムジェネレータを作成
する際には、通常のプログラミング言語を使って作成し
てもよいが、作成を容易にするための支援装置を用いる
と、より簡単に作成することが可能となる。このような
支援装置を、プログラムジェネレータ生成装置と呼ぶこ
とにする。
When creating such a program generator, the program generator may be created using a normal programming language. However, if a support device for facilitating the creation is used, the program generator can be more easily created. Becomes Such a support device is referred to as a program generator generation device.

【0007】プログラムジェネレータ生成装置には各種
のものがあるが、ここでは、その中でも代表的なもので
あるyaccを使用した場合についてのべる。yacc
は、プログラムジェネレータの中の構文解析部を自動的
に生成することを主たる目的としており、構文解析の結
果を利用するための動作については、使用者がC言語で
記述する必要がある。なお、yacc、およびyacc
を用いたコンパイラの構成方法については、近藤嘉雪
著、”yaccによるCコンパイラプログラミング”、
ソフトバンク株式会社出版事業部、1990年 が詳し
い。
[0007] There are various types of program generator generation devices. Here, the case where a typical one is used, yacc, will be described. yacc
Is mainly for automatically generating a parsing unit in a program generator, and a user needs to describe an operation for utilizing a result of the parsing in the C language. Note that yacc and yacc
For the method of constructing a compiler using, see C. Yoshiyuki Kondo, "C Compiler Programming with Yacc,"
For details, see SoftBank Corp. Publishing Division, 1990.

【0008】以下、図21を参照しながら、yaccを
例にとって従来のプログラムジェネレータ生成装置の構
成について説明する。なお、一般的な字句解析、構文解
析、構文解析表の生成、および構文解析器の生成の構
成、および方法については、佐々政孝著、”プログラミ
ング言語処理系”、岩波書店、1989年が詳しいの
で、ここでは詳細は省略する。
Hereinafter, the configuration of a conventional program generator generation device will be described with reference to FIG. The general lexical analysis, parsing, generation of a parsing table, and the configuration and method of generating a parser are detailed in Masataka Sasa, "Programming Language Processing System", Iwanami Shoten, 1989. Here, details are omitted.

【0009】図21は、プログラムジェネレータ生成装
置としてyaccを使用した場合の、プログラムの生成
の手順を示したブロック図である。図21において、2
101は、生成されるプログラムジェネレータの仕様を
記述した仕様記述、2102は、プログラムジェネレー
タ生成装置、2102aは仕様記述2101を読み込
み、字句に分解する仕様記述字句解析手段、2102b
は仕様記述字句解析手段2102aが字句に分解した仕
様記述の構文解析を行なう仕様記述構文解析手段、21
02cは、仕様記述の構文解析の結果をもとに、入力プ
ログラム2106の構文解析に必要な構文解析表を生成
する構文解析表生成手段、2102dは、仕様記述の構
文解析、および生成された構文解析表をもとに構文解析
部を生成する構文解析部生成手段、2103は、プログ
ラムジェネレータ生成装置2102によって生成された
構文解析部、2104は、使用者がC言語によって記述
したユーザプログラム、2105は、構文解析部210
3、ユーザプログラム2104をコンパイルし、リンク
するためのコンパイラ、2106はプログラムジェネレ
ータへの入力プログラム、2107は、入力プログラム
2106を変換するためのプログラムジェネレータ、2
108はプログラムジェネレータ2107によって生成
された出力プログラムである。
FIG. 21 is a block diagram showing a procedure for generating a program when using yacc as a program generator generating apparatus. In FIG. 21, 2
101 is a specification description describing the specification of the program generator to be generated, 2102 is a program generator generation device, 2102a reads the specification description 2101 and decomposes it into a lexical specification description lexical analysis unit 2102b
Is a specification description parsing means for parsing the specification description decomposed into lexical characters by the specification description lexical analysis means 2102a;
02c is a syntax analysis table generating means for generating a syntax analysis table required for the syntax analysis of the input program 2106 based on the result of the syntax analysis of the specification description, and 2102d is a syntax analysis table of the specification description and a generated syntax. A syntactic analysis unit generating means 2103 for generating a syntactic analysis unit based on the analysis table is a syntactic analysis unit generated by the program generator generation device 2102, a user program 2104 written by the user in C language, and a , Parsing section 210
3. A compiler for compiling and linking the user program 2104; 2106, an input program to the program generator; 2107, a program generator for converting the input program 2106;
Reference numeral 108 denotes an output program generated by the program generator 2107.

【0010】以上のような構成において、まず、仕様記
述字句解析手段2102aは仕様記述2101を読み込
んで、その内容を字句に分解する。次に仕様記述構文解
析手段2102bは字句に分解された仕様記述の構文解
析を行なう。次に、構文解析表生成手段2102cは、
仕様記述の構文解析の結果に基づいて、入力プログラム
2106の構文解析をするときに必要な構文解析表を生
成する。次に構文解析部生成手段2102dは、生成さ
れた構文解析表、および構文解析の結果をもとに、プロ
グラムジェネレータの一部である構文解析部を生成す
る。次に使用者があらかじめ作っておいた、ユーザプロ
グラム2104、つまり、プログラムジェネレータ21
07のうちの構文解析器2103以外の部分と、生成さ
れた構文解析部2103をコンパイルし、リンクし、計
算機で実行可能な形式として、プログラムジェネレータ
2107を生成する。生成されたプログラムジェネレー
タ2107を用いると、入力プログラム2106を、出
力プログラム2108に変換することができる。
In the above configuration, first, the specification description lexical analysis means 2102a reads the specification description 2101 and decomposes the contents into lexical expressions. Next, the specification description parsing means 2102b performs a syntax analysis of the specification description decomposed into lexical characters. Next, the syntax analysis table generation means 2102c
Based on the result of the syntax analysis of the specification description, a syntax analysis table necessary for analyzing the syntax of the input program 2106 is generated. Next, the syntax analysis unit generation means 2102d generates a syntax analysis unit which is a part of the program generator, based on the generated syntax analysis table and the result of the syntax analysis. Next, the user program 2104, that is, the program generator 21 previously created by the user.
07, a part other than the parser 2103 and the generated parser 2103 are compiled and linked, and a program generator 2107 is generated as a format executable by a computer. By using the generated program generator 2107, the input program 2106 can be converted into an output program 2108.

【0011】[0011]

【発明が解決しようとする課題】しかしながら上記の従
来の構成では、共通の課題として、プログラムジェネレ
ータ生成装置2102は、構文解析器の生成を行なって
いるのみであり、文字列の管理をするプログラムは、ユ
ーザがプログラミングしなくてはならず、プログラムジ
ェネレータの作成を効率的に行なうことができないとい
う課題を有していた。また、第1の課題として、プログ
ラムジェネレータ生成装置2102は構文解析器の生成
を行なっているのみである。C言語のような高級言語に
よって書かれたプログラムを生成するプログラムジェネ
レータを作成する場合には、生成するプログラムの一部
を文字列として扱うことが多いが、このような文字列を
扱うためのプログラムは生成されないため、プログラム
ジェネレータの開発者が作成してユーザプログラム21
04の中に入れるか、あるいは仕様記述2101の中に
入れる必要があるため、開発のための作業が増えるとい
う課題を有していた。
However, in the above conventional configuration, a common problem is that the program generator
The data generation device 2102 generates a parser,
Program that manages character strings
The user must program and the program
Generators cannot be created efficiently
Had problems. Further, as a first problem, the program generator generation device 2102 only generates a parser. When creating a program generator that generates a program written in a high-level language such as the C language, a part of the generated program is often handled as a character string, but a program for handling such a character string is often used. Is not generated, the program generator developer creates the user program 21
04 or the specification description 2101, there is a problem that the amount of work for development increases.

【0012】また、第2の課題として、前述のデータ通
信用プログラム生成装置のように、プログラム変換装置
の入力が、簡単な仕様記述で、その仕様記述に沿って大
量のプログラムを生成するような場合においては、プロ
グラム生成の仕様記述の中に大量の、文字列が入ってし
まう。このような場合に、たとえばyaccの仕様記述ファ
イルの中に直接、その文字列を書き込むと、仕様記述が
読みにくくなり、仕様の全体を理解することが困難にな
ってくるという課題を有していた。
A second problem is that, as in the above-described data communication program generation device, the input of the program conversion device is a simple specification description that generates a large amount of programs in accordance with the specification description. In some cases, a large amount of character strings are included in the specification description generated by the program. In such a case, for example, if the character string is written directly in the yacc specification description file, the specification description becomes difficult to read, and it becomes difficult to understand the entire specification. Was.

【0013】また、第3の課題として、仕様記述中にあ
る文字列を変更しようとした場合にも、その仕様記述全
体をyaccに読ませて、構文解析部を生成させて、プログ
ラムジェネレータ全体を生成しなおさなければならな
い。よって、少しの変更のために、最初に開発する場合
と同一の作業が発生し、長い時間を要してしまうという
課題を有していた。
Further, as a third problem, even when an attempt is made to change a character string in a specification description, the entire specification description is read by yacc, a syntax analysis unit is generated, and the entire program generator is generated. Must be recreated. Therefore, there is a problem that the same work as in the case of the first development occurs due to a small change, and it takes a long time.

【0014】また、第4の課題として、上記の構成で高
級言語のプログラムを生成するプログラムジェネレータ
を生成した場合、仕様記述2101のなかの長い文字
列、あるいはその中に挿入するように指示された長い文
字列の中の一部を、入力プログラム2106の中のある
文字列で置き換えた文字列を生成することが多くある。
ここで、この長い文字列を、テンプレート、テンプレー
トの途中に挿入される文字列を挿入文字列と呼ぶことに
する。しかし従来の構成例では文字列置換のための手続
きを生成する機能を有していないため、テンプレートを
置換する場所で前半と後半に分け、まずテンプレートの
前半を出力し、その後挿入文字列を出力し、最後にテン
プレートの後半を出力するなどというプログラムを、ユ
ーザが作成しなければなかった。このような方法を用い
ると、開発のための作業が多く必要となり、また、あと
からその部分のプログラムを見たときに、動作が理解し
にくくなるという課題を有していた。
As a fourth problem, when a program generator for generating a high-level language program with the above configuration is generated, it is instructed to insert a long character string in the specification description 2101 or into the long character string. In many cases, a character string in which a part of a long character string is replaced with a certain character string in the input program 2106 is generated.
Here, this long character string is called a template, and a character string inserted in the middle of the template is called an insertion character string. However, since the conventional configuration example does not have a function for generating a procedure for character string replacement, the first half and the second half are divided at the place where the template is replaced, and the first half of the template is output, and then the inserted character string is output. Finally, the user must create a program that outputs the latter half of the template. When such a method is used, a lot of work for development is required, and there is a problem that the operation becomes difficult to understand when the program of the part is viewed later.

【0015】本発明は、上記従来技術の第1から第4の
課題を解決するもので、第1の課題に対して、文字列操
作を行なうプログラムの作成を省き、プログラムジェネ
レータの開発の効率を向上させることができるプログラ
ムジェネレータ生成装置を提供することを目的とする。
The present invention solves the above-mentioned first to fourth problems of the prior art. In order to solve the first problem, it is possible to omit the creation of a program for performing a character string operation, and to improve the efficiency of the development of a program generator. It is an object of the present invention to provide a program generator generation device that can be improved.

【0016】また、第2の課題に対して、従来より読み
やすい形式の仕様記述からプログラムジェネレータを生
成することによって間違いを少なくするプログラムジェ
ネレータ生成装置を提供することを目的とする。
Another object of the present invention is to provide a program generator generating apparatus that reduces errors by generating a program generator from a specification description in a format that is easier to read than in the past.

【0017】また、第3の課題に対して、仕様の変更が
発生した場合に、再コンパイル等の作業を行なうことな
く、少ない作業で短時間にその変更に対応することが可
能なプログラムジェネレータを生成するプログラムジェ
ネレータ生成装置を提供することを目的とする。
In addition, a third object of the present invention is to provide a program generator capable of coping with the change in a short time with a small amount of work without performing a work such as recompilation when the specification is changed. It is an object of the present invention to provide a program generator generation device that generates a program.

【0018】また、第4の課題に対して、文字列の挿入
機能を簡単に実現できるプログラムジェネレータ生成装
置を提供することを目的とする。
Another object of the present invention is to provide a program generator generating apparatus which can easily realize a function of inserting a character string.

【0019】[0019]

【課題を解決するための手段】この目的を達成するため
に本発明のプログラムジェネレータ生成装置は第一に、
生成すべきプログラムジェネレータの仕様記述を読み込
み字句に分解する仕様記述字句解析手段と、分解して得
られた字句の中の文字列を分離して抜き出す文字列抜き
出し手段と、抜き出した文字列の保管場所を、当該保管
場所にユニークな識別子を付与してプログラムジェネレ
ータ中で管理する文字列管理部を生成する文字列管理部
生成手段と、前記文字列抜き出し手段により加工された
仕様記述の構文解析を行う仕様記述構文解析手段と、前
記構文解析手段の出力に基づき構文解析表を生成する構
文解析表生成手段を有する構成となっている。
In order to achieve this object, a program generator generating apparatus according to the present invention firstly comprises:
Specification description lexical analysis means for reading the specification description of the program generator to be generated into lexical characters, character string extracting means for separating and extracting character strings in the lexical characters obtained by decomposition, and storage of extracted character strings Location
Assign a unique identifier to a location
A character string management unit generating means for generating a character string management unit for managing in over data, and specification description parsing means parses the specification description that has been processed by the character string extraction unit, the output of said syntax analysis means It has a syntax analysis table generating means for generating a syntax analysis table based on.

【0020】第2に、生成すべきプログラムジェネレー
タの仕様記述を読み込み字句に分解する仕様記述字句解
析手段と、分解して得られた字句の中からファイル挿入
命令を検出するファイル挿入命令検出手段と、ファイル
挿入命令に従って指定されたファイルの内容を、プログ
ラムジェネレータ中の文字列管理部の管理する文字列の
集合の中に挿入するファイル挿入手段と前記ファイル挿
入手段により加工された仕様記述の構文解析を行う仕様
記述構文解析手段と、前記構文解析手段の出力に基づき
構文解析表を生成する構文解析表生成手段を有する構成
となっている。
Second, specification description lexical analysis means for reading the specification description of the program generator to be generated into lexical data, and file insertion instruction detecting means for detecting a file insertion instruction from the lexical data obtained by the decomposition. The contents of the file specified according to the file insertion instruction.
Of the string managed by the string management unit in the ram generator
File insertion means to be inserted into the set, specification description parsing means for parsing the specification description processed by the file insertion means, and syntax analysis table generation for generating a syntax analysis table based on the output of the syntax analysis means Means.

【0021】第3に、生成すべきプログラムジェネレー
タの仕様記述を読み込み字句に分解する仕様記述字句解
析手段と、分解して得られた字句の中からプログラムジ
ェネレータによって、入力プログラムを出力プログラム
に変換する時である実行時に実行される、実行時ファイ
ル挿入命令を検出する実行時ファイル挿入命令検出手段
と、仕様記述をプログラムジェネレータに変換する時で
あるプログラム変換時にファイル挿入命令に従って指定
されたファイルの内容を出力プログラム中に挿入する手
続きを、生成されるプログラムジェネレータのプログラ
ム中に挿入するファイル挿入手続き挿入手段と、前記フ
ァイル挿入手続き挿入手段により加工された仕様記述の
構文解析を行う仕様記述構文解析手段と、前記構文解析
手段の出力に基づき構文解析表を生成する構文解析表生
成手段を有する構成となっている。
[0021] Thirdly, decomposing Specification lexical analysis means lexical reads Specification of a program generator to be generated, the program di from the lexical obtained by decomposing
The input program is converted to the output program by the generator
A runtime file insertion instruction detecting means for detecting a runtime file insertion instruction , which is executed at the time of execution when converting to a
A method for inserting the contents of a file specified according to a file insertion instruction into an output program during conversion of a program
Continue with the generated program generator program
File insertion procedure insertion means to be inserted into the program, specification description syntax analysis means for performing syntax analysis of the specification description processed by the file insertion procedure insertion means, and a syntax analysis table based on the output of the syntax analysis means. It is configured to have a syntax analysis table generating means.

【0022】第4に、生成すべきプログラムジェネレー
タの仕様記述を読み込み字句に分解する仕様記述字句解
析手段と、分解して得られた字句の中から文字列置換命
令を検出する文字列置換命令検出手段と、仕様記述をプ
ログラムジェネレータに変換する時であるプログラム変
換時に文字列置換命令に従って文字列置換を行なう手続
きを生成されるプログラムジェネレータのプログラム中
挿入する文字列置換手続き挿入手段と前記文字列置換
手続き挿入手段により加工された仕様記述の構文解析を
行う仕様記述構文解析手段と、前記構文解析手段の出力
に基づき構文解析表を生成する構文解析表生成手段とを
有する構成になっている。
Fourth, specification description lexical analysis means for reading the specification description of the program generator to be generated into lexical characters, and character string replacement instruction detection for detecting a character string replacement instruction from the lexical characters obtained by the decomposition. Means and specifications
Program change when converting to a program generator
In the program of the program generator that generates a procedure for performing character string replacement according to the character string replacement instruction at the time of conversion
Character string replacement procedure insertion means for inserting into a character string and said character string replacement
The system comprises a specification description parsing means for parsing the specification description processed by the procedure inserting means, and a parsing table generating means for generating a parsing table based on the output of the parsing means.

【0023】[0023]

【作用】上記構成において本発明は、第1に文字列抜き
出し手段が字句に分解した仕様記述の中から文字列を分
離して抜き出し、文字列管理部生成手段が抜き出した文
字列をプログラムジェネレータ中で管理する文字列管理
部を生成することにより、文字列管理を行なうプログラ
ムの作成を省き、プログラムジェネレータの開発の効率
を向上させることができる。
According to the present invention, first, the character string extracting means separates and extracts a character string from the specification description decomposed into lexical characters, and the character string extracted by the character string management section generating means is stored in a program generator. By generating a character string management unit managed by the above, it is possible to omit creation of a program for performing character string management, and to improve the efficiency of development of a program generator.

【0024】第2に、ファイル挿入命令検出手段が分解
して得られた字句の中からファイル挿入命令を検出し、
ファイル挿入手段が検出されたファイル挿入命令によっ
て指定されたファイルの内容を読みだし字句の並びの中
に挿入することで、仕様記述とは別に置かれたファイル
の内容をプログラムジェネレータに挿入することが可能
となり、簡潔で、読みやすい仕様記述からプログラムジ
ェネレータの生成を行なうことができる。
Second, the file insertion instruction detecting means detects the file insertion instruction from the lexical characters obtained by the decomposition,
By inserting the contents of the file specified by the detected file insertion instruction into the list of lexical characters, the file insertion means can insert the contents of the file placed separately from the specification description into the program generator. This makes it possible to generate a program generator from a concise and easy-to-read specification description.

【0025】第3に、実効時ファイル命令検出手段が分
解して得られた字句の中から実行時ファイル挿入命令を
検出し、ファイル挿入手続き挿入手段がプログラム変換
時にファイル挿入命令に従って指定されたファイルの内
容を出力プログラム中に挿入する手続きをプログラムジ
ェネレータ中に挿入することにより、プログラムジェネ
レータがプログラムの変換を行なう時に、出力プログラ
ムの中に指定されたファイルの内容を挿入することで、
簡潔で、読みやすい仕様記述からプログラムジェネレー
タの生成を行なうことができる。
Thirdly, the effective file command detecting means detects the runtime file inserting command from the lexical characters obtained by the decomposition, and the file inserting procedure inserting means detects the file specified according to the file inserting command at the time of program conversion. By inserting a procedure for inserting the contents of the specified file into the output program into the program generator, when the program generator converts the program, by inserting the contents of the specified file into the output program,
A program generator can be generated from a simple and readable specification description.

【0026】第4に、文字列置換命令検出手段が分解し
て得られた字句の中から文字列置換命令を検出し、文字
列置換手続き挿入手段が、プログラム変換時に文字列置
換命令に従って文字列置換を行なう手続きをプログラム
ジェネレータ中に挿入し、動作時に文字列の置換を行な
うプログラムジェネレータを生成することによって、簡
潔で、読みやすい仕様記述からプログラムジェネレータ
の生成を行なうことができる。
Fourth, the character string replacement instruction detecting means detects the character string replacement instruction from the lexical characters obtained by the decomposition, and the character string replacement procedure inserting means inserts the character string according to the character string replacement instruction at the time of program conversion. By inserting a replacement procedure into the program generator and generating a program generator that replaces a character string during operation, the program generator can be generated from a simple and readable specification description.

【0027】[0027]

【実施例】【Example】

(実施例1)以下、本発明の第1の実施例について、図
面を参照しながら説明する。
Embodiment 1 Hereinafter, a first embodiment of the present invention will be described with reference to the drawings.

【0028】図1は本発明の第1の実施例におけるプロ
グラムの生成の手順を及びプログラムジェネレータ生成
装置の構成を示したブロック図である。図1において、
101は、生成されるプログラムジェネレータの仕様を
記述した仕様記述、102は、プログラムジェネレータ
生成装置、102aは仕様記述101を読み込み、字句
に分解する仕様記述字句解析手段、102bは仕様記述
字句解析手段102aが字句に分解した仕様記述の中か
ら文字列の部分を検出して抜き出し、その文字列に識別
子を付与し、仕様記述の字句の並びの中には文字列その
もののかわりに、付与された識別子を挿入する文字列抜
き出し手段、102cは文字列抜き出し手段102bが
抜き出した文字列を、プログラムジェネレータ108中
で管理するための文字列管理部104を生成する文字列
管理部生成手段、102dは仕様記述字句解析手段10
2aが字句に分解し、さらに文字列抜き出し手段102
bによって文字列を示す識別子を挿入された仕様記述の
構文解析を行なう仕様記述構文解析手段、102eは、
仕様記述の構文解析の結果をもとに、入力プログラム1
07の構文解析に必要な構文解析表を生成する構文解析
表生成手段、102fは、仕様記述の構文解析、および
生成された構文解析表をもとに構文解析部を生成する構
文解析部生成手段、103は、プログラムジェネレータ
生成装置102によって生成された構文解析部、104
は、文字列管理部生成手段102cによって生成された
文字列管理部、105は、使用者がC言語によって記述
したユーザプログラム、106は、構文解析部103、
プログラム生成部104、ユーザプログラム105をコ
ンパイルし、リンクするためのコンパイラ、107はプ
ログラムジェネレータへの入力プログラム、108は、
入力プログラム107を変換するためのプログラムジェ
ネレータ、109はプログラムジェネレータ107によ
って生成された出力プログラムである。
FIG. 1 is a block diagram showing a procedure for generating a program and a configuration of a program generator generating apparatus according to the first embodiment of the present invention. In FIG.
101 is a specification description that describes the specifications of the program generator to be generated, 102 is a program generator generation device, 102a is a specification description lexical analysis unit that reads the specification description 101 and decomposes it into lexical characters, and 102b is a specification description lexical analysis unit 102a. Detects and extracts a character string portion from the specification description that has been decomposed into lexical characters, assigns an identifier to the character string, and replaces the character string itself in the sequence of lexical characters in the specification description with the assigned identifier. , A character string management unit generating means for generating a character string management unit 104 for managing the character string extracted by the character string extraction means 102b in the program generator 108, and 102d a specification description Lexical analysis means 10
2a is decomposed into lexical characters, and the character string extracting means 102
b. a specification description parsing means for parsing a specification description in which an identifier indicating a character string is inserted by b;
Input program 1 based on the result of parsing the specification description
A syntactic analysis table generating means for generating a syntactic analysis table necessary for parsing 07; a syntactic analysis section generating means for synthesizing a specification description and generating a syntactic analysis section based on the generated syntactic analysis table , 103 are syntax analyzers generated by the program generator generator 102, 104
Is a character string management unit generated by the character string management unit generation unit 102c; 105 is a user program written by the user in C language; 106 is a syntax analysis unit 103;
The program generation unit 104, a compiler for compiling and linking the user program 105, 107 is an input program to the program generator, and 108 is
A program generator 109 for converting the input program 107 is an output program generated by the program generator 107.

【0029】以上のように構成されたプログラムジェネ
レータ生成装置について、図2に示すフローチャートを
用いてその動作を説明する。
The operation of the above-configured program generator generator will be described with reference to the flowchart shown in FIG.

【0030】まず、仕様記述字句解析手段102aは仕
様記述101を読み込み、その内容を字句に分解する
(図2ステップ(イ))。次に、文字列抜き出し手段1
02bは仕様記述字句解析手段102aが字句に分解し
た仕様記述の中から文字列の部分を検出し1つ1つの文
字列にユニークな識別子を付与し、仕様記述の字句の並
びの中には文字列そのもののかわりに、付与された識別
子を挿入する(図2ステップ(ロ))。次に文字列管理
部生成手段102cは文字列抜き出し手段102bが抜
き出した文字列を、プログラムジェネレータ108中で
管理するための文字列管理部104を生成する(図2ス
テップ(ハ))。次に仕様記述構文解析手段102dは
仕様記述字句解析手段102aが字句に分解し、さらに
文字列抜き出し手段102bによって文字列を示す識別
子を挿入された仕様記述の構文解析を行なう(図2ステ
ップ(ニ))。次に構文解析表生成手段102eは、仕
様記述の構文解析の結果をもとに、入力プログラム10
7の構文解析に必要な構文解析表を生成する(図2ステ
ップ(ホ))。次に構文解析部生成手段102fは、仕
様記述の構文解析、および生成された構文解析表をもと
に構文解析部を生成する(図2ステップ(ヘ))。
First, the specification description lexical analysis means 102a reads the specification description 101 and decomposes its contents into lexical characters (step (a) in FIG. 2). Next, character string extracting means 1
Reference numeral 02b denotes a character string portion detected from the specification description decomposed into lexical characters by the specification description lexical analysis means 102a, and a unique identifier is assigned to each character string. The assigned identifier is inserted instead of the column itself (step (b) in FIG. 2). Next, the character string management unit generation unit 102c generates a character string management unit 104 for managing the character string extracted by the character string extraction unit 102b in the program generator 108 (step (c) in FIG. 2). Next, the specification description parsing means 102d performs a syntax analysis of the specification description in which the specification description lexical analysis means 102a decomposes into lexical characters and the character string extracting means 102b inserts an identifier indicating a character string (step (d in FIG. 2). )). Next, the syntactic analysis table generating means 102e, based on the result of the parsing of the specification description,
A syntax analysis table required for the syntax analysis of step 7 is generated (step (e) in FIG. 2). Next, the parsing unit generating means 102f generates a parsing unit based on the parsing of the specification description and the generated parsing table (step (f) in FIG. 2).

【0031】使用者は、あらかじめ作成しておいたユー
ザプログラム105と、上記の動作によって生成された
構文解析部103、および文字列管理部104をコンパ
イラ106によってコンパイル、リンクし、目的とする
プログラムジェネレータ108を生成する。
The user compiles and links the user program 105 created in advance, the syntactic analysis unit 103 and the character string management unit 104 generated by the above operation by the compiler 106, 108 is generated.

【0032】次に、生成されたプログラムジェネレータ
108について図面を参照しながら説明する。
Next, the generated program generator 108 will be described with reference to the drawings.

【0033】図3はプログラムジェネレータ108の構
成を示したブロック図である。図3において、301
は、入力プログラム107を読み込み、字句に分解する
字句解析部、103は、字句解析部301によって字句
に分解された入力プログラム107を構文解析する構文
解析部、302は、構文解析部103による、入力プロ
グラム107の解析結果をもとに出力プログラム109
を生成するコード生成部、303はプログラムジェネレ
ータ108中で用いられる基本的なデータ構造の管理を
行なうデータ管理部、104は、データ管理部303の
中の、文字列に関する管理を行なう文字列管理部、30
4は、データ管理部303によって管理されるデータに
対する操作や、出力操作などのように、汎用性の高い操
作を行なう手続きを提供するライブラリ関数群である。
FIG. 3 is a block diagram showing the configuration of the program generator 108. In FIG.
Is a lexical analyzer that reads the input program 107 and decomposes it into lexical characters; 103 is a parse analyzer that parses the input program 107 parsed into lexical characters by the lexical analyzer 301; Output program 109 based on the analysis result of program 107
, A data management unit 303 for managing basic data structures used in the program generator 108, and a character string management unit 104 for managing a character string in the data management unit 303. , 30
Reference numeral 4 denotes a library function group that provides procedures for performing highly versatile operations such as operations on data managed by the data management unit 303 and output operations.

【0034】以上のように構成されたプログラムジェネ
レータ108について、図4に示すフローチャートを用
いてその動作を説明する。
The operation of the program generator 108 configured as described above will be described with reference to the flowchart shown in FIG.

【0035】まず、字句解析部301は入力プログラム
107を読み込み、その内容を字句に分解する(図4ス
テップ(イ))。次に構文解析部103は字句解析部3
01が字句に分解した入力プログラム107の構文解析
を行なう(図4ステップ(ロ))。次にコード生成部3
02は構文解析の結果をもとに出力プログラムの合成を
行なう(図4ステップ(ハ))。文字列の合成を行なう
際には、文字列そのものを合成するのではなく、その文
字列に付与された識別子を用いて行なう。次にコード生
成部302は、合成されたデータ構造をもとに、出力プ
ログラムを出力する(図4ステップ(ニ))。
First, the lexical analyzer 301 reads the input program 107 and decomposes its contents into lexical characters (step (a) in FIG. 4). Next, the parsing unit 103 sets the lexical analysis unit 3
A syntax analysis is performed on the input program 107 in which 01 has been decomposed into words (step (b) in FIG. 4). Next, the code generator 3
02 synthesizes an output program based on the result of the syntax analysis (step (c) in FIG. 4). When synthesizing a character string, it does not synthesize the character string itself, but uses an identifier assigned to the character string. Next, the code generation unit 302 outputs an output program based on the synthesized data structure (step (d) in FIG. 4).

【0036】次に、プログラムジェネレータ108にお
いて文字列がどのように扱われるかを、図面を参照しな
がら説明する。
Next, how a character string is handled in the program generator 108 will be described with reference to the drawings.

【0037】図5は、データ管理部303によって扱わ
れるデータ構造のうち、文字列と、連結に関するものの
構造を示した構造図である。図5において、501は2
つのデータの連結を表現するコンスセル、502は、文
字列を格納する文字列オブジェクトである。なお、この
データ構造の構成は、記号処理用プログラミング言語で
あるLispの言語処理系が用いるデータ構造に近い。
Lisp言語処理系については、後藤滋樹著、”記号処
理プログラミング”、岩波書店、1988が詳しい。
FIG. 5 is a structural diagram showing a character string and a structure related to concatenation among data structures handled by the data management unit 303. In FIG. 5, 501 is 2
A cons cell 502 expressing the concatenation of two data is a character string object that stores a character string. The configuration of this data structure is close to the data structure used by the language processing system of Lisp, which is a programming language for symbol processing.
For details on the Lisp language processing system, see Shigeki Goto, "Symbol Processing Programming", Iwanami Shoten, 1988.

【0038】コンスセル501は、2つの領域を持って
おり、そこにポインタ、識別子などを格納できる。この
データ構造は、主に、文字列などを連結する操作を表現
したいときに用いる。文字列オブジェクト502は、文
字列を格納しておくためのものであり、その中に文字列
を格納している。また、タグと呼ばれる領域には、この
データ構造がどのような種類のデータ構造であるかをし
めす識別子が入っている。このタグはコンスセル501
にも付いているが、一般的にコンスセルを図的に表記す
る場合にはタグの領域を示さないので、図5では省略し
た。
The cons cell 501 has two areas in which pointers, identifiers and the like can be stored. This data structure is mainly used to express an operation of connecting character strings and the like. The character string object 502 stores a character string, and stores a character string therein. An area called a tag contains an identifier indicating what kind of data structure this data structure is. This tag is Cons cell 501
In general, when a cons cell is shown graphically, the region of the tag is not shown, so that it is omitted in FIG.

【0039】図6は、仕様記述101を示す図である。
601は、文法記号b、c、dに相当する記述が連続し
て入力プログラム107中に現われたときに、その3つ
の文法記号をまとめて、文法記号aと見なすことがで
き、その際には中かっこの中に示した動作を行なうとい
う仕様を示すルール、602は、文法記号aに相当する
記述が2つ連続して入力プログラム107中に現われた
ときに、その2つの文法記号をまとめて、文法記号eと
見なすことができ、その際には中かっこの中に示した動
作を行なうという仕様を示すルールである。この仕様記
述法は、yaccの仕様記述方法に基づいている。中かっこ
の前の文法を示す部分は生成規則、中かっこの中の動作
はアクションと呼ばれる。アクション中の$$は文法規則
中の:の左に位置する文法記号の属性値を示す記号であ
る。$1,$2,....は、それぞれ文法規則中の:の右に位置
する、1番目の文法記号、2番目の文法記号、...の
属性値を示す記号である。アクション中に示した関数li
stは、引数として与えられた値をコンスセル501を用
いて連結するための関数である。
FIG. 6 is a diagram showing the specification description 101.
When a description corresponding to grammar symbols b, c, and d appears successively in the input program 107, 601 can be regarded as a grammar symbol a by combining the three grammar symbols. A rule 602 indicating the specification of performing the operation shown in the curly braces is that when two descriptions corresponding to the grammar symbol a appear two consecutively in the input program 107, the two grammar symbols are put together. , A grammar symbol e, and a rule indicating that the operation shown in the curly braces is performed in that case. This specification description method is based on the specification description method of yacc. The part of the grammar before the curly braces is called a production, and the action inside the braces is called an action. $$ in the action is a symbol indicating the attribute value of the grammar symbol located to the left of: in the grammar rule. $ 1, $ 2, .... are the first grammar symbol, the second grammar symbol,. . . Is a symbol indicating the attribute value of. Function li shown during action
st is a function for concatenating values given as arguments using the cons cell 501.

【0040】図7は、図6に示した仕様記述をプログラ
ムジェネレータ生成装置102が読み込んだときに生成
される文字列管理部104を、C言語によって実現した
ときのプログラムを示す図である。図7において、make
_stringという関数は、文字列オブジェクト502を生
成し、与えられた文字列をその中に格納して、その文字
列オブジェクト502へのポインタを返す関数である。
配列string_storageは、そのポインタを格納して置くた
めの配列である。配列の添え字は、文字列抜き出し手段
102bによって文字列に付与された識別子と、1対1
に対応するようにしておく、たとえば、識別子iを与え
られた文字列の文字列オブジェクトは、配列の中の添え
字がiの要素に、入っているようにしておく。
FIG. 7 is a diagram showing a program when the character string management unit 104 generated when the program generator generating apparatus 102 reads the specification description shown in FIG. 6 is realized in C language. In FIG. 7, make
The function _string is a function that generates a character string object 502, stores a given character string therein, and returns a pointer to the character string object 502.
The array string_storage is an array for storing and placing the pointer. The subscript of the array is one-to-one with the identifier assigned to the character string by the character string extracting means 102b.
For example, the character string object of the character string given the identifier i is set so that the subscript in the array is included in the element of i.

【0041】図8は、図6のルール601に示した文法
記号の列b,c,dが入力プログラム107中に現れ、
ルール601のアクションが実行されたときに生成され
るデータ構造を示す構造図である。
FIG. 8 shows a sequence of grammatical symbols b, c, and d shown in rule 601 in FIG.
FIG. 4 is a structural diagram showing a data structure generated when an action of a rule 601 is executed.

【0042】図9は、図6のルール602に示した文法
記号の列a,aが入力プログラム107中に現れ、ルー
ル602のアクションが実行されたときに生成されるデ
ータ構造を示す構造図である。図8、図9においてポイ
ンタ0、1、2はそれぞれ文字列0、1、2を指し示し
ている。このようなデータ構造によって文字列の連結が
表現されている場合に連結された文字列を出力するため
にはコンスセルによって構成されるツリー構造の中を、
左から順番に探索して、文字列オブジェクトが見つかっ
た時点で、その文字列を出力すればよい。
FIG. 9 is a structural diagram showing a data structure generated when the grammar symbol a shown in the rule 602 in FIG. 6 appears in the input program 107 and the action of the rule 602 is executed. is there. 8 and 9, pointers 0, 1, and 2 indicate character strings 0, 1, and 2, respectively. In order to output a concatenated character string when character string concatenation is represented by such a data structure, a tree structure composed of cons cells must be used.
When a character string object is found by searching sequentially from the left, the character string may be output.

【0043】図9に示されるように、仕様記述101中
の文字列はプログラムジェネレータ108中で、連結さ
れるときに、ポインタとして扱われる。本発明のように
文字列管理部も生成し、プログラムジェネレータ108
の中に含むような構成を用いると、それぞれの文字列を
別の位置に格納し、その格納された文字列を示すポイン
タのみを連結することによって合成を行なうことができ
る。このことによって、文字列のコピーなどを行なうこ
となく、効率よく文字列の合成を行うことができる。こ
こでは、文字列オブジェクトを示すためにポインタを用
いる方法を説明したが、これは文字列オブジェクトの識
別子であってもかまわない。
As shown in FIG. 9, when a character string in the specification description 101 is linked in the program generator 108, it is treated as a pointer. A character string management unit is also generated as in the present invention, and the program generator 108
Is used, the character strings can be stored at different positions, and only the pointers indicating the stored character strings can be connected to perform composition. As a result, the character strings can be efficiently synthesized without copying the character strings. Here, a method of using a pointer to indicate a character string object has been described, but this may be an identifier of the character string object.

【0044】次に、従来例と比較して、本発明の優れて
いる点について説明する。文字列管理部を生成する機能
を持たない従来例で、このような仕様記述中に書かれた
文字列の合成の機能を実現する方法には、次の3つの方
法が考えられる。
Next, the advantages of the present invention as compared with the conventional example will be described. In a conventional example having no function of generating a character string management unit, the following three methods can be considered as a method of realizing a function of synthesizing a character string written in such a specification description.

【0045】第1の方法は、文字列の合成を行なうたび
に、合成されるすべての文字列を、1つのバッファに先
頭から順にコピーしていくというものである。この方法
には、合成を行なうたびに、バッファコピーが起こるの
で、実行速度が遅くなるという点と、合成して得られる
文字列の長さが大きくなると、合成のたびに大きなバッ
ファが必要となり、メモリを大量に消費するという点
の、2つの問題点がある。
In the first method, every time a character string is synthesized, all the character strings to be synthesized are sequentially copied to one buffer from the beginning. In this method, a buffer copy occurs every time synthesis is performed, so that the execution speed becomes slower.If the length of a character string obtained by synthesis increases, a large buffer is required for each synthesis. There are two problems of consuming a large amount of memory.

【0046】第2の方法はポインタの値によって、文字
列を認識する方法である。本実施例では、すべてのデー
タは、idを格納する領域を持ち、あるポインタが指す
データが文字列であるか、コンスセルであるかの判断
を、そのidの値を調べることによって行なっている。
この方法を変更して、コンスセルの存在する領域を限定
しておいて、その中を指しているポインタであれば、コ
ンスセルとして認識し、その範囲外であれば、文字列と
認識する方法が考えられる。文字列の合成は、単に、そ
の文字列の先頭アドレスをポインタとして用いて、本実
施例と同様の操作を行なえばよい。この方法では、メモ
リ効率の点では、第1の方法の欠点は解消されている。
しかし、次のような問題点がある。仕様記述中のアクシ
ョン部はyaccで処理されたあとのC言語のプログラ
ムの中でも文字列として扱われる。その後、C言語のコ
ンパイラによってコンパイルされたときに、文字列が、
オブジェクトコード中のどこに存在するのかは、言語処
理系や、OS、計算機の機種などによってまちまちであ
る。また、その文字列の存在する位置を知ることは、一
般的に難しい。このような不確定な文字列の位置に関す
る情報に基づいて動作するプログラムは、移植性、保守
性の乏しいものになるため、一般的には好ましくない。
また、この例ではコンスセルと文字列の組合せしか示さ
なかったが、ジェネレータ内で扱うデータに、たとえ
ば、通常の言語処理系で使われるところの、シンボル
や、文字、数値といったデータが入ってくると、それぞ
れの文字毎にその存在する範囲を限定して、ポインタの
指すデータ構造をプリントアウトすときには、1つのポ
インタに対して(データの種類の数−1)回のアドレス
の比較が必要となり、実行速度が遅くなる。この点から
も、第2の方法は好ましくない。
The second method is a method of recognizing a character string based on the value of a pointer. In this embodiment, all data has an area for storing an id, and it is determined whether the data pointed to by a certain pointer is a character string or a cons cell by checking the value of the id.
By changing this method, the area where the cons cell is present is limited, and if the pointer points inside the cons cell, it is recognized as a cons cell, and if it is out of the range, it is recognized as a character string. Can be To combine the character strings, the same operation as in the present embodiment may be simply performed using the head address of the character string as a pointer. This method eliminates the disadvantages of the first method in terms of memory efficiency.
However, there are the following problems. The action part in the specification description is treated as a character string in the C language program after being processed by yacc. Then, when compiled by a C language compiler, the string
The location in the object code varies depending on the language processing system, the OS, the model of the computer, and the like. It is generally difficult to know the position where the character string exists. Such a program that operates based on information about the position of an uncertain character string is generally not preferable because it is poor in portability and maintainability.
In this example, only the combination of cons cells and character strings is shown, but if the data handled in the generator contains, for example, data such as symbols, characters, and numeric values used in normal language processing systems, When printing out the data structure pointed to by the pointer by limiting the existing range for each character, it is necessary to compare (address number of data types-1) addresses for one pointer, Execution speed becomes slow. From this point as well, the second method is not preferable.

【0047】第3の方法は、自動的に文字列を管理する
ことをあきらめて、文字列管理の部分は、ユーザが作成
するというものである。この方法では、プログラムジェ
ネレータ自体は本実施例とまったく同じにできるので、
実行速度やメモリ効率の点では、本実施例に劣ることは
ない。しかし、文字列自体がユーザの書くソースコード
の中に入り、仕様記述の中では、それらの文字列を、識
別子などで指示することになる。つまり、仕様記述の中
に文字列を直接書き込むことはできず、構文解析と構文
に従った動作に関する仕様と、そのときに用いられる文
字列が、離れた位置、たとえば別のファイルなどに置か
れることになる。このことによって、本実施例と比較す
ると、仕様記述の読みやすさが大きく損なわれる。ま
た、使用者が文字列管理部を作成する必要があるため、
開発効率も悪くなる。
The third method is to give up the automatic management of character strings, and to create the character string management part by the user. In this method, the program generator itself can be exactly the same as in this embodiment,
The execution speed and the memory efficiency are not inferior to this embodiment. However, the character string itself is included in the source code written by the user, and the character string is designated by an identifier or the like in the specification description. In other words, it is not possible to write a character string directly in the specification description, and the specification concerning parsing and operation according to the syntax and the character string used at that time are placed in a remote location, for example, in a separate file. Will be. As a result, the readability of the specification description is greatly impaired as compared with the present embodiment. Also, since the user needs to create a character string management unit,
Development efficiency is also reduced.

【0048】これに対して、本発明を使用した場合、構
文解析のルールと、文字列合成に用いられる文字列を近
い位置、つまり、ルールのアクションの部分に直接書き
込むことができ、かつ、プログラムジェネレータが文字
列の合成を行なう際にも、識別子、あるいはポインタを
連結することによって、文字列の合成を表現できる。本
発明は、この点において従来例に対して優っている。
On the other hand, when the present invention is used, a rule for syntactic analysis and a character string used for character string synthesis can be directly written at a close position, that is, at the action part of the rule, and When the generator synthesizes a character string, the character string can be expressed by connecting identifiers or pointers. The present invention is superior to the conventional example in this point.

【0049】また、文字列を扱うための文字列管理部を
自動的に生成し、さらに文字列の連結、出力などの標準
的な手続きを、使用者に対して標準ライブラリとして提
供することにより、利用者は構文解析のためのルール
と、文字列合成のルールを仕様記述のなかに表記するだ
けで、プログラムジェネレータを生成することが可能と
なる。つまり、ユーザプログラム105の内、新規に開
発する部分がなくなり、その開発のための時間を省くこ
とができる。これにより、プログラムジェネレータの開
発効率、保守性を向上させることができる。
Also, by automatically generating a character string management unit for handling character strings and providing standard procedures such as character string concatenation and output to the user as a standard library, A user can generate a program generator simply by writing rules for parsing and rules for synthesizing strings in a specification description. In other words, there is no newly developed part in the user program 105, and time for the development can be saved. As a result, the development efficiency and maintainability of the program generator can be improved.

【0050】また、図6においてはyaccの標準的な記法
に基づいて、各文法記号の属性値を1つのみとして説明
したが、yaccでは、各文法記号について、その属性値の
データ型を指定することもできる。このデータ型を複数
の要素を持った構造体とすることによって、複数の属性
値を、仕様記述中で用いることも可能である。また、各
文法記号の属性値のデータ型の指定をユーザに行なわせ
ず、生成規則中で指定した属性値を扱えるようにする機
能を持たせることも可能である。
In FIG. 6, each grammatical symbol has only one attribute value based on the standard notation of yacc. However, in yacc, the data type of the attribute value is specified for each grammatical symbol. You can also. By making this data type a structure having a plurality of elements, a plurality of attribute values can be used in the specification description. It is also possible to provide a function that does not require the user to specify the data type of the attribute value of each grammatical symbol, but can handle the attribute value specified in the generation rule.

【0051】以上のように本実施例によれば、プログラ
ムジェネレータ生成装置中に文字列抜き出し手段、およ
び文字列管理部生成手段を設けることにより、文字列管
理を行なうプログラムの作成を省き、かつ生成されたプ
ログラムジェネレータにおいての効率の良い文字列合成
を行なうことができ、プログラムジェネレータの開発の
効率を向上させることができる。
As described above, according to the present embodiment, by providing the character string extracting means and the character string management section generating means in the program generator generating apparatus, the creation of the program for managing the character string is omitted and the generation is performed. In this way, it is possible to perform efficient character string synthesis in the generated program generator, thereby improving the development efficiency of the program generator.

【0052】(実施例2)以下、本発明の第2の実施例
について、図面を参照しながら説明する。
(Embodiment 2) Hereinafter, a second embodiment of the present invention will be described with reference to the drawings.

【0053】図10は本発明の第2の実施例におけるプ
ログラムジェネレータ生成過程とプログラムジェネレー
タ生成装置の構成を示したブロック図である。
FIG. 10 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to the second embodiment of the present invention.

【0054】図10の構成と図1の構成で異なる要素に
ついて説明する。図10において、1002bは、仕様
記述字句解析手段1002aが生成した字句の並びの中
からファイル挿入命令を検出するファイル挿入命令検出
手段、1002cは、仕様記述の字句の並びの中にファ
イル挿入命令に従って被挿入ファイル1009を挿入す
るファイル挿入手段、1009は、ファイル挿入手段1
002cによって仕様記述の字句の並びの中に挿入され
る被挿入ファイルである。その他は図1と同じである。
Elements that differ between the configuration in FIG. 10 and the configuration in FIG. 1 will be described. In FIG. 10, reference numeral 1002b denotes a file insertion instruction detecting unit that detects a file insertion instruction from the sequence of lexical characters generated by the specification description lexical analysis unit 1002a. File insertion means for inserting the inserted file 1009, 1009 is a file insertion means 1
002c is an inserted file to be inserted into the lexical sequence of the specification description. Others are the same as FIG.

【0055】上記のように構成されたプログラムジェネ
レータ生成装置について、図11に示すフローチャート
を用いて、その動作を説明する。図11において、ステ
ップ(イ)、ステップ(ニ)、ステップ(ホ)、ステッ
プ(ヘ)は、図2の動作と同様なものである。図2の動
作と異なるのは、ステップ(イ)によって生成された字
句の並びから、ファイル挿入命令を検出し(ステップ
(ロ))、検出されたファイル挿入命令によって指定さ
れたファイルの内容を読みだして、ステップ(イ)で生
成された字句の並びの中に挿入する(ステップ(ハ))
というステップを追加した点である。
The operation of the above-configured program generator generator will be described with reference to the flowchart shown in FIG. In FIG. 11, steps (a), (d), (e), and (f) are the same as the operations in FIG. 2 is different from the operation of FIG. 2 in that a file insertion instruction is detected from the lexical sequence generated in step (a) (step (b)), and the contents of the file specified by the detected file insertion instruction are read. Then, insert it into the lexical sequence generated in step (a) (step (c))
That is, the step was added.

【0056】この処理フローに基づき、図12、図1
3、および図14を参照しながら実際の使用例について
説明する。
Based on this processing flow, FIGS.
An actual use example will be described with reference to FIGS.

【0057】図12は仕様記述1001の一部を示した
図である。図12において、1201は、プログラム変
換の規則の内の1つを示したルールである。
FIG. 12 is a diagram showing a part of the specification description 1001. In FIG. 12, reference numeral 1201 denotes a rule indicating one of program conversion rules.

【0058】図13は、被挿入ファイルを示した図であ
り、図13ーaに示した内容はfile1という名前のファ
イルに、図13ーbに示した内容はfile2という名前の
ファイルに格納されているものとする。
FIG. 13 is a diagram showing an inserted file. The contents shown in FIG. 13A are stored in a file named file1, and the contents shown in FIG. 13B are stored in a file named file2. It is assumed that

【0059】図14は、本発明を用いた場合に、図12
に示した仕様記述と等価な結果を生じる仕様記述を示し
た図である。
FIG. 14 shows a case where the present invention is used.
FIG. 9 is a diagram showing a specification description that produces a result equivalent to the specification description shown in FIG.

【0060】図12において、includeという文字列は
予約語であり、そのあとに続くかっこでくくられた中の
文字列と同じ名前を持ったファイルをその位置に挿入せ
よということを、プログラムジェネレータ生成装置10
02に命令する挿入命令である。
In FIG. 12, the character string "include" is a reserved word, and the program generator generates a command to insert a file having the same name as the character string in parentheses following it at that position. Apparatus 10
02 is an insertion instruction to instruct No. 02.

【0061】プログラムジェネレータ生成装置1002
は、この命令を、ファイル挿入命令検出手段1002b
によって検出し、その位置に、指定されたファイルの内
容を挿入する。図12においては、文字列includeが2
回出現するが、その1番目の命令を検出したときには、
file1という名前のファイルを、2番目の命令を検出し
たときには、file2という名前のファイルを挿入する。f
ile1,file2という名前のファイルの内容が、図13に示
すものだったとする。それぞれの内容が、挿入された結
果、仕様記述構文解析手段1002dに渡される字句の
並びは、仕様記述1001として、図14に示した記述
を用いた場合と等しくなる。
Program generator generation device 1002
Converts this command into a file insertion command detecting means 1002b.
And inserts the contents of the specified file at that location. In FIG. 12, the character string include is 2
Appears once, but when the first instruction is detected,
When the second instruction is detected in the file named file1, the file named file2 is inserted. f
It is assumed that the contents of a file named ile1 and file2 are as shown in FIG. As a result of inserting the respective contents, the arrangement of the lexical characters passed to the specification description parsing means 1002d becomes equal to the case where the description shown in FIG.

【0062】図13に示す例ではfile1,file2の内容が
数十文字程度と短いものであるが、高級プログラミング
言語のプログラムを生成するプログラムジェネレータの
仕様を記述する場合には一つの文字列が1000文字を
越える場合があり、このような文字列が仕様記述の中に
入ると、仕様記述が読み難くなり、保守性を悪くする。
また、仕様記述の中で文字列を表記する場合には、改
行を示す文字や、文字列の始まりと終わりを示す文字
は、特別な扱いをしなければならない。これは、C言語
ではエスケープと呼ばれ、特殊な記法を用いて、それら
の文字を表記している。そのため、文字列の内容を理解
するのが難しくなる。よって、このような場合には、別
のファイルに文字列の内容を書いて、仕様記述中にはそ
のファイルを挿入することを示すファイル挿入命令のみ
を書いておくほうが、仕様記述が読みやすくなる。
In the example shown in FIG. 13, the contents of file1 and file2 are as short as several tens of characters. However, when describing the specifications of a program generator for generating a program of a high-level programming language, one character string is 1000 characters. When such a character string is included in the specification description, the specification description becomes difficult to read and the maintainability deteriorates.
When a character string is described in the specification description, characters indicating a line feed and characters indicating the start and end of the character string must be treated specially. This is called escape in the C language, and uses a special notation to represent these characters. Therefore, it is difficult to understand the contents of the character string. Therefore, in such a case, it is easier to read the specification description by writing the contents of the character string in another file and writing only the file insertion instruction indicating that the file is to be inserted in the specification description .

【0063】このように、本実施例と従来のものを比較
すると本実施例によるプログラムジェネレータは、仕様
記述が読みやすくなるという点で優れた効果が得られ
る。
As described above, when the present embodiment is compared with the conventional one, the program generator according to the present embodiment has an excellent effect that the specification description is easy to read.

【0064】以上のように本実施例によれば、プログラ
ムジェネレータ生成装置中にファイル挿入命令検出手
段、およびファイル挿入手段を設けることにより、より
読みやすい形態の仕様記述からプログラムジェネレータ
の生成を行なうことができ、プログラムジェネレータの
開発の効率を向上させることができる。
As described above, according to the present embodiment, by providing the file insertion instruction detecting means and the file inserting means in the program generator generating apparatus, the program generator can be generated from the specification description in a more readable form. And the efficiency of program generator development can be improved.

【0065】(実施例3)以下、本発明の第3の実施例
について、図面を参照しながら説明する。
(Embodiment 3) Hereinafter, a third embodiment of the present invention will be described with reference to the drawings.

【0066】図15は本発明の第3の実施例におけるプ
ログラムジェネレータ生成過程とプログラムジェネレー
タ生成装置の構成を示したブロック図である。
FIG. 15 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to the third embodiment of the present invention.

【0067】図15の構成と図10の構成で異なる要素
について説明する。図15において、1502bは、仕
様記述字句解析手段1502aが生成した字句の並びの
中から実行時ファイル挿入命令を検出する実行時ファイ
ル挿入命令検出手段、1502cは、仕様記述の字句の
並びの中に、プログラムジェネレータの実行時に、実行
時被挿入ファイル1509を挿入する手続きを挿入する
ファイル挿入手続き挿入手段、1509は、実行時に出
力ファイル1508の中に挿入される実行時被挿入ファ
イルである。その他は図10の構成と同じである。
Elements different between the configuration in FIG. 15 and the configuration in FIG. 10 will be described. In FIG. 15, reference numeral 1502b denotes a runtime file insertion instruction detecting unit that detects a runtime file insertion instruction from the sequence of lexical characters generated by the specification description lexical analysis unit 1502a. The file insertion procedure insertion means 1509 for inserting a procedure for inserting the run-time inserted file 1509 when the program generator is executed is a run-time inserted file inserted into the output file 1508 at the time of execution. Others are the same as the configuration of FIG.

【0068】上記のように構成されたプログラムジェネ
レータ生成装置について、図16に示すフローチャート
を用いて、その動作を説明する。図16において、ステ
ップ(イ)、ステップ(ロ)、ステップ(ニ)、ステッ
プ(ホ)、ステップ(ヘ)は、図11の動作と同様なも
のである。図11の動作と異なるのは、ステップ(イ)
によって検出された実行時ファイル挿入命令を受け取
り、プログラムジェネレータの動作時に、指定されたフ
ァイルの内容を読みだして、出力プログラム中に挿入す
る手続きを、字句の並びの中に挿入する(ステップ
(ハ))というステップを追加した点である。
The operation of the above-configured program generator generator will be described with reference to the flowchart shown in FIG. In FIG. 16, steps (a), (b), (d), (e), and (f) are the same as the operations in FIG. The difference from the operation of FIG.
When the program generator operates, it reads the contents of the specified file and inserts the procedure to be inserted into the output program into the lexical sequence (step (c)). )).

【0069】次に、上記構成を用いた場合の効果につい
て、図面を参照しながら説明する。この構成を用いた場
合、実施例2と同様に、図12のように記述された仕様
記述が図14と同様の結果を生じ、より読みやすい仕様
記述を用いてプログラムジェネレータの生成を行なうこ
とができ、プログラムジェネレータの開発の効率を向上
させることができる。さらに、実行時被挿入ファイル1
509は、プログラムジェネレータ1507を生成した
ときではなく、プログラムジェネレータ1507が動作
するときに、出力プログラム1508中に挿入されるた
め、実行時被挿入ファイル1509に変更を加えた場合
に、プログラムジェネレータの生成、コンパイルを再度
行なうことなく、変更を出力プログラム1508に反映
させることができる。
Next, effects of the above configuration will be described with reference to the drawings. When this configuration is used, the specification description described in FIG. 12 produces the same result as in FIG. 14 as in the second embodiment, and the program generator can be generated using the more readable specification description. It is possible to improve the efficiency of program generator development. In addition, the runtime inserted file 1
509 is inserted into the output program 1508 when the program generator 1507 is operated, not when the program generator 1507 is generated. Therefore, when the runtime inserted file 1509 is changed, the program generator The change can be reflected in the output program 1508 without recompiling.

【0070】このことによって、プログラムジェネレー
タを開発する際に、実行時被挿入ファイルに変更を加え
るためにに必要な時間を短縮することができ、開発の効
率を向上させることができる。以上のように本実施例に
よれば、プログラムジェネレータ生成装置中に実行時フ
ァイル挿入命令検出手段、およびファイル挿入手続き挿
入手段を設けることにより、より読みやすい形態の仕様
記述からプログラムジェネレータの生成を行なうことが
でき、かつ、挿入されるファイルに変更が生じたときに
もプログラムジェネレータの生成、コンパイルを行なわ
ずに、その変更を出力プログラムに反映させることがで
きるため、プログラムジェネレータの開発の効率を向上
させることができる。
As a result, when developing a program generator, the time required for making a change to the file to be inserted at the time of execution can be reduced, and the efficiency of development can be improved. As described above, according to the present embodiment, the program generator is generated from the specification description in a more readable form by providing the execution-time file insertion instruction detection means and the file insertion procedure insertion means in the program generator generation apparatus. And when the file to be inserted changes, the change can be reflected in the output program without generating and compiling the program generator, improving the efficiency of program generator development Can be done.

【0071】なお、実施例2の場合と違い、実施例3で
は、プログラムジェネレータ1507の中に、手続きを
挿入しなければならない。手続きは、構文解析部150
3の中に、プログラムとして表現されていてもよいし、
実施例1と同様の方法を用いて、別途、手続きの管理を
行なう部分を生成して、プログラムジェネレータ150
7の中に組み込んでもよい。
Note that, unlike the second embodiment, in the third embodiment, a procedure must be inserted into the program generator 1507. The procedure is performed by the syntax analyzer 150.
3, it may be expressed as a program,
By using the same method as in the first embodiment, a part for managing the procedure is separately generated, and the program generator 150
7 may be incorporated.

【0072】(実施例4)以下、本発明の第4の実施例
について、図面を参照しながら説明する。
Embodiment 4 Hereinafter, a fourth embodiment of the present invention will be described with reference to the drawings.

【0073】図17は本発明の第4の実施例におけるプ
ログラムジェネレータ生成過程とプログラムジェネレー
タ生成装置の構成を示したブロック図である。
FIG. 17 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to the fourth embodiment of the present invention.

【0074】図17の構成と図1の構成で異なる要素に
ついて説明する。図17において、1702bは、仕様
記述字句解析手段1702aが生成した字句の並びの中
から文字列置換命令を検出する文字列置換命令検出手
段、1702cは、仕様記述の字句の並びの中に、プロ
グラムジェネレータの実行時に、文字列置換を行なう手
続きを挿入する文字列置換手続き挿入手段である。その
他は図1と同じである。
Elements different from the configuration in FIG. 17 and the configuration in FIG. 1 will be described. In FIG. 17, reference numeral 1702b denotes a character string replacement instruction detecting means for detecting a character string replacement instruction from the sequence of lexical characters generated by the specification description lexical analysis means 1702a. This is character string replacement procedure insertion means for inserting a procedure for performing character string replacement when the generator is executed. Others are the same as FIG.

【0075】上記のように構成されたプログラムジェネ
レータ生成装置について、図18に示すフローチャート
を用いて、その動作を説明する。図18において、ステ
ップ(イ)、ステップ(ニ)、ステップ(ホ)、ステッ
プ(ヘ)は、図2の動作と同様なものである。図2の動
作と異なるのは、ステップ(イ)によって生成された字
句の並びから文字列置換命令を検出し(ステップ
(ロ))、プログラムジェネレータの動作時に、指定さ
れた文字列置換を行なう手続きを、字句の並びの中に挿
入する(ステップ(ハ))というステップを追加した点
である。
The operation of the above-configured program generator generator will be described with reference to the flowchart shown in FIG. In FIG. 18, steps (a), (d), (e), and (f) are the same as the operations in FIG. 2 is different from the procedure in FIG. 2 in that a character string replacement instruction is detected from the lexical sequence generated in step (a) (step (b)), and a specified character string replacement is performed during operation of the program generator. Is inserted into the lexical sequence (step (c)).

【0076】この処理フローに基づき、図19、および
図20を参照しながら使用例について説明する。
Based on this processing flow, an example of use will be described with reference to FIGS. 19 and 20.

【0077】図19は仕様記述1701の一部を示した
図である。図20は、本発明を用いた場合に、図19に
示した仕様記述と等価な結果を生じる仕様記述を示した
図である。
FIG. 19 is a diagram showing a part of the specification description 1701. FIG. 20 is a diagram showing a specification description that produces a result equivalent to the specification description shown in FIG. 19 when the present invention is used.

【0078】図19において、replaceという文字列は
予約語であり、そのあとに続くかっこでくくられた中の
第1引数の文字列の中の、第2引数の文字列と同じ部分
を、第3引数の文字列で置き換えることを示した、文字
列置換命令である。プログラムジェネレータ生成装置1
702は、この命令を、文字列置換命令検出手段170
2bによって検出し、その位置に、プログラムジェネレ
ータ1707の動作時に、指定された文字列の置換を行
なう手続きを挿入する。
In FIG. 19, the character string “replace” is a reserved word, and the same part as the character string of the second argument in the character string of the first argument enclosed in parentheses is followed by This is a character string replacement command that indicates replacement with a three-argument character string. Program generator generation device 1
702 designates this command as a character string replacement command detecting means 170
2b, a procedure for replacing the designated character string is inserted at that position when the program generator 1707 operates.

【0079】図19において文字列replaceを検出した
ときには、第1引数の文字列の中のFUNCTIONという文字
列を、生成規則の中の、bという文法記号の属性値で置
き換えるための手続きを挿入する。もし、bという文法
記号の属性値が、multiplyという文字列であった場合に
は、文字列FUNCTIONは、文字列multiplyで置き換えられ
るため、図19の仕様記述は、図20の仕様記述と同じ
意味を持つ。
When the character string replace is detected in FIG. 19, a procedure for replacing the character string FUNCTION in the character string of the first argument with the attribute value of the grammatical symbol b in the generation rule is inserted. . If the attribute value of the grammar symbol “b” is a character string “multiply”, the character string “FUNCTION” is replaced with the character string “multiply”, so the specification description in FIG. 19 has the same meaning as the specification description in FIG. have.

【0080】本発明の主たる目的である高級プログラミ
ング言語のプログラムを生成するプログラムジェネレー
タの仕様を記述する場合には大量の定型の文字列の中
に、入力プログラムの内容に従って変更したい部分が散
らばっていることが多い。このようなときに、本実施例
のプログラムジェネレータ生成装置では、その変更した
い部分を、特定の文字列にして、大量の文字列全体をま
とめて記述しておいて、文字列置換命令によって、プロ
グラム変換装置の動作時に文字列置換を行なうことがで
き、仕様記述の読みやすさや、開発効率の点で優れた効
果を得ることができる。
When describing the specifications of a program generator for generating a program of a high-level programming language, which is the main object of the present invention, parts to be changed according to the contents of an input program are scattered in a large number of fixed character strings. Often. In such a case, the program generator generating apparatus according to the present embodiment converts a portion to be changed into a specific character string, collectively describes a large amount of character strings, and executes a program by a character string replacement instruction. Character string replacement can be performed during the operation of the conversion device, and excellent effects can be obtained in terms of readability of specification description and development efficiency.

【0081】以上のように本実施例によれば、プログラ
ムジェネレータ生成装置中に文字列置換命令検出手段、
および文字列置換手続き挿入手段を設けることにより、
より読みやすい形態の仕様記述からプログラムジェネレ
ータの生成を行なうことができ、プログラムジェネレー
タの開発の効率を向上させることができる。
As described above, according to the present embodiment, the character string replacement instruction detecting means is provided in the program generator generating device.
And the provision of a character string replacement procedure insertion means,
The program generator can be generated from the specification description in a more readable form, and the development efficiency of the program generator can be improved.

【0082】なお、実施例1から実施例4では、それぞ
れの実施例を独立なものとして説明したが、これらを任
意に組み合わせることにより、より一層の効果を得るこ
とができる。
In the first to fourth embodiments, the respective embodiments have been described as being independent. However, by combining them arbitrarily, further effects can be obtained.

【0083】[0083]

【発明の効果】以上のように本発明は、第1に、プログ
ラムジェネレータ生成装置中に文字列抜き出し手段、お
よび文字列管理部生成手段を設けることにより、文字列
管理を行なうプログラムの作成を省き、かつ生成された
プログラムジェネレータにおいての効率の良い文字列合
成を行なうことができ、プログラムジェネレータの開発
の効率を向上させることができる。
As described above, according to the present invention, first, by providing a character string extracting means and a character string management section generating means in the program generator generating apparatus, the creation of a program for performing character string management can be omitted. In addition, efficient character string synthesis in the generated program generator can be performed, and the development efficiency of the program generator can be improved.

【0084】第2に、プログラムジェネレータ生成装置
中にファイル挿入命令検出手段、およびファイル挿入手
段を設けることにより、より読みやすい形態の仕様記述
からプログラムジェネレータの生成を行なうことがで
き、プログラムジェネレータの開発の効率を向上させる
ことができる。
Second, by providing the file insertion instruction detecting means and the file inserting means in the program generator generating apparatus, the program generator can be generated from the specification description in a more readable form. Efficiency can be improved.

【0085】第3に、プログラムジェネレータ生成装置
中にファイル挿入命令検出手段、およびファイル挿入命
令挿入手段を設けることにより、より読みやすい形態の
仕様記述からプログラムジェネレータの生成を行なうこ
とができ、かつ、挿入されるファイルに変更が生じたと
きにもプログラムジェネレータの生成、コンパイルを行
なわずに、その変更を出力プログラムに反映させること
ができるため、プログラムジェネレータの開発の効率を
向上させることができる。
Third, by providing the file insertion instruction detecting means and the file insertion instruction inserting means in the program generator generating apparatus, the program generator can be generated from the specification description in a more readable form, and Even when a change occurs in the inserted file, the change can be reflected in the output program without generating and compiling the program generator, so that the efficiency of the program generator development can be improved.

【0086】第4に、プログラムジェネレータ生成装置
中に文字列置換命令検出手段、および文字列置換手続き
挿入手段を設けることにより、より読みやすい形態の仕
様記述からプログラムジェネレータの生成を行なうこと
ができ、プログラムジェネレータの開発の効率を向上さ
せることができる。
Fourth, by providing the character string replacement instruction detecting means and the character string replacement procedure inserting means in the program generator generation device, the program generator can be generated from the specification description in a more readable form. The efficiency of program generator development can be improved.

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

【図1】本発明の第1の実施例におけるプログラムジェ
ネレータ生成過程とプログラムジェネレータ生成装置の
構成を示したブロック図
FIG. 1 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to a first embodiment of the present invention.

【図2】第1の実施例におけるプログラムジェネレータ
生成装置の動作を示すフローチャート
FIG. 2 is a flowchart illustrating an operation of the program generator generation device according to the first embodiment;

【図3】第1の実施例のプログラムジェネレータ生成装
置によって生成されたプログラムジェネレータの構成を
示すブロック図
FIG. 3 is a block diagram illustrating a configuration of a program generator generated by the program generator generation device according to the first embodiment;

【図4】第1の実施例のプログラムジェネレータ生成装
置によって生成されたプログラムジェネレータの動作を
示すフローチャート
FIG. 4 is a flowchart showing the operation of the program generator generated by the program generator generation device of the first embodiment.

【図5】第1の実施例のプログラムジェネレータ生成装
置によって生成されたプログラムジェネレータ中で用い
られる基本的なデータ構造を示す構造図
FIG. 5 is a structural diagram showing a basic data structure used in the program generator generated by the program generator generating device of the first embodiment.

【図6】第1の実施例におけるプログラムジェネレータ
生成装置の入力として用いられる仕様記述を示した図
FIG. 6 is a diagram showing a specification description used as an input of the program generator generation device in the first embodiment.

【図7】第1の実施例におけるプログラムジェネレータ
生成装置が生成する文字列管理部をC言語で実現したプ
ログラムを示す図
FIG. 7 is a diagram illustrating a program in which a character string management unit generated by the program generator generation device according to the first embodiment is realized in C language;

【図8】第1の実施例におけるプログラムジェネレータ
生成装置が生成するプログラムジェネレータの内部で使
用されるデータ構造の例を示した構造図
FIG. 8 is a structural diagram showing an example of a data structure used inside the program generator generated by the program generator generating device in the first embodiment.

【図9】第1の実施例におけるプログラムジェネレータ
生成装置が生成するプログラムジェネレータの内部で使
用されるデータ構造の例を示した構造図
FIG. 9 is a structural diagram showing an example of a data structure used inside the program generator generated by the program generator generating device in the first embodiment.

【図10】本発明の第2の実施例におけるプログラムジ
ェネレータ生成過程とプログラムジェネレータ生成装置
の構成を示したブロック図
FIG. 10 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to a second embodiment of the present invention.

【図11】第2の実施例におけるプログラムジェネレー
タ生成装置の動作を示すフローチャート
FIG. 11 is a flowchart illustrating the operation of the program generator generation device according to the second embodiment.

【図12】第2の実施例におけるプログラムジェネレー
タ生成装置の入力として用いられる仕様記述を示した図
FIG. 12 is a diagram showing a specification description used as an input of a program generator generation device in a second embodiment.

【図13】(a)第2の実施例におけるプログラムジェ
ネレータ生成装置が、仕様記述の中に挿入するファイル
のうち、file1という名前が付いたものを示した図 (b)第2の実施例におけるプログラムジェネレータ生
成装置が、仕様記述の中に挿入するファイルのうち、fi
le2という名前が付いたものを示した図
FIG. 13A is a diagram showing a file named file1 among files to be inserted into the specification description by the program generator generating apparatus according to the second embodiment. Of the files that the program generator generator inserts into the specification description,
Diagram showing what is named le2

【図14】図12の仕様記述と等価な結果な結果を生じ
る仕様記述を示した図
FIG. 14 is a diagram showing a specification description that produces a result equivalent to the specification description of FIG. 12;

【図15】本発明の第3の実施例におけるプログラムジ
ェネレータ生成過程とプログラムジェネレータ生成装置
の構成を示したブロック図
FIG. 15 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to a third embodiment of the present invention.

【図16】第3の実施例におけるプログラムジェネレー
タ生成装置の動作を示すフローチャート
FIG. 16 is a flowchart showing the operation of the program generator generation device according to the third embodiment.

【図17】本発明の第4の実施例におけるプログラムジ
ェネレータ生成過程とプログラムジェネレータ生成装置
の構成を示したブロック図
FIG. 17 is a block diagram showing a program generator generation process and a configuration of a program generator generation device according to a fourth embodiment of the present invention.

【図18】第4の実施例におけるプログラムジェネレー
タ生成装置の動作を示すフローチャート
FIG. 18 is a flowchart showing the operation of the program generator generation device according to the fourth embodiment.

【図19】第4の実施例におけるプログラムジェネレー
タ生成装置の入力として用いられる仕様記述を示した図
FIG. 19 is a diagram showing a specification description used as an input of the program generator generation device in the fourth embodiment.

【図20】図19の仕様記述と等価な結果な結果を生じ
る仕様記述を示した図
FIG. 20 is a diagram showing a specification description that produces a result equivalent to the specification description of FIG. 19;

【図21】従来のプログラムジェネレータ生成装置の構
成を示したブロック図
FIG. 21 is a block diagram showing a configuration of a conventional program generator generation device.

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

101 仕様記述 102 プログラムジェネレータ生成装置 102a 仕様記述字句解析手段 102b 文字列抜き出し手段 102c 文字列管理部生成手段 102d 仕様記述構文解析手段 102e 構文解析表生成手段 102f 構文解析部生成手段 103 構文解析部 104 文字列管理部 105 ユーザプログラム 106 コンパイラ 107 入力プログラム 108 プログラムジェネレータ 109 出力プログラム 301 字句解析部 302 コード生成部 303 データ管理部 304 ライブラリ関数群 501 コンスセル 502 文字列オブジェクト 601 ルール 602 ルール 1001 仕様記述 1002 プログラムジェネレータ生成装置 1002a 仕様記述字句解析手段 1002b ファイル挿入命令検出手段 1002c ファイル挿入手段 1002d 仕様記述構文解析手段 1002e 構文解析表生成手段 1002f 構文解析部生成手段 1003 構文解析部 1004 ユーザプログラム 1005 コンパイラ 1006 入力プログラム 1007 プログラムジェネレータ 1008 出力プログラム 1009 被挿入ファイル 1201 ルール 1501 仕様記述 1502 プログラムジェネレータ生成装置 1502a 仕様記述字句解析手段 1502b 実行時ファイル挿入命令検出手段 1502c ファイル挿入手続き挿入手段 1502d 仕様記述構文解析手段 1502e 構文解析表生成手段 1502f 構文解析部生成手段 1503 構文解析部 1504 ユーザプログラム 1505 コンパイラ 1506 入力プログラム 1507 プログラムジェネレータ 1508 出力プログラム 1509 実行時被挿入ファイル 1701 仕様記述 1702 プログラムジェネレータ生成装置 1702a 仕様記述字句解析手段 1702b 文字列置換命令検出手段 1702c 文字列置換手続き挿入手段 1702d 仕様記述構文解析手段 1702e 構文解析表生成手段 1702f 構文解析部生成手段 1703 構文解析部 1704 ユーザプログラム 1705 コンパイラ 1706 入力プログラム 1707 プログラムジェネレータ 1708 出力プログラム 2101 仕様記述 2102 プログラムジェネレータ生成装置 2102a 仕様記述字句解析手段 2102b 仕様記述構文解析手段 2102c 構文解析表生成手段 2102d 構文解析部生成手段 2103 構文解析部 2104 ユーザプログラム 2105 コンパイラ 2106 入力プログラム 2107 プログラムジェネレータ 2108 出力プログラム 101 specification description 102 program generator generation device 102a specification description lexical analysis means 102b character string extraction means 102c character string management part generation means 102d specification description syntax analysis means 102e syntax analysis table generation means 102f syntax analysis part generation means 103 syntax analysis part 104 characters Column management unit 105 User program 106 Compiler 107 Input program 108 Program generator 109 Output program 301 Lexical analysis unit 302 Code generation unit 303 Data management unit 304 Library function group 501 Cons cell 502 Character string object 601 Rule 602 Rule 1001 Specification description 1002 Program generator generation Apparatus 1002a Specification description lexical analysis means 1002b File insertion instruction detection means 1002c File insertion Means 1002d Specification description syntax analysis means 1002e Syntax analysis table generation means 1002f Syntax analysis section generation means 1003 Syntax analysis section 1004 User program 1005 Compiler 1006 Input program 1007 Program generator 1008 Output program 1009 Inserted file 1201 Rule 1501 Specification description 1502 Program generator generation Device 1502a Specification description lexical analysis means 1502b Runtime file insertion instruction detection means 1502c File insertion procedure insertion means 1502d Specification description syntax analysis means 1502e Syntax analysis table generation means 1502f Syntax analysis generation means 1503 Syntax analysis section 1504 User program 1505 Compiler 1506 Input Program 1507 Program generator 1508 Output program Gram 1509 file to be inserted at execution time 1701 specification description 1702 program generator generation device 1702a specification description lexical analysis means 1702b character string replacement instruction detection means 1702c character string replacement procedure insertion means 1702d specification description syntax analysis means 1702e syntax analysis table generation means 1702f syntax analysis Part generation means 1703 syntax analysis part 1704 user program 1705 compiler 1706 input program 1707 program generator 1708 output program 2101 specification description 2102 program generator generation device 2102a specification description lexical analysis means 2102b specification description syntax analysis means 2102c syntax analysis table generation means 2102d syntax analysis Section generation means 2103 syntax analysis section 2104 user program 2105 compiler 2106 Input program 2107 Program generator 2108 Output program

───────────────────────────────────────────────────── フロントページの続き (72)発明者 イバン イ ペッチ 大阪府門真市大字門真1006番地 松下電 器産業株式会社内 (72)発明者 鈴木 芳彦 大阪府門真市大字門真1006番地 松下電 器産業株式会社内 (56)参考文献 佐々政孝 「プログラミング言語処理 系」 岩波書店 (1989) P.293− 305 ──────────────────────────────────────────────────の Continuing on the front page (72) Inventor Iban I Petch 1006 Kadoma Kadoma, Kadoma City, Osaka Prefecture Inside Matsushita Electric Industrial Co., Ltd. In-house (56) References Masataka Sasa "Programming Language Processing System" Iwanami Shoten (1989) 293− 305

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 生成すべきプログラムジェネレータの仕
様記述を読み込み字句に分解する仕様記述字句解析手段
と、分解して得られた字句の中の文字列を分離して抜き
出す文字列抜き出し手段と、抜き出した文字列の保管場
所を、当該保管場所にユニークな識別子を付与してプロ
グラムジェネレータ中で管理する文字列管理部を生成す
る文字列管理部生成手段と、前記文字列抜き出し手段に
より加工された仕様記述の構文解析を行う仕様記述構文
解析手段と、前記構文解析手段の出力に基づき構文解析
表を生成する構文解析表生成手段と、前記構文解析手段
の出力、および前記構文解析表に基づきプログラムジェ
ネレータ中で構文解析を行なう構文解析部を生成する構
文解析部生成手段を有するプログラムジェネレータ生成
装置。
1. A specification description lexical analysis means for reading a specification description of a program generator to be generated into a lexical character, a character string extracting means for separating and extracting a character string in the lexical character obtained by the decomposition, and an extraction. Character string storage
Location by assigning a unique identifier to the storage location.
A character string management unit generating means for generating a character string management unit to be managed in the gram generator ; a specification description parsing means for parsing the specification description processed by the character string extracting means; and an output of the syntax analysis means A syntactic analysis table generating means for generating a syntactic analysis table on the basis of a syntactic analysis table; an output of the syntactic analysis means; Program generator generator.
【請求項2】 生成すべきプログラムジェネレータの仕
様記述を読み込み字句に分解する仕様記述字句解析手段
と、分解して得られた字句の中からファイル挿入命令を
検出するファイル挿入命令検出手段と、ファイル挿入命
令に従って指定されたファイルの内容を、プログラムジ
ェネレータ中の文字列管理部の管理する文字列の集合の
中に挿入するファイル挿入手段と前記ファイル挿入手段
により加工された仕様記述の構文解析を行う仕様記述構
文解析手段と、前記構文解析手段の出力に基づき構文解
析表を生成する構文解析表生成手段と、前記構文解析手
段の出力、および前記構文解析表に基づきプログラムジ
ェネレータ中で構文解析を行なう構文解析部を生成する
構文解析部生成手段を有するプログラムジェネレータ生
成装置。
2. A specification description lexical analysis means for reading a specification description of a program generator to be generated into a lexical form, a file insertion instruction detecting means for detecting a file insertion instruction from the lexical form obtained by the decomposition, The contents of the file specified according to the insert
Of a set of character strings managed by the character string management unit in the generator
File insertion means for inserting into the file, specification description syntax analysis means for performing syntax analysis of the specification description processed by the file insertion means, and syntax analysis table generation means for generating a syntax analysis table based on an output of the syntax analysis means. And a syntactic analysis unit generating means for generating a syntactic analysis unit for performing syntactic analysis in the program generator based on the output of the syntactic analysis means and the syntactic analysis table.
【請求項3】 生成すべきプログラムジェネレータの仕
様記述を読み込み字句に分解する仕様記述字句解析手段
と、分解して得られた字句の中からプログラムジェネレ
ータによって、入力プログラムを出力プログラムに変換
する時である実行時に実行される、実行時ファイル挿入
命令を検出する実行時ファイル挿入命令検出手段と、
様記述をプログラムジェネレータに変換する時であるプ
ログラム変換時にファイル挿入命令に従って指定された
ファイルの内容を出力プログラム中に挿入する手続き
を、生成されるプログラムジェネレータのプログラム中
に挿入するファイル挿入手続き挿入手段と、前記ファイ
ル挿入手続き挿入手段により加工された仕様記述の構文
解析を行う仕様記述構文解析手段と、前記構文解析手段
の出力に基づき構文解析表を生成する構文解析表生成手
段と、前記構文解析手段の出力、および前記構文解析表
に基づきプログラムジェネレータ中で構文解析を行なう
構文解析部を生成する構文解析部生成手段を有するプロ
グラムジェネレータ生成装置。
3. A specification description lexical analysis means for reading a specification description of a program generator to be generated and decomposing it into lexical data,
Data to convert an input program to an output program
Run-time file insertion, executed at run time
And run-time files inserted instruction detection means for detecting the instructions, specifications
Is the time to convert the description into a program generator.
Procedure to insert the contents of the specified file into the output program according to the file insertion instruction during program conversion
In the generated program generator program
File insertion procedure insertion means for inserting into a file, specification description syntax analysis means for performing syntax analysis of the specification description processed by the file insertion procedure insertion means, and syntax analysis for generating a syntax analysis table based on the output of the syntax analysis means A program generator generation apparatus, comprising: a table generation unit; and a syntax analysis unit generation unit that generates a syntax analysis unit that performs syntax analysis in a program generator based on the output of the syntax analysis unit and the syntax analysis table.
【請求項4】 生成すべきプログラムジェネレータの仕
様記述を読み込み字句に分解する仕様記述字句解析手段
と、分解して得られた字句の中から文字列置換命令を検
出する文字列置換命令検出手段と、仕様記述をプログラ
ムジェネレータに変換する時であるプログラム変換時
文字列置換命令に従って文字列置換を行なう手続きを、
生成されるプログラムジェネレータのプログラム中に
入する文字列置換手続き挿入手段と前記文字列置換手続
き挿入手段により加工された仕様記述の構文解析を行う
仕様記述構文解析手段と、前記構文解析手段の出力に基
づき構文解析表を生成する構文解析表生成手段と、前記
構文解析手段の出力、および前記構文解析表に基づきプ
ログラムジェネレータ中で構文解析を行なう構文解析部
を生成する構文解析部生成手段を有するプログラムジェ
ネレータ生成装置。
4. A specification description lexical analysis means for reading a specification description of a program generator to be generated into a lexical character, and a character string replacement instruction detecting means for detecting a character string replacement instruction from the lexical character obtained by the decomposition. Program specifications
A procedure for performing character string replacement according to a character string replacement instruction during program conversion when converting to a
Character string replacement procedure insertion means inserted into the program of the generated program generator and the character string replacement procedure
Specification description parsing means for parsing the specification description processed by the insertion means, parsing table generating means for generating a parsing table based on the output of the parsing means, output of the parsing means, A program generator generation device having a syntax analysis section generation means for generating a syntax analysis section for performing syntax analysis in a program generator based on the syntax analysis table.
JP19940791A 1991-08-08 1991-08-08 Program generator generator Expired - Lifetime JP2720643B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP19940791A JP2720643B2 (en) 1991-08-08 1991-08-08 Program generator generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP19940791A JP2720643B2 (en) 1991-08-08 1991-08-08 Program generator generator

Publications (2)

Publication Number Publication Date
JPH0546368A JPH0546368A (en) 1993-02-26
JP2720643B2 true JP2720643B2 (en) 1998-03-04

Family

ID=16407286

Family Applications (1)

Application Number Title Priority Date Filing Date
JP19940791A Expired - Lifetime JP2720643B2 (en) 1991-08-08 1991-08-08 Program generator generator

Country Status (1)

Country Link
JP (1) JP2720643B2 (en)

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
佐々政孝 「プログラミング言語処理系」 岩波書店 (1989) P.293−305

Also Published As

Publication number Publication date
JPH0546368A (en) 1993-02-26

Similar Documents

Publication Publication Date Title
US6434742B1 (en) Symbol for automatically renaming symbols in files during the compiling of the files
US20060271920A1 (en) Multilingual compiler system and method
US20020143823A1 (en) Conversion system for translating structured documents into multiple target formats
EP0528640A2 (en) Computer system for generating a user interface
EP0735466A2 (en) Method and apparatus for displaying locations of errors detected inside software macro calls
JPH08202545A (en) Object-oriented system and method for generation of target language code
Van Wyk et al. Waving A Language-Independent WEB.
Angelov et al. PGF: A portable run-time format for type-theoretical grammars
Ballance et al. Grammatical abstraction and incremental syntax analysis in a language-based editor
US20030115571A1 (en) Construction of a software application from a plurality of programming languages
Wetherell et al. LR—automatic parser generator and LR (1) parser
Koskimies et al. The design of a language processor generator
JP2720643B2 (en) Program generator generator
Paakki Prolog in practical compiler writing
Andrews et al. The formal definition of Modula-2 and its associated interpreter
Minas et al. Specifying and implementing visual process modeling languages with DiaGen
JP2675100B2 (en) Language converter and language conversion method
JP3003459B2 (en) Program creation support device
Kirslis The SAGA editor: a language-oriented editor based on an incremental LR (1) parser
Amal et al. Software tool for translating pseudocode to a programming language
JP2003050700A (en) Program converting method
JP3596570B2 (en) Method of allocating classes to main storage
Singh Compiler Design
Tarhio A compiler generator for attribute evaluation during LR parsing
Räihä et al. Developments in compiler writing systems