JP2001005655A - Device and method for aiding development of application generator - Google Patents

Device and method for aiding development of application generator

Info

Publication number
JP2001005655A
JP2001005655A JP11178031A JP17803199A JP2001005655A JP 2001005655 A JP2001005655 A JP 2001005655A JP 11178031 A JP11178031 A JP 11178031A JP 17803199 A JP17803199 A JP 17803199A JP 2001005655 A JP2001005655 A JP 2001005655A
Authority
JP
Japan
Prior art keywords
generator
conversion rule
syntax tree
description
output program
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
JP11178031A
Other languages
Japanese (ja)
Inventor
Minoru Tomobe
実 友部
Hiroki Tokuoka
宏樹 徳岡
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 JP11178031A priority Critical patent/JP2001005655A/en
Publication of JP2001005655A publication Critical patent/JP2001005655A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To improve the efficiency in the development of an application generator by making describable a program piece to be described in conversion rule definition to be the specifications of generator operation similarly to an output program piece to be outputted from a generator and making automatically generaable an abstract syntax tree data type definition expressing a syntax analyzer and generator input specifications from grammar specifications to be the generator operation specifications. SOLUTION: The application generator development aiding device 10 is provided with a means 101 for generating the data structure of a term analyzer, a syntax analyzer and an abstract syntax tree from a term analysis specification and a grammar specification to be the operation specifications of the generator and generating an input specification abstract syntax tree expressing the syntax analytical result of an input specification for regulating the operation specifications of a generator output program by using the data structure of the abstract syntax tree, a means 102 for converting output program piece description in conversion rule definition to be the operation specifications of the generator into a conversion rule and a means 103 for executing the abstract syntax tree of the input specification on the basis of the conversion rule outputted from the means 102 and outputting the execution result as a generator output program.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、プログラム開発支
援装置及びプログラム開発支援方法に係り、特にプログ
ラムを、そのプログラムの動作仕様から自動的に生成す
るアプリケーションジェネレータの開発を支援するため
に用いる、アプリケーションジェネレータ開発支援装置
及びアプリケーションジェネレータ開発支援方法に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a program development support apparatus and a program development support method, and more particularly, to an application used to support the development of an application generator for automatically generating a program from operation specifications of the program. The present invention relates to a generator development support device and an application generator development support method.

【0002】[0002]

【従来の技術】コンピュータ上で動作するプログラムの
開発支援では、プログラムの動作仕様の記述から、その
動作仕様をみたすプログラムを自動的に生成するアプリ
ケーションジェネレータを用いる方法が広く採用されて
いる。
2. Description of the Related Art In support of development of a program operating on a computer, a method using an application generator that automatically generates a program that satisfies the operation specification from a description of the operation specification of the program is widely adopted.

【0003】アプリケーションジェネレータには、広義
にはコンパイラも広く含まれる。通常コンパイラは、C
/C++言語といった、分野を特定しない汎用の高級言語
からコンピュータハードウェア上で直接実行可能なアセ
ンブラ言語を生成する。このコンパイラの入力となる高
級言語には、特定のオペレーティングシステムやハード
ウェアに依存しない言語としてC/C++言語が広く用いら
れている。
[0003] The application generator broadly includes a compiler. Usually the compiler is C
/ Generates an assembler language that can be directly executed on computer hardware from a general-purpose high-level language that does not specify a field, such as the C ++ language. The C / C ++ language is widely used as a high-level language that is input to the compiler as a language independent of a specific operating system or hardware.

【0004】現在、このような高級言語が広く用いられ
るようになったため、特定の分野でのアプリケーション
プログラムをさらに効率良く開発するための手段として
アプリケーションジェネレータが広く用いられるように
なった。アプリケーションジェネレータは、ジェネレー
タの生成するプログラムが用いられる特定の分野に適切
なプログラムの動作仕様記述を入力として、その動作仕
様を満たす高級言語で記述されたプログラムを自動的に
生成できる。
[0004] At present, such high-level languages have been widely used, and application generators have been widely used as a means for more efficiently developing application programs in specific fields. The application generator can automatically generate a program described in a high-level language that satisfies the operation specifications by inputting the operation specification description of a program appropriate for a specific field in which the program generated by the generator is used.

【0005】アプリケーションジェネレータでは、特定
の分野に限定したプログラムの動作仕様の記述を行えば
良いので、汎用の高級言語に比較して簡便な方法で動作
仕様の記述を行うことができる利点がある。
The application generator only has to describe the operation specifications of a program limited to a specific field, and therefore has the advantage that the operation specifications can be described in a simpler method than in a general-purpose high-level language.

【0006】このアプリケーションジェネレータの代表
的なものに、例えばyaccがある。 yaccは、構文解析と
いう分野を対象にしたアプリケーションジェネレータで
ある。yaccでは、プログラムの動作仕様として、入力と
なる構文の文法と抽象構文木を生成するための動作とを
記述することにより自動的に構文解析器を生成すること
ができる。yaccの動作に関しては、エイホ/セシィ/ウル
マン著、" コンパイラI/II 原理・技法・ツール" サイ
エンス社に詳しい。
A typical application generator is yacc, for example. yacc is an application generator for the field of parsing. yacc can automatically generate a parser by describing the syntax of the input syntax and the operation for generating an abstract syntax tree as the operation specifications of the program. For more information on the operation of yacc, please refer to "Compiler I / II Principles, Techniques and Tools" by Aiho / Cessie / Ulman.

【0007】yaccは、構文解析器という特定の分野に限
定されたアプリケーションジェネレータであるが、さま
ざまな分野のプログラムを対象にアプリケーションジェ
ネレータを効率良く構築するためには、アプリケーショ
ンジェネレータの開発を支援するシステムないしは支援
方法が必要となる。
Although yacc is an application generator limited to a specific field called a parser, in order to efficiently construct an application generator for programs in various fields, a system for supporting the development of the application generator is required. Or a support method is needed.

【0008】近年、ドメイン指向言語(Domain Specifi
c Language)に基づくアプリケーション開発手法が用い
られている(文献「エンサイクロペディア電子情報通信
ハンドブック(オーム社,平成10年11月30日発
行)」の1083頁参照)。
In recent years, a domain-oriented language (Domain Specifi
c Language) is used (see p. 1083 of the document "Encyclopedia Electronic Information and Communication Handbook (Ohmsha, published on November 30, 1998)").

【0009】このドメイン指向言語では、分野を特定し
ない汎用のアプリケーションジェネレータを開発するた
めに、アプリケーションジェネレータ構築を支援する環
境をアプリケーションジェネレータ開発者に提供する。
This domain-oriented language provides an application generator developer with an environment for supporting application generator construction in order to develop a general-purpose application generator that does not specify a field.

【0010】したがって、アプリケーションジェネレー
タ開発者は、ドメイン指向言語を用いてアプリケーショ
ンジェネレータを開発することにより、さまざまな分野
のアプリケーションジェネレータを効率良く構築するこ
とができる。
Therefore, an application generator developer can efficiently construct application generators in various fields by developing an application generator using a domain-oriented language.

【0011】ここでは、ドメイン指向言語を用いたアプ
リケーションジェネレータ構築支援システムの例とし
て、文献「Rickard E.Faith著"KHEPERA" (USENIX The C
on-frence on Domain-Specific Languages Proceedings
243頁)」に記載の技術を説明する。なお、以下の説明
では、ドメイン指向言語を用いた開発支援装置をDSL
開発支援装置と称している。
[0011] Here, as an example of an application generator construction support system using a domain-oriented language, "KHEPERA" (USENIX The C
on-frence on Domain-Specific Languages Proceedings
243) ”). In the following description, a development support device using a domain-oriented language is called DSL.
It is called a development support device.

【0012】図28は、ドメイン指向言語を用いたアプ
リケーションジェネレータの構成ブロック図である。図
28において、字句解析仕様601と構文解析仕様60
2は、特定分野固有の仕様記述表現を決定することによ
り定められる。字句解析仕様601を字句解析器生成装
置603に与えて字句解析器プログラム605を生成す
る。また、構文解析仕様602を構文解析器生成装置6
04に与えて構文解析器プログラム606を生成する。
なお、字句解析器生成装置603には、lex(lexical a
nalyzer generator)が広く用いられ、また構文解析器
生成装置604には、yacc(yet another control char
t)が広く用いられている。
FIG. 28 is a configuration block diagram of an application generator using a domain-oriented language. In FIG. 28, the lexical analysis specification 601 and the syntax analysis specification 60
2 is determined by determining a specification description expression specific to a specific field. The lexical analyzer specification 601 is provided to the lexical analyzer generator 603 to generate a lexical analyzer program 605. In addition, the syntax analysis specification 602 is
04 to generate a parser program 606.
The lexical analyzer generator 603 includes lex (lexical a
nalyzer generator) is widely used, and the parser generator 604 includes yac (yet another control char).
t) is widely used.

【0013】これらの字句解析器生成装置603、構文
解析器生成装置604から生成される字句解析器プログ
ラム605、構文解析器プログ ラム606は、字句仕
様、構文仕様から生成される抽象構文の仕様を字句仕様
中、構文仕様中に記述し、字句解析、構文解析を行った
際の動作として、この抽象構文を出力する動作を記述す
る。
The lexical analyzer generator 603 and the lexical analyzer program 605 and the parser program 606 generated from the parser generator 604 are used to generate the lexical specifications and the abstract syntax specifications generated from the syntax specifications. In the lexical specification and the syntax specification, the operation of outputting this abstract syntax is described as the operation when performing lexical analysis and syntax analysis.

【0014】これらの動作の記述や抽象構文木の表現方
法に、関数型言語等で多く見られる厳密な型定義を可能
とする型構成子を用いたデータ型を積極的に利用すれば
記述力や保守性を向上させ得ることが広く知られてい
る。
In the description of these operations and in the method of expressing an abstract syntax tree, a data type using a type constructor which enables strict type definition, which is often found in functional languages, is actively used. It is widely known that it can improve the maintainability.

【0015】抽象構文木定義607は、前述の字句解析
器プログラム605、構文解析器プログラム606によ
って入力仕様の構文解析が行われ、その出力として得ら
れる入力仕様の抽象構文木の定義である。
An abstract syntax tree definition 607 is a definition of an abstract syntax tree of an input specification obtained by parsing an input specification by the lexical analyzer program 605 and the parser program 606 described above and obtaining an output thereof.

【0016】図28の例では、DSL開発支援装置61
0が、この抽象構文木定義607に変換規則609を繰
り返し適用する変換実行装置プログラム611を出力す
る。変換規則609は、抽象構文木に対してパターンマ
ッチを行い、 適合した抽象構文木を変換規則609に
記述された規則に沿って異なる抽象構文木への書き替え
を行い、最終的に出力プログラムとなる抽象構文木への
変換を行うプログラムである。
In the example of FIG. 28, the DSL development support device 61
0 outputs a conversion execution device program 611 for repeatedly applying the conversion rule 609 to the abstract syntax tree definition 607. The conversion rule 609 performs pattern matching on the abstract syntax tree, and rewrites the adapted abstract syntax tree into a different abstract syntax tree in accordance with the rules described in the conversion rule 609. This is a program that converts to an abstract syntax tree.

【0017】DSL開発支援装置610は、テキスト整
形規則608からテキスト整形装置プログラム612を
生成する。テキスト整形装置プログラム612は、与え
られた抽象構文を各抽象構文に対応したテキスト整形規
則に基づき整形を行う。即ち、出力プログラムの抽象構
文木は、テキスト整形装置プログラム612によって出
力プログラムに整形され出力される。
The DSL development support device 610 generates a text shaping device program 612 from the text shaping rules 608. The text shaping device program 612 shapes the given abstract syntax based on the text shaping rules corresponding to each abstract syntax. That is, the abstract syntax tree of the output program is shaped into an output program by the text shaping device program 612 and output.

【0018】テキスト整形の手法には、文献「Blashek
著"User-adaptable Prettyprinting"SOFTWARE PRACTICE
AND EXEPERIENCE,VOL19(7),687-702頁」に記載の技術
が公知である。
The text shaping technique is described in the document "Blashek
By "User-adaptable Prettyprinting" SOFTWARE PRACTICE
AND EXEPERIENCE, VOL19 (7), pp. 687-702 "is known.

【0019】また、DSL開発支援装置610は、ライ
ブラリプログラム613を出力する。このライブラリプ
ログラム613は、アプリケーションジェネレータ61
5の実行に必要なプログラムである。コンパイラ614
は、このライブラリプログラム613と、字句解析器プ
ログラム605と、構文解析器プログラム606と、変
換実行装置プログラム611と、テキスト整形装置プロ
グラム612とをコンパイルすることにより、実行可能
なアプリケーションジェネレータ615を作成する。
The DSL development support device 610 outputs a library program 613. This library program 613 is used for the application generator 61.
5 is a program necessary for execution. Compiler 614
Creates an executable application generator 615 by compiling the library program 613, the lexical analyzer program 605, the syntax analyzer program 606, the conversion execution device program 611, and the text shaping device program 612. .

【0020】[0020]

【発明が解決しようとする課題】 上述した従来の構成
には、次のような課題がある。第1の課題として、変換
規則中に現れる出力プログラムの断片が抽象構文木で表
現されるため、変換規則を抽象構文上で記述すると、ジ
ェネレータの生成する出力プログラムを変換規則中に直
接記述することができない。そのため、ジェネレータの
出力するプログラムの構造が理解しづらくなり、ジェネ
レータの開発効率並びに保守性が悪化する点が挙げられ
る。
The above-described conventional configuration has the following problems. First, since the fragments of the output program appearing in the conversion rules are represented by the abstract syntax tree, if the conversion rules are described in the abstract syntax, the output program generated by the generator must be described directly in the conversion rules. Can not. For this reason, it is difficult to understand the structure of the program output from the generator, and the development efficiency and maintainability of the generator deteriorate.

【0021】第2の課題として、変換規則中に現れる出
力プログラムの断片にテキスト整形規則を埋め込むこと
ができないため、出力プログラムの抽象構文木を作成す
る際に、出力の対象とするプログラム言語の構文を詳細
に検討し、各構文要素の定義を厳密におこない、それに
対応したテキスト整形規則を定義しなければならない。
そのため、ジェネレータの開発作業が煩雑になる点が挙
げられる。
As a second problem, since a text formatting rule cannot be embedded in a fragment of an output program appearing in a conversion rule, the syntax of a programming language to be output when an abstract syntax tree of the output program is created. Must be considered in detail, each syntax element must be strictly defined, and the corresponding text formatting rules must be defined.
Therefore, the development work of the generator is complicated.

【0022】第3の課題として、構文解析した結果を内
部表現へ変換する手順を開発者が記述しなくてはならな
い点が挙げられる。その理由は、従来の手法では、内部
表現への変換手順を自動生成する手段が無く、また厳密
な型定義を可能とする型構成子を用いた表現方法に基づ
いていないためである。
A third problem is that a developer must describe a procedure for converting a result of parsing into an internal expression. The reason is that, in the conventional method, there is no means for automatically generating a conversion procedure to the internal representation, and the method is not based on an expression method using a type constructor that enables strict type definition.

【0023】第4の課題として、抽象構文木の表現形式
を開発者が記述しなくてはならない点が挙げられる。そ
の理由は、従来の手法では、内部表現の形式を自動生成
する手段が無く、また厳密な型定義を可能とする型構成
子を用いた表現方法に基づいていないためである。
The fourth problem is that the developer must describe the expression format of the abstract syntax tree. The reason is that the conventional method has no means for automatically generating the format of the internal representation, and is not based on a representation method using a type constructor that enables strict type definition.

【0024】本発明の目的は、第1、第2の課題を解決
するため、変換規則中に直接出力される出力プログラム
の断片を記述可能な手段、並びに、出力時のテキスト整
形規則を埋め込む手段を備えるアプリケーションジェネ
レータ開発支援装置及びアプリケーションジェネレータ
開発支援方法を提供することにある。
In order to solve the first and second problems, an object of the present invention is a means capable of describing a fragment of an output program directly output in a conversion rule, and a means for embedding a text shaping rule at the time of output. An object of the present invention is to provide an application generator development support device and an application generator development support method including:

【0025】また本発明の他の目的は、第3、第4の課
題を解決するため、構文解析器の仕様から自動的に抽象
構文木を表現するための内部表現を表すデータ構造定義
を生成し、文法仕様から抽象構文木を自動生成する手段
を備えるアプリケーションジェネレータ開発支援装置及
びアプリケーションジェネレータ開発支援方法を提供す
ることにある。
Another object of the present invention is to generate a data structure definition representing an internal expression for automatically expressing an abstract syntax tree from the specification of a parser in order to solve the third and fourth problems. Another object of the present invention is to provide an application generator development support device and an application generator development support method including means for automatically generating an abstract syntax tree from a grammar specification.

【0026】[0026]

【課題を解決するための手段】請求項1に記載の発明に
係るアプリケーションジェネレータ開発支援装置は、ジ
ェネレータの動作仕様として与えられる字句解析仕様及
び文法仕様から字句解析器と構文解析器及び抽象構文木
のデータ構造とを生成し、ジェネレータ出力プログラム
の動作仕様を規定する入力仕様の構文解析結果を抽象構
文木のデータ構造を用いて表現した入力仕様抽象構文木
を生成する構文解析手段と、ジェネレータの動作仕様と
して与えられる変換規則定義中の出力プログラム断片記
述を変換規則に変換する変換規則処理手段と、前記入力
仕様抽象構文木を前記変換規則処理手段からの変換規則
に基づき実行し、実行結果をジェネレータ出力プログラ
ムとして出力する変換規則実行手段とを備えることを特
徴とする。
According to a first aspect of the present invention, there is provided an application generator development support apparatus comprising: a lexical analyzer, a parser, and an abstract syntax tree based on a lexical analysis specification and a grammatical specification given as an operation specification of a generator. A syntax analysis means for generating an input specification abstract syntax tree expressing a syntax analysis result of an input specification defining an operation specification of a generator output program by using a data structure of the abstract syntax tree; A conversion rule processing unit for converting an output program fragment description in a conversion rule definition given as an operation specification into a conversion rule; and executing the input specification abstract syntax tree based on the conversion rule from the conversion rule processing unit. And a conversion rule executing means for outputting as a generator output program.

【0027】請求項1に記載の発明によれば、構文解析
手段がジェネレータ動作仕様に基づき字句解析器、構文
解析器及び抽象構文木データ型を生成し、変換規則処理
手段がジェネレータ入力仕様に基づき出力プログラム断
片記述から、その出力プログラム断片記述をジェネレー
タ出力プログラムとして出力する変換規則を生成し、変
換規則実行手段がジェネレータ入力仕様を構文解析した
前記入力仕様抽象構文木を変換規則に基づき実行し、ジ
ェネレータ出力プログラムを出力する。
According to the first aspect of the present invention, the parsing means generates the lexical analyzer, the parser and the abstract syntax tree data type based on the generator operation specification, and the conversion rule processing means based on the generator input specification. From the output program fragment description, generate a conversion rule for outputting the output program fragment description as a generator output program, and execute the input specification abstract syntax tree obtained by parsing the generator input specification based on the conversion rule by the conversion rule execution means. Output the generator output program.

【0028】したがって、ある分野に適切なプログラム
の動作仕様を入力すると、その動作仕様を満たすプログ
ラムを自動的に生成できる。このとき、構文解析手段に
構文解析器を効率良く作成させることができ、変換規則
処理手段に変換規則の開発効率並びに保守性の向上を可
能にする措置を採らせることができる。
Therefore, when an operation specification of a program suitable for a certain field is input, a program satisfying the operation specification can be automatically generated. At this time, the parsing means can efficiently create a parser, and the conversion rule processing means can take measures for improving the conversion rule development efficiency and maintainability.

【0029】請求項2に記載の発明に係るアプリケーシ
ョンジェネレータ開発支援装置は、請求項1に記載のア
プリケーションジェネレータ開発支援装置において、前
記変換規則定義が、ジェネレータ変換規則と前記プログ
ラム断片記述とテキスト整形記述との組み合わせからな
り、前記変換規則処理手段が、前記変換規則定義中の出
力プログラム断片記述を抽出する手段と、前記テキスト
整形記述に対応するテキスト整形規則が格納される記憶
手段と、前記抽出した出力プログラム断片記述にテキス
ト整形記述が含まれているとき、前記記憶手段から取り
出したテキスト整形規則による解釈結果を前記抽出した
出力プログラム断片記述に記述する手段と、前記解釈結
果が記述された出力プログラム断片記述と等価な出力プ
ログラムを出力する変換規則を生成する手段とを備える
ことを特徴とする。
According to a second aspect of the present invention, in the application generator development supporting apparatus according to the first aspect, the conversion rule definition includes a generator conversion rule, the program fragment description, and a text formatting description. Wherein the conversion rule processing means extracts the output program fragment description in the conversion rule definition, storage means for storing a text formatting rule corresponding to the text formatting description, Means for describing, in the extracted output program fragment description, an interpretation result based on the text formatting rules extracted from the storage means when the output program fragment description includes a text formatting description, and an output program in which the interpretation result is described Output an output program equivalent to the fragment description Characterized in that it comprises a means for generating a conversion rule.

【0030】請求項2に記載の発明によれば、変換規則
定義から抽出した出力プログラム断片記述を、その出力
プログラム断片記述をジェネレータ出力プログラムとし
て出力させるための変換規則へ変換し、テキスト整形記
述が記述されているとき、テキスト整形記述を解釈し、
その出力プログラム断片記述並びにテキスト整形規則を
解釈した結果から、その出力プログラム断片記述をジェ
ネレータ出力プログラムとして出力させるための変換規
則へ変換する。
According to the second aspect of the present invention, the output program fragment description extracted from the conversion rule definition is converted into a conversion rule for outputting the output program fragment description as a generator output program. When described, interpret the text formatting description,
From the result of interpreting the output program fragment description and the text shaping rules, the output program fragment description is converted into a conversion rule for outputting the output program fragment description as a generator output program.

【0031】したがって、変換規則定義中のプログラム
の断片記述を出力結果であるジェネレータ出力プログラ
ムと同様に記述することができるので、変換規則の開発
効率並びに保守性を向上させることができる。
Therefore, since the fragment description of the program in the conversion rule definition can be described in the same manner as the generator output program as the output result, the efficiency of developing the conversion rule and the maintainability can be improved.

【0032】 請求項3に記載の発明に係るアプリケー
ションジェネレータ開発支援装置は、請求項1または請
求項2に記載のアプリケーションジェネレータ開発支援
装置において、前記構文解析手段が、文法仕様から、構
文解析器と、構文解析の結果得られる抽象構文木を表現
するための抽象構文木のデータ構造とを生成する手段と
して、記憶部と、前記文法仕様から非終端記号の情報を
取り出して各非終端記号の型名を決定し、型名決定済み
非終端記号の情報を前記記憶部に格納する手段と、前記
文法仕様からノードの情報を取り出し、構文木に組み入
れる必要のあるノードを選択し、選択したノード情報を
前記記憶部に格納する手段と、前記記憶部から決定され
た非終端記号の型名及び前記選択されたノード情報を取
り出し、それらに基づき各ノードの型を決定し、決定し
たノードの型を前記記憶部に格納する手段と、前記文法
仕様のルールに付随する値構成子と前記記憶部から取り
出した前記決定された非終端記号の型名及び前記決定し
たノードの型とに基づき非終端記号のデータ型を生成す
る手段と、前記文法仕様と前記生成した非終端記号のデ
ータ型と前記記憶部から取り出した前記選択されたノー
ド情報とに基づき抽象構文木を構築する動作を生成する
手段と、前記文法仕様と前記生成した非終端記号のデー
タ型と前記生成した抽象構文木を構築する動作とに基づ
き構文解析器を生成する手段と、前記生成した非終端記
号のデータ型に基づき抽象構文木データ型を出力する手
段とを備えることを特徴とする。
According to a third aspect of the present invention, there is provided the application generator development supporting apparatus according to the first or second aspect, wherein the parsing means includes: As a means for generating a data structure of an abstract syntax tree for expressing an abstract syntax tree obtained as a result of parsing, as a means for extracting a non-terminal symbol information from the storage unit and the grammar specification, Means for determining and storing information on the type-named non-terminal symbol in the storage unit, extracting node information from the grammar specification, selecting a node that needs to be incorporated in a syntax tree, and storing the selected node information in the storage unit Means for storing the nonterminal symbol determined from the storage unit and the selected node information, and Means for determining the type of each node, storing the determined node type in the storage unit, a value constructor associated with the rule of the grammar specification, and the type of the determined non-terminal symbol extracted from the storage unit Means for generating a data type of the non-terminal symbol based on the name and the type of the determined node; and, based on the grammar specification, the data type of the generated non-terminal symbol, and the selected node information extracted from the storage unit. Means for generating an operation for constructing an abstract syntax tree; means for generating a parser based on the grammar specification, the data type of the generated non-terminal symbol, and the operation for constructing the generated abstract syntax tree; Means for outputting an abstract syntax tree data type based on the data type of the non-terminal symbol.

【0033】請求項3に記載の発明によれば、記憶部
に、非終端記号の型名、構文木に組み入れる必要のある
ノード、そのノードの型を順々に記憶し、文法仕様と記
憶内容から、非終端記号のデータ型、抽象構文木を構築
する動作、構文解析器、抽象構文木データ型を順々に生
成する。
According to the third aspect of the present invention, the storage unit stores, in order, the type name of the non-terminal symbol, the node that needs to be incorporated in the syntax tree, and the type of the node. , A nonterminal symbol data type, an operation for constructing an abstract syntax tree, a parser, and an abstract syntax tree data type.

【0034】したがって、文法仕様を入力するだけで、
その文法に沿った入力仕様の抽象構文木を表現するため
のデータ構造と、データ構造を出力する構文解析木を自
動的に出力することができ、抽象構文木を表現するため
の内部表現を表すデータ構造定義を自動生成することで
きる。
Therefore, just by inputting the grammar specification,
It can automatically output a data structure for expressing the abstract syntax tree of the input specification according to the grammar, and a parse tree for outputting the data structure, and represents an internal representation for expressing the abstract syntax tree Data structure definitions can be automatically generated.

【0035】請求項4に記載の発明に係るアプリケーシ
ョンジェネレータ開発支援方法は、ジェネレータの動作
仕様として与えられる字句解析仕様及び文法仕様から字
句解析器と構文解析器及び抽象構文木のデータ構造とを
生成し、ジェネレータ出力プログラムの動作仕様を規定
する入力仕様の構文解析結果を抽象構文木のデータ構造
を用いて表現した入力仕様抽象構文木を生成する工程
と、ジェネレータの動作仕様として与えられる変換規則
定義中の出力プログラム断片記述を変換規則に変換する
工程と、前記入力仕様抽象構文木を前記変換規則処理手
段からの変換規則に基づき実行し、実行結果をジェネレ
ータ出力プログラムとして出力する工程とを備えること
を特徴とする。
According to a fourth aspect of the present invention, there is provided an application generator development supporting method, wherein a lexical analyzer, a parser, and a data structure of an abstract syntax tree are generated from a lexical analysis specification and a grammatical specification given as operation specifications of the generator. Generating an input specification abstract syntax tree in which the syntax analysis result of the input specification that defines the operation specification of the generator output program is represented using a data structure of the abstract syntax tree; and a conversion rule definition given as the operation specification of the generator. Converting the output program fragment description therein into a conversion rule, executing the input specification abstract syntax tree based on the conversion rule from the conversion rule processing means, and outputting an execution result as a generator output program. It is characterized by.

【0036】請求項5に記載の発明に係るアプリケーシ
ョンジェネレータ開発支援方法は、請求項1に記載のア
プリケーションジェネレータ開発支援方法において、前
記変換規則定義が、ジェネレータ変換規則と前記プログ
ラム断片記述とテキスト整形記述との組み合わせからな
り、前記変換規則に変換する工程が、前記変換規則定義
中の出力プログラム断片記述を抽出する手順と、前記抽
出した出力プログラム断片記述にテキスト整形記述が含
まれているとき、記憶手段から取り出したテキスト整形
規則による解釈結果を前記抽出した出力プログラム断片
記述に記述する手順と、前記解釈結果が記述された出力
プログラム断片記述と等価な出力プログラムを出力する
変換規則へ変換する手順とを備えることを特徴とする。
According to a fifth aspect of the present invention, in the application generator development supporting method according to the first aspect, the conversion rule definition includes a generator conversion rule, the program fragment description, and a text formatting description. Wherein the step of converting to the conversion rule includes a step of extracting an output program fragment description in the conversion rule definition, and a step of storing when the extracted output program fragment description includes a text formatting description. A procedure for describing an interpretation result by the text shaping rule extracted from the means in the extracted output program fragment description, and a procedure for converting the output program fragment description in which the interpretation result is described into a conversion rule for outputting an output program equivalent to the output program fragment description. It is characterized by having.

【0037】請求項6に記載の発明に係るアプリケーシ
ョンジェネレータ開発支援方法は、請求項1または請求
項2に記載のアプリケーションジェネレータ開発支援方
法において、前記文法仕様から、構文解析器と、構文解
析の結果得られる抽象構文木を表現するための抽象構文
木のデータ構造とを生成する手順として、前記文法仕様
から非終端記号の情報を取り出して各非終端記号の型名
を決定し、型名決定済み非終端記号の情報を記憶部に格
納する手順と、前記文法仕様からノードの情報を取り出
し、構文木に組み入れる必要のあるノードを選択し、選
択したノード情報を前記記憶部に格納する手順と、前記
記憶部から決定された非終端記号の型名及び前記選択さ
れたノード情報を取り出し、それらに基づき各ノードの
型を決定し、決定したノードの型を前記記憶部に格納す
る手順と、前記文法仕様のルールに付随する値構成子と
前記記憶部から取り出した前記決定された非終端記号の
型名及び前記決定したノードの型とに基づき非終端記号
のデータ型を生成する手順と、前記文法仕様と前記生成
した非終端記号のデータ型と前記記憶部から取り出した
前記選択されたノード情報とに基づき抽象構文木を構築
する動作を生成する手順と、前記文法仕様と前記生成し
た非終端記号のデータ型と前記生成した抽象構文木を構
築する動作とに基づき構文解析器を生成する手順と、前
記生成した非終端記号のデータ型に基づき抽象構文木デ
ータ型を出力する手順とを備えることを特徴とする。
According to a sixth aspect of the present invention, there is provided the application generator development supporting method according to the first or second aspect, wherein the grammar specification includes a parser and a parsing result. As a procedure for generating a data structure of the abstract syntax tree for expressing the obtained abstract syntax tree, the method extracts the information of the non-terminal symbols from the grammar specification, determines the type name of each non-terminal symbol, and determines the type name determined non-terminal symbol. Storing the node information from the grammar specification, selecting a node that needs to be included in the syntax tree, and storing the selected node information in the storage unit; and storing the selected node information in the storage unit. From the determined nonterminal symbol type and the selected node information, determine the type of each node based on them, and determine The procedure for storing the type of the node in the storage unit, the value constructor associated with the rule of the grammar specification, the type name of the determined non-terminal symbol extracted from the storage unit, and the type of the determined node. Generating a data type of a non-terminal symbol based on the grammar specification, a data type of the generated non-terminal symbol, and an operation of constructing an abstract syntax tree based on the selected node information extracted from the storage unit; A procedure for generating a parser based on the grammar specification, the data type of the generated non-terminal symbol, and an operation of constructing the generated abstract syntax tree; and an abstract syntax based on the data type of the generated non-terminal symbol. Outputting a tree data type.

【0038】[0038]

【発明の実施の形態】 以下、本発明の実施形態につい
て図面を参照して詳細に説明する。
Embodiments of the present invention will be described below in detail with reference to the drawings.

【0039】 図1は、本発明の実施形態に係るアプリ
ケーションジェネレータ開発支援装置の構成ブロック図
である。図1において、このアプリケーションジェネレ
ータ開発支援装置10は、当該アプリケーションジェネ
レータ開発支援装置10の動作仕様を与えるジェネレー
タ動作仕様20と、当該アプリケーションジェネレータ
開発支援装置10が出力するプログラムの動作仕様を与
えるジェネレータ入力仕様30とに基づきジェネレータ
出力プログラム40を生成出力するように構成される。
FIG. 1 is a configuration block diagram of an application generator development support device according to an embodiment of the present invention. In FIG. 1, the application generator development support device 10 includes a generator operation specification 20 for providing an operation specification of the application generator development support device 10 and a generator input specification for providing an operation specification of a program output by the application generator development support device 10. 30 to generate and output a generator output program 40.

【0040】アプリケーションジェネレータ開発支援装
置10は、構文解析手段101、変換規則処理手段10
2、変換規則実行手段103の3つの手段を備える。
The application generator development support device 10 includes a syntax analysis unit 101, a conversion rule processing unit 10
2. It has three means of conversion rule execution means 103.

【0041】構文解析手段101は、字句解析器生成手
段101aと、字句解析器生成手段101aが生成する
字句解析器101bと、構文解析器及び抽象構文木デー
タ型生成手段101cと、構文解析器及び抽象構文木デ
ータ型生成手段101cが生成する構文解析器101d
及び抽象構文データ型101eと、入力仕様抽象構文木
101fとで構成される。
The lexical analyzer 101 includes a lexical analyzer generator 101a, a lexical analyzer 101b generated by the lexical analyzer generator 101a, a parser and an abstract parse tree data type generator 101c, a lexical analyzer and Parser 101d generated by abstract syntax tree data type generator 101c
And an abstract syntax data type 101e and an input specification abstract syntax tree 101f.

【0042】 変換規則処理手段102は、ジェネレー
タ動作仕様読込手段102aと、出力プログラム断片記
述処理手段102bと、テキスト整形記述解釈手段10
2cと、テキスト整形規則記憶部102dと、出力プロ
グラム断片記述記憶部102eと、変換規則生成手段1
02fと、変換規則記憶部102gとで構成される。
The conversion rule processing means 102 includes a generator operation specification reading means 102a, an output program fragment description processing means 102b, and a text shaping description interpretation means 10
2c, a text formatting rule storage unit 102d, an output program fragment description storage unit 102e, and a conversion rule generation unit 1.
02f and a conversion rule storage unit 102g.

【0043】また、変換規則実行手段103は、変換規
則コンパイル手段103aと、実行コード記憶部103
bと、変換実行手段103cとで構成される。
The conversion rule executing means 103 includes a conversion rule compiling means 103a and an execution code storage section 103.
b and the conversion executing means 103c.

【0044】そして、ジェネレータ動作仕様20は、構
文規則定義201と、変換規則定義202とで構成され
る。
The generator operation specification 20 includes a syntax rule definition 201 and a conversion rule definition 202.

【0045】構文規則定義201は、アプリケーション
ジェネレータ開発支援装置10に入力される仕様記述の
字句定義に関わる、字句解析仕様201aと文法仕様2
01bとで構成される。
The syntax rule definition 201 includes a lexical analysis specification 201a and a grammar specification 2 related to the lexical definition of the specification description input to the application generator development support apparatus 10.
01b.

【0046】変換規則定義202は、アプリケーション
ジェネレータ開発支援装置10の動作仕様記述に関わ
る、ジェネレータ変換規則202aと、出力プログラム
断片記述202bと、テキスト整形記述202cとで構
成される。
The conversion rule definition 202 includes a generator conversion rule 202a, an output program fragment description 202b, and a text shaping description 202c related to the operation specification description of the application generator development support apparatus 10.

【0047】ここで、アプリケーションジェネレータ開
発支援装置10の各処理手段は、コンピュータ(CP
U)で実現され、記憶部は、半導体メモリや磁気ディス
ク装置等の記憶装置で構成される。そして、ジェネレー
タ動作仕様20やジェネレータ入力仕様30は、記憶装
置に格納される。
Here, each processing means of the application generator development support apparatus 10 is a computer (CP
U), and the storage unit is configured by a storage device such as a semiconductor memory or a magnetic disk device. Then, the generator operation specification 20 and the generator input specification 30 are stored in the storage device.

【0048】以下、本実施形態のアプリケーションジェ
ネレータ開発支援装置の動作について図1〜図18を参
照して詳細に説明する。なお、図2は、構文解析手段1
01の一部と変換規則処理手段102との動作フローチ
ャートである。図3は、構文解析手段101の一部と変
換規則実行手段103との動作フローチャートである。
Hereinafter, the operation of the application generator development support apparatus of the present embodiment will be described in detail with reference to FIGS. Note that FIG.
5 is an operation flowchart of a part of the conversion rule processing unit 102 of FIG. FIG. 3 is an operation flowchart of a part of the syntax analysis unit 101 and the conversion rule execution unit 103.

【0049】図4は、ジェネレータ動作仕様20の記述
文法を記述した図である。図5は、字句解析仕様201
aの記述文法を記述した図である。図6は、字句解析仕
様201aの記述文法の具体的な記述の図である。図7
は、文法仕様201bの文法記述を記述した図である。
図8は、文法仕様201bの記述文法の具体的な記述の
図である。
FIG. 4 is a diagram describing a description grammar of the generator operation specification 20. FIG. 5 shows a lexical analysis specification 201.
FIG. 4 is a diagram describing a description grammar of FIG. FIG. 6 is a diagram of a specific description of the description grammar of the lexical analysis specification 201a. FIG.
Is a diagram describing the grammar description of the grammar specification 201b.
FIG. 8 is a diagram of a specific description of the description grammar of the grammar specification 201b.

【0050】図9は、ジェネレータ変換規則202aの
記述文法を記述した図である。図10は、ジェネレータ
変換規則202aの記述文法の具体的な記述を示す図で
ある。図11は、出力プログラム断片記述202bの記
述文法を記述した図である。図12は、出力プログラム
断片記述202bの記述文法のうちのパターンを記述し
た図である。
FIG. 9 is a diagram describing the description grammar of the generator conversion rule 202a. FIG. 10 is a diagram showing a specific description of the description grammar of the generator conversion rule 202a. FIG. 11 is a diagram describing the description grammar of the output program fragment description 202b. FIG. 12 is a diagram describing a pattern in the description grammar of the output program fragment description 202b.

【0051】図13は、出力プログラム断片記述202
bの記述文法及びテキスト整形記述202cの具体的な
記述を示す図である。図14は、テキスト整形記述20
2cの例を示した図である。図15は、テキスト整形規
則記憶部102dに記憶されるテキスト整形規則の例を
示した図である。
FIG. 13 shows an output program fragment description 202.
FIG. 13 is a diagram showing a specific description of a description grammar of b and a text shaping description 202c. FIG. 14 shows a text format description 20
It is the figure which showed the example of 2c. FIG. 15 is a diagram illustrating an example of a text shaping rule stored in the text shaping rule storage unit 102d.

【0052】図16は、出力プログラム断片記述202
bの具体的な記述を示す図である。図17は、図16の
記述から生成された出力プログラムを示す図である。図
18は、変換規則生成手段102fが生成する変換規則
(抽出した出力プログラム断片記述と等価な出力プログ
ラムを出力する変換規則)の定義である。
FIG. 16 shows an output program fragment description 202.
It is a figure which shows the specific description of b. FIG. 17 is a diagram showing an output program generated from the description of FIG. FIG. 18 is a definition of a conversion rule (a conversion rule that outputs an output program equivalent to the extracted output program fragment description) generated by the conversion rule generation unit 102f.

【0053】まず、図2の動作フローチャートに沿って
構文解析手段101の一部と変換規則処理手段102と
の動作を説明する。図2において、S2〜S5は構文解
析手段101の動作、S6〜S14は変換規則処理手段
102の動作である。
First, the operation of a part of the syntax analysis means 101 and the conversion rule processing means 102 will be described with reference to the operation flowchart of FIG. In FIG. 2, S2 to S5 are operations of the syntax analysis unit 101, and S6 to S14 are operations of the conversion rule processing unit 102.

【0054】S1では、ジェネレータ動作仕様読込手段
102aが、ジェネレータ動作仕様20を記憶装置から
読み込み、その記述内容に応じて、字句解析器生成手段
101a、構文解析器及び抽象構文木データ型生成手段
101b、変換規則記憶部102g、出力プログラム断
片記述処理手段102bの対応する手段に与える(S
2,S4,S6,S8)。
In S1, the generator operation specification reading means 102a reads the generator operation specification 20 from the storage device and, in accordance with the content of the description, generates a lexical analyzer generator 101a, a syntax analyzer, and an abstract syntax tree data type generator 101b. To the corresponding units of the conversion rule storage unit 102g and the output program fragment description processing unit 102b (S
2, S4, S6, S8).

【0055】このジェネレータ動作仕様20は、図4に
示すような文法で記述される。図4において、仕様種類
とは、ジェネレータ動作仕様20を構成する、字句解析
仕様201a、文法仕様201b、ジェネレータ変換規
則202a、出力プログラム断片記述202b、テキス
ト整形記述202cを区別するための識別子である。こ
のように各仕様種類毎に名称を識別子として付加するこ
とにより、他の仕様定義からの参照が可能となる。
The generator operation specification 20 is described in a grammar as shown in FIG. In FIG. 4, the specification type is an identifier for distinguishing the lexical analysis specification 201a, the grammar specification 201b, the generator conversion rule 202a, the output program fragment description 202b, and the text formatting description 202c, which constitute the generator operation specification 20. In this way, by adding a name as an identifier for each specification type, reference from other specification definitions becomes possible.

【0056】S2では、ジェネレータ動作仕様読込手段
102aは、読み込んだジェネレータ動作仕様20が字
句解析仕様201aであると、それを字句解析器生成手
段101aに渡し、起動する。
In S2, if the read generator operation specification 20 is the lexical analysis specification 201a, the generator operation specification reading means 102a passes the lexical analysis specification 201a to the lexical analyzer generation means 101a and starts up.

【0057】この字句解析仕様201aは、図5に示す
ような文法で記述される。字句解析仕様201aでは、
後述する構文解析で用いるトークンの定義を正規表現を
用いて記述される。例えば、図6では識別子を表すトー
クンIDENTIFIERを正規表現を用いて記述し、calc_token
という名称で定義した例を示している。
The lexical analysis specification 201a is described by a grammar as shown in FIG. In the lexical analysis specification 201a,
The definition of the token used in the syntax analysis described later is described using a regular expression. For example, in FIG. 6, a token IDENTIFIER representing an identifier is described using a regular expression, and calc_token
The example defined by the name is shown.

【0058】字句解析器生成手段101aは、そのよう
な字句解析仕様201aに基づき字句解析器生成処理を
実行し、字句解析器101bの生成を行う(S3)。
The lexical analyzer generating means 101a executes lexical analyzer generating processing based on the lexical analysis specification 201a to generate the lexical analyzer 101b (S3).

【0059】なお、字句解析生成手段や字句解析器の動
作に関しては、文献「エイホ/セシィ/ウルマン著、"コ
ンパイラ I/II 原理・技法・ツール" サイ エンス社」
に詳しい。
The operation of the lexical analysis generating means and the lexical analyzer is described in "Aiho / Cessy / Ulman," Compiler I / II Principles, Techniques and Tools "Science, Inc."
Familiar with.

【0060】S4では、ジェネレータ動作仕様読込手段
102aは、読み込んだジェネレータ動作仕様101が
文法仕様201bであると、それを構文解析器及び抽象
構文木データ生成手段101cに渡し、起動する。
In S4, when the generator operation specification 101 that has been read is the grammar specification 201b, the generator operation specification reading means 102a passes it to the syntax analyzer and the abstract syntax tree data generation means 101c and starts up.

【0061】 この文法仕様201bは、図7に示すよ
うな文法で記述される。この文法仕様201bは、後述
する構文解析器生成装置(図19)が扱う文法仕様(図
21参照))と同じ形式で記述される。図8に文法仕様
の具体的記述例を示してある。図8の記述例では、簡単
な加減演算を行う文法仕様の記述文法の定義を行い、 c
alc_grammerという名称で定義している。
The grammar specification 201b is described by a grammar as shown in FIG. The grammar specification 201b is described in the same format as a grammar specification (see FIG. 21) handled by a parser generator (FIG. 19) described later. FIG. 8 shows a specific description example of the grammar specification. In the description example of FIG. 8, a description grammar of a grammar specification for performing a simple addition / subtraction operation is defined.
Defined under the name alc_grammer.

【0062】構文解析器及び抽象構文木データ生成手段
101cは、後述するようにしてこの文法仕様201b
に基づき構文解析器及び抽象構文木データ生成処理を実
行し、構文解析器101dと抽象構文木データ型102
1eを生成する(S5)。
The syntax analyzer and the abstract syntax tree data generating means 101c execute this grammar specification 201b as described later.
A parser and abstract syntax tree data generation processing are executed based on
1e is generated (S5).

【0063】S6では、ジェネレータ動作仕様読込手段
102aは、読み込んだジェネレータ動作仕様20がジ
ェネレータ変換規則202aであると、そのジェネレー
タ変換規則202aを変換規則コンパイル手段1023
aで処理できる内部表現に変換し、変換規則記憶部10
2gに格納する(S7)。
In S6, if the read generator operation specification 20 is the generator conversion rule 202a, the generator operation specification reading means 102a converts the generator conversion rule 202a into the conversion rule compilation means 1023.
a into an internal representation that can be processed by the
2g (S7).

【0064】ジェネレータ変換規則202aは、図9に
示すような文法で記述される。このジェネレータ変換規
則202aの記述方法は、本実施形態では、MLに準じ
た記述方法で記述する。なお、MLに関しては、文献
「 L.C. Paulson著 "ML forthe Working Programmer"
Cambridge University Press」に詳しい。
The generator conversion rule 202a is described by a grammar as shown in FIG. In this embodiment, the description method of the generator conversion rule 202a is described by a description method conforming to the ML. Regarding ML, refer to the document "ML for the Working Programmer" by LC Paulson.
Cambridge University Press ”.

【0065】図10では、具体的なジェネレータ変換規
則の定義として、図5〜図7に示すように記述された字
句解析仕様及び文法仕様に基づき構文解析器101dを
呼び出し、その結果得られた抽象構文木を変数specに束
縛し、関数generateを呼び出すことにより出力プログラ
ムの生成を行うという動作を記述している。
In FIG. 10, the syntax analyzer 101d is called based on the lexical analysis specifications and grammar specifications described as shown in FIGS. 5 to 7 as concrete definitions of the generator conversion rules. It describes the operation of binding the parse tree to the variable spec and generating the output program by calling the function generate.

【0066】このように記述されたジェネレータ変換規
則の記憶方法は、文献「Andrew W.Appel著 "Compiling
with Continuations" Cambridge University Press」に
詳しい。
The storage method of the generator conversion rules described in this manner is described in “Compiling by Andrew W. Appel”
with Continuations "Cambridge University Press".

【0067】S8では、ジェネレータ動作仕様読込手段
102aは、読み込んだジェネレータ動作仕様20が出
力プログラム断片記述202bであると、それを出力プ
ログラム断片記述処理手段102bに渡し、起動する。
In S8, if the read generator operation specification 20 is the output program fragment description 202b, the generator operation specification reading means 102a passes it to the output program fragment description processing means 102b and starts up.

【0068】出力プログラム断片記述202bは、当該
ジェネレータの出力するプログラムの一部を記述したも
のである。出力プログラム断片記述202bには、2種
類の記述を行うことができる。1つは、出力するプログ
ラムそのものの記述である。この場合には、出力される
プログラムのテキストイメージを直接記述して構わな
い。他の1つは、ジェネレータ入力仕様30から与えら
れる抽象構文木に記述された情報に基づき他のプログラ
ム断片の展開等を行うテキスト整形記述の記述である。
このテキスト整形記述には、字下げや改行の文字と、テ
キスト整形規則とがある。なお、これらの2種の記述
は、出力プログラム断片中に混在して記述することもで
きる。
The output program fragment description 202b describes a part of the program output from the generator. Two types of descriptions can be performed on the output program fragment description 202b. One is a description of the output program itself. In this case, the text image of the output program may be directly described. The other is a description of a text shaping description for expanding other program fragments based on the information described in the abstract syntax tree given from the generator input specification 30.
This text formatting description includes indentation and line feed characters and text formatting rules. Note that these two types of descriptions can be described together in an output program fragment.

【0069】この出力プログラム断片記述202bは、
図11に示すように、パターンの並びとして記述され
る。パターンは、図12に示すように、引数とプログラ
ム断片の並びとして記述される。図13は、C言語のma
in関数を出力するプログラムの断片を記述している。
The output program fragment description 202b is
As shown in FIG. 11, it is described as a sequence of patterns. The pattern is described as a sequence of arguments and program fragments, as shown in FIG. FIG. 13 shows ma of the C language.
Describes a program fragment that outputs the in function.

【0070】プログラム断片中に他のプログラム断片を
記述する際に行うテキスト整形記述は、例えば図13に
示すように記述できる。即ち、図13の例では、insert
というテキスト整形記述を行うことにより、main関数を
展開する際にinsertの部分に名称switch_outで指定され
た出力プログラム断片を埋め込むことを指定している。
A text shaping description to be described when describing another program fragment in a program fragment can be described, for example, as shown in FIG. That is, in the example of FIG.
Specifies that the output program fragment specified by the name switch_out is to be embedded in the insert part when the main function is expanded.

【0071】また、出力プログラム断片記述中のパター
ンの引数として渡される変数、即ち、図13中のbranch
esという変数で表される部分には、ジェネレータ入力仕
様30を構文解析器101dが構文解析した結果に抽象
構文木データ型101eを適用して得られる入力仕様抽
象構文木101fを、変換規則によって変換した結果が
渡される。
A variable passed as an argument of the pattern in the description of the output program fragment, that is, the branch in FIG.
In the part represented by the variable es, the input specification abstract syntax tree 101f obtained by applying the abstract syntax tree data type 101e to the result of parsing the generator input specification 30 by the syntax analyzer 101d is converted by a conversion rule. The result is passed.

【0072】したがって、パターンの引数として渡され
る変数branchesを出力プログラム断片に埋め込むことに
より、ジェネレータ入力仕様30に即したジェネレータ
出力プログラム40を得ることができる。
Therefore, a generator output program 40 conforming to the generator input specification 30 can be obtained by embedding the variable branches passed as an argument of the pattern in the output program fragment.

【0073】S9では、出力プログラム断片記述処理手
段102bは、受け取った出力プログラム断片記述20
2b中にテキスト整形記述202cがあるか否かを調べ
る。出力プログラム断片記述処理手段102bは、テキ
スト整形記述202cがなければ受け取った出力プログ
ラム断片記述202bを出力プログラム断片記述記憶部
102e記憶する(S10)。
In S9, the output program fragment description processing means 102b transmits the received output program fragment description 20
It is checked whether or not there is a text formatting description 202c in 2b. If there is no text shaping description 202c, the output program fragment description processing means 102b stores the received output program fragment description 202b in the output program fragment description storage unit 102e (S10).

【0074】一方、出力プログラム断片記述処理手段1
02bは、受け取った出力プログラム断片記述202b
中にテキスト整形記述202cがあると、それを取り出
し、テキスト整形記述202cの内容調べ(S11)、
まず、テキスト整形記述202cの字下げや改行の文字
についての処理を行い(S12)、その後変換規則の処
理をテキスト整形記述解釈手段102cに委ねる(S1
3〜S15)。
On the other hand, output program fragment description processing means 1
02b is the received output program fragment description 202b
If there is a text formatting description 202c therein, it is extracted and the contents of the text formatting description 202c are checked (S11).
First, processing for indentation and line feed characters of the text formatting description 202c is performed (S12), and then processing of the conversion rules is entrusted to the text formatting description interpreting means 102c (S1).
3-S15).

【0075】即ち、出力プログラム断片記述処理手段1
02bは、テキスト整形記述202cから字下げや改行
の文字を取り出し、その字下げや改行の位置情報を内部
記憶するとともに(S12)、その字下げや改行の文字
を出力プログラム断片記述記憶部102eに記憶する
(S10)。
That is, output program fragment description processing means 1
02b extracts indentation and line feed characters from the text formatting description 202c, internally stores the indentation and line feed position information (S12), and stores the indentation and line feed characters in the output program fragment description storage unit 102e. It is stored (S10).

【0076】そして、出力プログラム断片記述処理手段
102bは、字下げや改行の文字についての処理を終了
したテキスト整形記述202cをテキスト整形記述解釈
手段102cに渡す。これにより、テキスト整形記述解
釈手段102cは、S13〜S15の処理を行う。
Then, the output program fragment description processing means 102b passes the text shaping description 202c, which has completed the processing for indentation and line feed characters, to the text shaping description interpreting means 102c. Thereby, the text shaping description interpreting means 102c performs the processing of S13 to S15.

【0077】図14は、本実施形態で記述可能なテキス
ト整形記述の一覧を示す。また、テキスト整形規則記憶
部102dには、テキスト整形方法を記述したテキスト
整形規則が格納される。図15に一例を示してある。
FIG. 14 shows a list of text formatting descriptions that can be described in this embodiment. The text shaping rule storage unit 102d stores a text shaping rule describing a text shaping method. FIG. 15 shows an example.

【0078】テキスト整形記述202cは、テキスト整
形記述解釈手段102cがテキスト整形規則記憶部10
2dを検索する際に使用する。したがって、新たなテキ
スト整形記述が必要になった場合は、そのテキスト整形
記述に対応したテキスト整形規則をテキスト整形規則記
憶部102dに登録することにより自由に追加すること
が可能である。
The text shaping description 202c is stored in the text shaping rule storage unit 10c.
Used when searching for 2d. Therefore, when a new text shaping description is required, it is possible to freely add a text shaping rule corresponding to the text shaping description by registering the text shaping rule in the text shaping rule storage unit 102d.

【0079】テキスト整形記述解釈手段102cは、図
15に示されるようなテキスト整形規則をテキスト整形
規則記憶部1025dから検索し(S13)、テキスト
整形規則の各引数にテキスト整形記述202cの値を束
縛することにより、テキスト整形記述の解釈を行い(S
14)、解釈結果とS12で内部記憶した字下げや改行
の位置情報とに基づきテキスト整形を行うための情報を
付加した出力プログラム断片記述202bを生成し(S
15)、それを変換規則生成手段102fに渡す(S1
6)。
The text shaping description interpreting means 102c searches the text shaping rule storage unit 1025d for a text shaping rule as shown in FIG. 15 (S13), and binds the value of the text shaping description 202c to each argument of the text shaping rule. To interpret the text formatting description (S
14) Generate an output program fragment description 202b to which information for performing text shaping is added based on the interpretation result and the indentation and line feed position information internally stored in S12 (S12).
15) and passes it to the conversion rule generating means 102f (S1)
6).

【0080】変換規則生成手段102fは、出力プログ
ラム断片記述記憶部102eに記憶された、出力プログ
ラム断片記述、字下げや改行の文字、テキスト整形記述
解釈手段102cから取得したテキスト整形を行うため
の情報を付加した出力プログラム断片記述202bか
ら、それと等価な出力プログラムを得ることのできる変
換規則の生成を行い(S16)、生成した変換規則を変
換規則記憶部102gに格納する(S7)。
The conversion rule generating means 102f stores the output program fragment description, the characters for indentation and line feed, and the information for performing the text shaping obtained from the text shaping description interpreting means 102c stored in the output program fragment description storage unit 102e. Is generated from the output program fragment description 202b to which is added (S16), and the generated conversion rule is stored in the conversion rule storage unit 102g (S7).

【0081】なお、ここで言う変換規則は、従来技術の
項でも説明したが、入力として与えられる抽象構文木と
規則で定義された抽象構文木との間でパターンマッチを
行い、パターンマッチが成功した場合、規則に定義され
た出力となる抽象構文木に書き替えを行うプログラムで
ある。
As described in the section of the prior art, the conversion rule referred to here performs pattern matching between the abstract syntax tree given as input and the abstract syntax tree defined by the rule, and the pattern matching succeeds. In this case, the program rewrites the abstract syntax tree that is the output defined in the rule.

【0082】図16は、テキスト整形記述を用いて記述
したプログラム断片記述の例である。この例では、図1
3で示したinsert整形記述を用いて参照したプログラム
断片記述switch_outを定義している。プログラム断片記
述switch_outでは、C言語のswitch文を記述しており、
switch文の内部に引数branchesの各要素に対してC言語
のcase文を展開する記述を行っている。
FIG. 16 is an example of a program fragment description described using a text formatting description. In this example, FIG.
The program fragment description switch_out referenced using the insert format description shown in 3 is defined. In the program fragment description switch_out, a C language switch statement is described.
A description for expanding a C language case statement for each element of the argument branches is provided inside a switch statement.

【0083】図13の出力プログラム断片記述、図16
の出力プログラム断片記述に対して、[ "1" , "2" ]の
ような文字列のリストを入力し、ジェネレータ入力仕様
30を実行すると、図17に示すような字下げ等を考慮
した出力プログラム断片記述が、ジェネレ−タ出力プロ
グラム40として出力される。
Description of the output program fragment of FIG. 13, FIG.
When a list of character strings such as ["1", "2"] is input to the output program fragment description and the generator input specification 30 is executed, the output in consideration of indentation and the like as shown in FIG. The program fragment description is output as a generator output program 40.

【0084】 図18は、図16に示した出力プログラ
ム断片記述から生成した変換規則の記述例である。この
例では、テキスト整形記述のないプログラム断片記述
が、そのまま出力プログラム中に文字列として出力され
るようにする変換規則が示されている。また、テキスト
整形記述のあるプログラム断片記述が、テキスト整形規
則定義に記述されている字下げや改行の位置情報ととも
に、出力プログラム中に記述されるようにする変換規則
が示されている。
FIG. 18 is a description example of a conversion rule generated from the output program fragment description shown in FIG. In this example, a conversion rule is shown in which a program fragment description without a text formatting description is directly output as a character string in an output program. Also, a conversion rule is described so that a program fragment description having a text formatting description is described in an output program together with indentation and line feed position information described in the text formatting rule definition.

【0085】そして、S16では、以上のS1〜S16
までの処理を全てのジェネレータ動作仕様20に対して
実行する。その結果、構文解析手段101では、字句解
析器101b、構文解析器101d及び抽象構文木デー
タ型101eが生成され、変換規則処理手段101で
は、、変換規則記憶部102gには、ジェネレータ変換
規則202aの変換規則と出力プログラム断片記述20
2bの変換規則が逐一格納される。
Then, in S16, the above S1 to S16
Are executed for all the generator operation specifications 20. As a result, the syntax analysis unit 101 generates a lexical analyzer 101b, a syntax analyzer 101d, and an abstract syntax tree data type 101e, and the conversion rule processing unit 101 stores the generator conversion rule 202a in the conversion rule storage unit 102g. Conversion rule and output program fragment description 20
The conversion rule of 2b is stored one by one.

【0086】次に、図1、図3を参照して構文解析手段
101の一部と変換規則実行手段103の動作を説明す
る。図3において、S20〜S23までが構文解析手段
101の動作、S24〜S29までが変換規則実行手段
103の動作である。
Next, a part of the syntax analysis means 101 and the operation of the conversion rule execution means 103 will be described with reference to FIGS. In FIG. 3, S20 to S23 correspond to the operation of the syntax analysis unit 101, and S24 to S29 correspond to the operation of the conversion rule execution unit 103.

【0087】図1,図3において、構文解析手段101
では、ジェネレータ入力仕様30を読み込み(S2
0)、字句解析器101bがジェネレータ入力仕様30
の字句解析を行い(S21)、構文解析器101dが字
句解析結果を用いてジェネレータ入力仕様30の構文解
析を行う(S22)。そして、構文解析した入力仕様3
0の抽象構文木を抽象構文木データ型101dを用いた
内部表現である入力仕様抽象構文木101fで表現する
(S23)。
In FIG. 1 and FIG. 3, syntax analysis means 101
Then, the generator input specification 30 is read (S2
0), the lexical analyzer 101b uses the generator input specification 30
(S21), and the syntax analyzer 101d analyzes the syntax of the generator input specification 30 using the lexical analysis result (S22). And the input specification 3 that was parsed
The abstract syntax tree 0 is represented by an input specification abstract syntax tree 101f which is an internal representation using the abstract syntax tree data type 101d (S23).

【0088】次に、変換規則実行手段103では、変換
規則コンパイル手段103aが、入力仕様抽象構文木1
01fを実行コードにコンパイルする(S24)。ま
た、変換規則コンパイル手段103aは、変換規則記憶
部101gから変換に必要な変換規則を検索し、それを
実行可能な実行コードに変換する(S25、S26)。
Next, in the conversion rule executing means 103, the conversion rule compiling means 103a outputs the input specification abstract syntax tree 1
01f is compiled into an execution code (S24). Further, the conversion rule compiling means 103a searches the conversion rule storage unit 101g for a conversion rule required for conversion, and converts the conversion rule into an executable code (S25, S26).

【0089】 そして、変換規則コンパイル手段103
aは、S24で得られたジェネレータ入力仕様30に対
応する実行コードと、S26で得られたジェネレータ変
換規則202aや変化規則生成手段102fが生成した
変化規則に対応する実行コードとを実行コード記憶部1
03bに記憶する(S27)。
Then, the conversion rule compiling means 103
a is an execution code storage unit that stores the execution code corresponding to the generator input specification 30 obtained in S24 and the execution code corresponding to the generator conversion rule 202a and the change rule generated by the change rule generation unit 102f obtained in S26. 1
03b (S27).

【0090】なお、変換規則コンパイル手段103aに
関しては、前述した文献「Andrew W.Appel著 "Compilin
g with Continuations" Cambridge University Press」
に詳しい。
The conversion rule compiling means 103a is described in "Compilin by Andrew W. Appel" mentioned above.
g with Continuations "Cambridge University Press"
Familiar with.

【0091】次いで、変換実行手段103cが、実行コ
ード記憶部103bに記憶された実行コードを用いてジ
ェネレータ入力仕様30を変換し、その変換結果をジェ
ネレータ出力プログラム40として出力する(S28、
S29)。
Next, the conversion execution means 103c converts the generator input specification 30 using the execution code stored in the execution code storage section 103b, and outputs the conversion result as a generator output program 40 (S28,
S29).

【0092】次に、図19は、本発明の実施形態に係る
構文解析器生成装置の構成ブロック図である。この構文
解析器生成装置は、図1における、構文解析器及び抽象
構文木データ型生成手段101c,構文解析器101
d、抽象構文木データ型101eの全体に対応する。
Next, FIG. 19 is a block diagram showing the configuration of a parser generator according to the embodiment of the present invention. The parser generating apparatus includes a parser and an abstract parser tree data type generating unit 101c and a parser 101 shown in FIG.
d, corresponding to the entire abstract syntax tree data type 101e.

【0093】図19において、この構文解析器生成装置
は、プログラム制御により動作するデータ処理装置50
1と、情報を記憶する記憶装置502とを備え、入力さ
れる文法仕様503から、抽象構文木データ型504及
び構文解析器505を自動的に出力するように構成され
る。
Referring to FIG. 19, this parser generating apparatus is a data processing apparatus 50 operated under program control.
1 and a storage device 502 for storing information, and are configured to automatically output an abstract syntax tree data type 504 and a parser 505 from an input grammar specification 503.

【0094】データ処理装置501は、文法記述読込手
段5011と、非終端記号型名決定手段5012と、要
素選択手段5013と、各ノード型決定手段5014
と、非終端記号データ型生成手段5015と、構文木構
築動作生成手段5016と、構文解析器生成手段501
7と、抽象構文木データ型出力手段5018とを備え
る。これらの手段は、コンピュータ(CPU)により実
現される。
The data processing device 501 includes a grammar description reading unit 5011, a non-terminal symbol type name determining unit 5012, an element selecting unit 5013, and each node type determining unit 5014.
Non-terminal symbol data type generation means 5015, syntax tree construction operation generation means 5016, and syntax analyzer generation means 501
7 and an abstract syntax tree data type output unit 5018. These means are realized by a computer (CPU).

【0095】記憶装置502は、文法情報記憶部502
1と、抽象構文木データ型記憶部5022とを備える。
記憶装置502は、半導体メモリや磁気ディスク装置等
である。なお、文法情報記憶部5021には、文法記述
の内部表現や、非終端記号の型名や、選択されたノード
やその型などが記憶される。また、抽象構文木データ型
記憶部5022には、抽象構文木データ型が記憶され
る。
The storage device 502 includes a grammar information storage unit 502
1 and an abstract syntax tree data type storage unit 5022.
The storage device 502 is a semiconductor memory, a magnetic disk device, or the like. The grammar information storage unit 5021 stores the internal representation of the grammar description, the type name of the non-terminal symbol, the selected node and its type, and the like. The abstract syntax tree data type storage unit 5022 stores an abstract syntax tree data type.

【0096】次に、以上のように構成される本実施形態
の構文解析器生成装置の動作を図19〜図27を参照し
て詳細に説明する。なお、図20は、構文解析器生成装
置の動作フローチャートである。図21は、文法規則の
記述方法を具体例で示した図である。図22は、文法規
則中に記述することのできる構文木の種類を示した図で
ある。図23は、文法記述の例を示す図である。図24
は、図23の文法で記述された入力の例を示す図であ
る。図25は、図24の入力を内部表現で表した例を示
す図である。図26は、図25の内部表現から生成され
たデータ型を示す図である。図27は、図25の内部表
現に動作を付加した図である。
Next, the operation of the parser generator of the present embodiment configured as described above will be described in detail with reference to FIGS. FIG. 20 is an operation flowchart of the parser generator. FIG. 21 is a diagram showing a specific example of a description method of a grammar rule. FIG. 22 is a diagram showing types of syntax trees that can be described in the grammar rules. FIG. 23 is a diagram illustrating an example of a grammar description. FIG.
FIG. 24 is a diagram showing an example of an input described in the grammar of FIG. FIG. 25 is a diagram showing an example in which the input of FIG. 24 is represented by an internal expression. FIG. 26 is a diagram showing a data type generated from the internal representation of FIG. FIG. 27 is a diagram in which an operation is added to the internal representation of FIG.

【0097】まず、文法仕様503について説明する。
本実施形態で対象となる文法記述は、これから示すBN
F文法(以下「BNF1」という)により記述される。
BNF1は、図21に示すように、ルールの集合からな
る。ルールは、そのルールで定義される非終端記号の1
つと1つ以上のブランチとから構成される。各ブランチ
は、値構成子名と、0 個以上のノードの列とからなる。
First, the grammar specification 503 will be described.
The grammar description to be used in the present embodiment is BN described below.
It is described by F grammar (hereinafter, referred to as “BNF1”).
BNF1 is composed of a set of rules, as shown in FIG. A rule is one of the nonterminal symbols defined in the rule.
And one or more branches. Each branch consists of a value constructor name and a sequence of zero or more nodes.

【0098】このうち、各ブランチの先頭に記述される
値構成子名は、本実施形態の手法(以下「本手法」とい
う)で利用するBNF1特有の要素である。即ち、この
値構成子名は、抽象構文木用のデータ型を自動的に生成
する際の値構成子の名前として利用される。
Of these, the value constructor name described at the head of each branch is a BNF1 specific element used in the method of the present embodiment (hereinafter referred to as “the present method”). That is, the value constructor name is used as a value constructor name when automatically generating a data type for the abstract syntax tree.

【0099】ノードの列は、一般的なBNF文法であれ
ば必ず持っている要素である。このノードの列は、その
ルールが表す非終端記号がどういった文法要素に展開さ
れるかを示している。各ノードは、図22の表で1〜7
に示す7つのいずれかである。
The node column is an element that is always possessed in a general BNF grammar. This column of nodes indicates what grammatical element the nonterminal symbol represented by the rule is expanded to. Each node is 1 to 7 in the table of FIG.
Any of the seven listed below.

【0100】このうち、1のトークンと2の非終端記号
は、一般的なBNF文法には必ず存在する要素である。
1のトークンは、構文解析の最小単位であるトークンを
意味する。2の非終端記号は、他のルールによって定義
される非終端記号を意味する。3,4,5のノードは、
BNF文法によっては存在する要素で、対象となるノー
ドの繰り返しや、そのノードが出現するかどうかを意味
する。
Of these, one token and two non-terminal symbols are elements that always exist in a general BNF grammar.
A token of 1 means a token which is the minimum unit for parsing. A non-terminal symbol of 2 means a non-terminal symbol defined by another rule. Nodes 3, 4, and 5 are
An element that exists depending on the BNF grammar, and indicates whether the target node is repeated or whether that node appears.

【0101】また、6,7のノードにおけるデリミタと
は、ノードが2回以上繰り返される場合に各要素の間に
デリミタに対応するノードが挟まることを意味する。こ
の6,7のノードにおけるデリミタの記法は、本手法特
有の要素である。
The delimiter in the nodes 6 and 7 means that when the node is repeated two or more times, a node corresponding to the delimiter is interposed between the elements. The notation of the delimiter in the nodes 6 and 7 is an element unique to the present method.

【0102】なお、以下の説明で利用している、:: = |
< > [ ] * +、等の記号は、他の記号と置き換えても
本手法は、適用することができる。
Note that, in the following description, :: = |
This method can be applied even if symbols such as <> [] * + are replaced with other symbols.

【0103】また、本手法で使用するBNF1文法のう
ち、図22中の3〜7の各ノドは、必ずしも一般的なB
NFではないが、このリスト表現の使用を一部または全
部制限しても本手法は、適用できる。
In the BNF1 grammar used in the present method, each of the nodes 3 to 7 in FIG.
Although not NF, this technique can be applied even if the use of this list expression is partially or entirely restricted.

【0104】なお、文法情報記憶部5021には、初期
状態においては、文法自体に関する情報は格納されてお
らず、構文解析前の字句解析段階に関する情報のみが入
っている。字句解析段階に関する情報とは、識別子や文
字列、整数といったトークンの種類、それらのトークン
の型などである。
In the initial state, the grammar information storage unit 5021 does not store information on the grammar itself, but stores only information on the lexical analysis stage before the syntax analysis. The information on the lexical analysis stage includes the types of tokens such as identifiers, character strings, and integers, and the types of those tokens.

【0105】以下、図20の動作フローチャートに沿っ
て説明する。S31では、文法仕様503として与えら
れる文法記述が、文法記述読込手段5011に供給され
る。この文法記述は、例えば、図23、図24に示すよ
うになっている。図23は、図21で示した文法に基づ
く文法記述例である。図24は、図23の文法で記述し
た入力例である。
The operation will be described below with reference to the operation flowchart of FIG. In S31, the grammar description given as the grammar specification 503 is supplied to the grammar description reading unit 5011. This grammar description is, for example, as shown in FIGS. FIG. 23 is a grammar description example based on the grammar shown in FIG. FIG. 24 is an input example described in the grammar of FIG.

【0106】文法記述読込手段5011は、この文法記
述をデータ処理装置501内で扱える内部表現(図2
5)へ変換し、文法情報記憶部5021へ格納する。な
お、この時点での内部表現は、図25に含まれる情報の
うち、型名と、各ノードの情報内の選択か非選択かのラ
ベルと、型の情報とは含んでいない。これらの要素は、
以降の手順で導き出される。この内部表現に関しては、
データ処理装置で扱える形であればどのようなものでも
構わない。
The grammar description reading means 5011 has an internal representation (FIG. 2) which can handle this grammar description in the data processing device 501.
5) and stored in the grammar information storage unit 5021. The internal representation at this time does not include the type name, the label of selection or non-selection in the information of each node, and the type information among the information included in FIG. These elements are
It is derived in the following steps. Regarding this internal representation,
Any form can be used as long as it can be handled by the data processing device.

【0107】S32では、非終端記号型名決定手段50
12が、文法情報記憶部5021に格納されている文法
の内部表現(図25)の各ルールから非終端記号名を取
り出し、その非終端記号名に文字列"Type"を付けてその
ルールの型名とし、文法情報記憶部5021に格納す
る。この時点で、図25における型名の情報が付加され
たことになる。ここで、各非終端記号の型の名前は、非
終端記号ごとに一意であればどんなものでもかまわな
い。一例として、非終端記号の名前そのものでもよい。
In S32, the non-terminal symbol type name determining means 50
12 extracts a non-terminal symbol name from each rule of the internal representation of the grammar (FIG. 25) stored in the grammar information storage unit 5021, attaches a character string "Type" to the non-terminal symbol name, and sets it as a type name of the rule. , Stored in the grammar information storage unit 5021. At this point, the type name information in FIG. 25 has been added. Here, the name of the type of each non-terminal symbol may be anything as long as it is unique for each non-terminal symbol. As an example, the name of the non-terminal symbol itself may be used.

【0108】S33では、要素選択手段5013が、文
法情報記憶部5021に格納されている内部表現(図2
5)からノードに関する情報を取り出し、構文木に組み
入れる必要のある(即ち構文解析後に保持する必要のあ
る)ノードを選択し、どのノードが選択されたかという
ノードの情報を文法情報記憶部5021へ格納する。
In S33, the element selecting means 5013 uses the internal expression (FIG. 2) stored in the grammar information storage unit 5021.
The information about the node is extracted from 5), a node that needs to be incorporated into the syntax tree (that is, a node that needs to be retained after the syntax analysis) is selected, and information on the selected node is stored in the grammar information storage unit 5021. I do.

【0109】ここで、構文木に組み入れる必要のあるノ
ードとは、そのノードの表す内容が可変であるノードで
ある。内容が可変であるノードとは、例えば非終端記号
や文字列トークンなどである。現在扱っている図23の
例では、Arg(非終端記号)やINTEGER(整数を表すトーク
ン)などがそれにあたる。
Here, a node that needs to be incorporated into the syntax tree is a node whose contents are variable. The node whose content is variable is, for example, a non-terminal symbol or a character string token. In the example of FIG. 23 currently being handled, Arg (a non-terminal symbol), INTEGER (a token representing an integer), and the like correspond thereto.

【0110】内容が可変でないノードとは、内容が変化
しないトークンであり、例えばキーワードやカッコその
他、文法上の区切りのために存在するようなトークンの
ノードなどである。現在扱っている図24の例では、"
+"や"{"、などがそれにあたる。
A node whose content is not variable is a token whose content does not change, such as a keyword, a parenthesis, or a token node that exists for grammatical delimitation. In the example of FIG.
+ "And"{", and so on.

【0111】そして、文法情報記憶部5021に格納さ
れている内部表現のうち、必要と判定されたノードには
選択というラベルを付け、不必要とされたノードには非
選択というラベルを付ける。この時点で、 図25にお
ける選択、非選択情報が付加されたことになる。ただ
し、ここでいう「必要なノード」の基準は、変更しても
本手法の適用は可能である。例えば、すべてのノードを
必要とすることにしてもよい。
Then, among the internal expressions stored in the grammatical information storage unit 5021, nodes determined to be necessary are labeled as selection, and unnecessary nodes are labeled as non-selection. At this point, the selection / non-selection information in FIG. 25 has been added. However, the method of the present invention can be applied even if the criteria of “necessary nodes” here are changed. For example, all nodes may be required.

【0112】S34では、各ノード型決定手段5014
が、文法情報記憶部5021から各非終端記号の型名及
び選択されたノードの情報を取り出し、それらの情報か
ら選択された各ノードの型を決定し、その情報を文法情
報記憶部5021に格納する。
In S34, each node type determining means 5014
Extracts the type name of each non-terminal symbol and information on the selected node from the grammar information storage unit 5021, determines the type of each selected node from the information, and stores the information in the grammar information storage unit 5021. .

【0113】この決定は、各ノードの種類に基づき行わ
れる。図22において、対象となるノードが1のトーク
ンの場合は、そのトークン自身の型とする。一例とし
て、整数を表すトークンなら整数型、文字列を表すトー
クンなら文字列型、などである。2の非終端記号の場合
は、S32で付けた非終端記号の名前を持つ型として定
義する。
This decision is made based on the type of each node. In FIG. 22, when the target node is one token, the type of the token itself is used. As an example, a token representing an integer is an integer type, and a token representing a character string is a string type. In the case of the non-terminal symbol of 2, it is defined as a type having the name of the non-terminal symbol added in S32.

【0114】型の実体はこの時点では定義されていない
が、後の手順で定義されるので、名前で対応がとれれば
よい。3、4,5,6、7の場合は、内包するノードの
型のリスト型とする。これに従い選択されたノードすべ
ての型を決定する。
Although the entity of the type is not defined at this time, it is defined in a later procedure, so that it is sufficient that correspondence is established by name. In the case of 3, 4, 5, 6, and 7, it is a list type of the types of the included nodes. According to this, the types of all the selected nodes are determined.

【0115】例えば、図25において、ルール3のブラ
ンチ1のノード1のトークンINTEGERは、整数を表すの
で、int型となる。 非終端記号の場合は、その非終端記
号を定義しているルールの型名を持つ型となる。例えば
ルール1のブランチ1,2のノード2は、非終端記号Ar
gであり、Argを定義しているルール2を参照すると型名
は、ArgTypeとなっている。
For example, in FIG. 25, the token INTEGER of the node 1 of the branch 1 of the rule 3 is an int type because it represents an integer. In the case of a non-terminal symbol, the type has the type name of the rule that defines the non-terminal symbol. For example, the node 2 of the branch 1 or 2 of the rule 1 is a non-terminal symbol Ar
g, and referring to Rule 2 that defines Arg, the type name is ArgType.

【0116】 したがって、型は、ArgTypeとなる。同
じ非終端記号でも、'['']'、で囲まれているノードの場
合は、その非終端記号を定義しているルールの型名の型
をリスト型にしたものとなる。
Therefore, the type is ArgType. In the case of a node enclosed by '['']', the same non-terminal symbol is a list type with the type name of the rule defining the non-terminal symbol.

【0117】例えば、ルール2のブランチ1のノード2
は、[ AtExpr; "," ]+、となっているので、 型は、AtE
xpType listとなる。
For example, node 2 of branch 1 of rule 2
Is [AtExpr; ","] +, so the type is AtE
xpType list.

【0118】 以下同様に選択されているノードの型を
付けていき、その情報を文法情報記憶部5021の内部
表現(図25)に格納する。この時点で、図25におけ
る各ノードに付いている型の情報が付加されたことにな
る。
In the same manner, the type of the selected node is assigned, and the information is stored in the internal expression (FIG. 25) of the grammar information storage unit 5021. At this point, the type information attached to each node in FIG. 25 has been added.

【0119】 S35では、非終端記号データ型生成手
段5015が、文法情報記憶部5021から、文法の内
部表現(図25)のルールに付随する値構成子の情報を
取り出し、さらに各非終端記号の型名及び各ノードの型
の情報を取り出し、それらの情報に基づいてそのルール
で定義されている非終端記号のデータ型を生成する。
In S35, the non-terminal symbol data type generation unit 5015 extracts information of a value constructor associated with the rule of the internal expression of the grammar (FIG. 25) from the grammatical information storage unit 5021, and further extracts the type name of each non-terminal symbol. And the information of the type of each node is extracted, and the data type of the non-terminal symbol defined by the rule is generated based on the information.

【0120】このデータ型は、データ型名を非終端記号
型名決定手段5012が付けた名前とし、取り出した値
構成子を持つ型となる。各値構成子に付随する型は、S
34で各ノード型決定手段5014が決定したノードの
型を組にしたものとなる。
This data type is a type having a data type name as the name assigned by the non-terminal symbol type name determining means 5012 and having a value constructor taken out. The type associated with each value constructor is S
At 34, the type of the node determined by each node type determining means 5014 is a set.

【0121】換言すれば、生成されるデータ型において
は、型名がデータ型の名前となり、各ブランチの値構成
子名がそのデータ型の持つ値構成子となり、各ブランチ
中の選択されているノードの型がその値構成子に付随す
る型となる。
In other words, in the data type to be generated, the type name becomes the name of the data type, the value constructor name of each branch becomes the value constructor of the data type, and is selected in each branch. The type of the node is the type attached to its value constructor.

【0122】このように生成した非終端記号のデータ型
が抽象構文木のデータ型となる。生成したデータ型を抽
象構文木データ型記憶部5022に格納する。現在扱っ
ている例の場合、生成されるデータ型は図26のように
なる。
The data type of the non-terminal symbol thus generated is the data type of the abstract syntax tree. The generated data type is stored in the abstract syntax tree data type storage unit 5022. In the case of the present example, the generated data type is as shown in FIG.

【0123】S36では、抽象構文木構築動作生成手段
5016が、文法情報記憶部5021から文法の内部表
現及び選択されたノードの情報を、抽象構文木データ型
記憶部5022から抽象構文木のデータ型をそれぞれ取
り出し、抽象構文木を構築する動作を生成する。
In S36, the abstract syntax tree construction operation generating means 5016 stores the internal expression of the grammar and the information of the selected node from the grammatical information storage unit 5021 and the data type of the abstract syntax tree from the abstract syntax tree data type storage unit 5022. , Respectively, and generate an operation for constructing an abstract syntax tree.

【0124】本手法で定義する非終端記号のデータ型
は、各ノードの型を反映したものであるため、生成する
抽象構文木構築の動作は、各ノードの内容を組にし、値
構成子に適用する動作であり、対応する内容をその部分
に埋め込むものとなる。
Since the data type of the non-terminal symbol defined by the present method reflects the type of each node, the operation of constructing the abstract syntax tree to be generated is performed by combining the contents of each node as a set and applying it to the value constructor. This is an operation to embed the corresponding content in that part.

【0125】例えば、ノードの型がlist型である場合
は、その部分に相当する要素をリスト化したものをノー
ドの値とする。現在扱っている例では、ここで定義する
動作が生成すべきブランチの値は、図27に示すような
ものとなる。ただし、図27中の各ブランチにおいて、
各ノード(番号)の内容を$(番号)としている。
For example, when the type of a node is a list type, a list of elements corresponding to that part is used as a node value. In the example currently being dealt with, the value of the branch to be generated by the operation defined here is as shown in FIG. However, in each branch in FIG.
The content of each node (number) is $ (number).

【0126】S37では、構文解析器生成手段5017
が、文法情報記憶部5021から文法の情報を、抽象構
文木データ型記憶部5022から抽象構文木のデータ型
を、それぞれ取り出し、抽象構文木構築動作生成手段5
016から抽象構文木を構築する動作を受け取り、それ
らの情報から構文解析器505を生成する。
In S37, the parser generating means 5017
Extracts the grammar information from the grammar information storage unit 5021 and the data type of the abstract syntax tree from the abstract syntax tree data type storage unit 5022, respectively.
An operation for constructing an abstract syntax tree is received from 016, and a parser 505 is generated from the information.

【0127】なお、文法、抽象構文木のデータ型、抽象
構文木を構築する動作の3つをもとに構文解析器を生成
する手法については、従来の手法と同様である。
The method of generating a parser based on the grammar, the data type of the abstract syntax tree, and the operation of constructing the abstract syntax tree is the same as the conventional method.

【0128】S38では、構文解析器生成手段5017
が生成した構文解析器505を出力する。
In S38, the parser generating means 5017
Output the generated parser 505.

【0129】また、S39では、抽象構文木データ型出
力手段5018が、抽象構文木データ型記憶部5022
から抽象構文木のデータ構造を取り出し、抽象構文木デ
ータ型504として出力する。
In S39, the abstract syntax tree data type output unit 5018 outputs the abstract syntax tree data type storage unit 5022.
, And extracts the data structure of the abstract syntax tree as an abstract syntax tree data type 504.

【0130】その結果、図1におけるジェネレータ入力
仕様30の構文解析において、構文解析器505(10
1d)の解析結果と抽象構文木データ型504(101
e)とから内部表現である入力仕様抽象構文木101f
が自動的に生成される。
As a result, in the syntax analysis of the generator input specification 30 in FIG. 1, the syntax analyzer 505 (10
1d) and the abstract syntax tree data type 504 (101
e) Input specification abstract syntax tree 101f which is an internal representation
Is automatically generated.

【0131】なお、本実施形態で生成される抽象構文木
データ型504は、多相型を持つ厳密な型システムを持
つデータ型を実現している代表的な言語であるMLを対
象とするものである。MLに関する文献は、先に紹介し
た。
Note that the abstract syntax tree data type 504 generated in the present embodiment targets ML which is a typical language that realizes a data type having a strict type system having a polymorphic type. It is. The literature on ML has been introduced earlier.

【0132】[0132]

【発明の効果】以上詳述したように、本発明によれば、
ジェネレータ動作仕様である変換規則定義中に記述する
プログラム断片を、ジェネレータが出力する出力プログ
ラムの断片と同様に記述でき、またジェネレータ動作仕
様である文法仕様から自動的に構文解析器並びにジェネ
レータ入力仕様を表す抽象構文木データ型定義を生成で
きるので、アプリケーションジェネレータの開発を効率
よく行うことが可能となる。
As described in detail above, according to the present invention,
The program fragment described in the conversion rule definition, which is the generator operation specification, can be described in the same way as the output program fragment output by the generator, and the parser and generator input specification can be automatically converted from the grammar specification, which is the generator operation specification. Since the abstract syntax tree data type definition to be represented can be generated, the application generator can be efficiently developed.

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

【図1】本発明の実施形態に係るアプリケーションジェ
ネレータ開発支援装置の構成ブロック図である。
FIG. 1 is a configuration block diagram of an application generator development support device according to an embodiment of the present invention.

【図2】構文解析手段の一部と変換規則処理手段との動
作フローチャートである。
FIG. 2 is an operation flowchart of a part of a syntax analysis unit and a conversion rule processing unit.

【図3】構文解析手段の一部と変換規則実行手段との動
作フローチャートである。
FIG. 3 is an operation flowchart of a part of the syntax analysis unit and a conversion rule execution unit.

【図4】ジェネレータ動作仕様の記述文法を記述した図
である。
FIG. 4 is a diagram describing a description grammar of a generator operation specification.

【図5】字句解析仕様の記述文法を記述した図である。FIG. 5 is a diagram describing a description grammar of a lexical analysis specification.

【図6】字句解析仕様の記述文法の具体的な記述の図で
ある。
FIG. 6 is a diagram of a specific description of a description grammar of a lexical analysis specification.

【図7】文法仕様の記述文法を記述した図である。FIG. 7 is a diagram describing a description grammar of a grammar specification.

【図8】文法仕様の記述文法の具体的な記述の図であ
る。
FIG. 8 is a diagram of a specific description of a description grammar of a grammar specification.

【図9】ジェネレータ変換規則の記述文法を記述した図
である。
FIG. 9 is a diagram describing a description grammar of a generator conversion rule.

【図10】ジェネレータ変換規則の記述文法の具体的な
記述を示す図である
FIG. 10 is a diagram showing a specific description of a description grammar of a generator conversion rule.

【図11】出力プログラム断片記述の記述文法を記述し
た図である。
FIG. 11 is a diagram describing a description grammar of an output program fragment description.

【図12】出力プログラム断片記述の記述文法のうちの
パターンを記述した図である。
FIG. 12 is a diagram describing a pattern in a description grammar of an output program fragment description.

【図13】出力プログラム断片記述の記述文法及びテキ
スト整形記述の具体的な記述示す図である。
FIG. 13 is a diagram showing a specific description of a description grammar and a text formatting description of an output program fragment description.

【図14】テキスト整形記述の例を示した図である。FIG. 14 is a diagram showing an example of a text formatting description.

【図15】テキスト整形規則記憶部に記憶されるテキス
ト整形規則の例を示した図である。
FIG. 15 is a diagram illustrating an example of a text shaping rule stored in a text shaping rule storage unit.

【図16】テキスト整形記述を用いて記述した出力プロ
グラム断片記述の具体的な記述の図である。
FIG. 16 is a diagram of a specific description of an output program fragment description described using a text formatting description.

【図17】図16の記述から生成された出力プログラム
の図である。
FIG. 17 is a diagram of an output program generated from the description of FIG. 16;

【図18】変換規則生成手段が生成する変換規則(抽出
した出力プログラム断片記述から生成した、その出力プ
ログラム断片記述をジェネレータ出力プログラムとして
出力できるようにする変換規則)の定義である。
FIG. 18 is a definition of a conversion rule (a conversion rule generated from an extracted output program fragment description and enabling the output program fragment description to be output as a generator output program) generated by the conversion rule generation means.

【図19】実施形態の構文解析器生成装置の構成ブロッ
ク図である。
FIG. 19 is a configuration block diagram of a parser generation device of the embodiment.

【図20】構文解析器生成装置の動作フローチャートで
ある。
FIG. 20 is an operation flowchart of the parser generator.

【図21】文法規則の記述方法を具体例で示した図であ
る。
FIG. 21 is a diagram showing a specific example of a description method of a grammar rule.

【図22】文法規則中に記述することのできる構文木の
種類を示した図である。
FIG. 22 is a diagram showing types of syntax trees that can be described in a grammar rule.

【図23】文法記述の例を示す図である。FIG. 23 is a diagram illustrating an example of a grammar description.

【図24】図24の文法で記述された入力の例を示す図
である。
FIG. 24 is a diagram showing an example of an input described in the grammar of FIG. 24;

【図25】図25の入力を内部表現で表した例を示す図
である。
FIG. 25 is a diagram showing an example in which the input of FIG. 25 is represented by an internal expression.

【図26】図26の内部表現から生成されたデータ型を
示す図である。
FIG. 26 is a diagram showing a data type generated from the internal representation of FIG. 26.

【図27】図26の内部表現に動作を付加した図であ
る。
FIG. 27 is a diagram in which an operation is added to the internal representation of FIG. 26;

【図28】従来のアプリケーションジェネレータ開発支
援装置の構成ブロック図である。
FIG. 28 is a configuration block diagram of a conventional application generator development support device.

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

10 アプリケーションジェネレータ開発支援装置 20 ジェネレータ動作仕様 30 ジェネレータ入力仕様 40 ジェネレータ出力プログラム 101 構文解析手段 101a 字句解析器生成手段 101b 字句解析器 101c 構文解析器及び抽象器データ型生成手段 101d、504 抽象構文木データ型 101e、505 構文解析器 101f 入力仕様抽象構文木 102 変換規則処理手段 102a ジェネレータ動作仕様読込手段 102b 出力プログラム断片処理手段 102c テキスト整形記述解釈手段 102d テキスト整形規則記憶部 102e 出力プログラム断片記述記憶部 102f 変換規則生成手段 102g 変換規則記憶部 103 変換規則実行手段 103a 変換規則コンパイル手段 103b 実行コード記憶部 103c 変換実行手段 201 構文規則定義 201a 字句解析仕様 201b、503 文法仕様 202 変換規則定義 202a ジェネレータ変換規則 202b 出力プログラム断片記述 202c テキスト整形記述 501 データ処理装置 502 記憶装置 5011 文法記述読込手段 5012 非終端記号名決定手段 5013 要素選択手段 5014 各ノード型決定手段 5015 非終端記号データ型生成手段 5016 抽象構文木構築動作生成手段 5017 構文解析器生成手段 5018 抽象構文木データ型出力手段 5021 文法情報記憶部 5022 抽象構文木データ型記憶部 DESCRIPTION OF SYMBOLS 10 Application generator development support apparatus 20 Generator operation specification 30 Generator input specification 40 Generator output program 101 Syntax analyzer 101a Lexical analyzer generator 101b Lexical analyzer 101c Parser and abstracter data type generator 101d, 504 Abstract syntax tree data Type 101e, 505 Syntax analyzer 101f Input specification abstract syntax tree 102 Conversion rule processing means 102a Generator operation specification reading means 102b Output program fragment processing means 102c Text format description interpreter 102d Text format rule storage unit 102e Output program fragment description storage unit 102f Conversion rule generation unit 102g Conversion rule storage unit 103 Conversion rule execution unit 103a Conversion rule compilation unit 103b Execution code storage unit 103c Modification Execution means 201 Syntax rule definition 201a Lexical analysis specification 201b, 503 Grammar specification 202 Conversion rule definition 202a Generator conversion rule 202b Output program fragment description 202c Text formatting description 501 Data processing device 502 Storage device 5011 Grammar description reading means 5012 Nonterminal symbol name determining means 5013 element selection means 5014 each node type determination means 5015 non-terminal symbol data type generation means 5016 abstract syntax tree construction operation generation means 5017 syntax analyzer generation means 5018 abstract syntax tree data type output means 5021 grammar information storage unit 5022 abstract syntax tree data type Memory

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 ジェネレータの動作仕様として与えられ
る字句解析仕様及び文法仕様から字句解析器と構文解析
器及び抽象構文木のデータ構造とを生成し、ジェネレー
タ出力プログラムの動作仕様を規定する入力仕様の構文
解析結果を抽象構文木のデータ構造を用いて表現した入
力仕様抽象構文木を生成する構文解析手段と、 ジェネレータの動作仕様として与えられる変換規則定義
中の出力プログラム断片記述を変換規則に変換する変換
規則処理手段と、 前記入力仕様抽象構文木を前記変換規則処理手段からの
変換規則に基づき実行し、実行結果をジェネレータ出力
プログラムとして出力する変換規則実行手段とを備える
ことを特徴とするアプリケーションジェネレータ開発支
援装置。
1. A lexical analyzer, a parser, and a data structure of an abstract syntax tree are generated from a lexical analysis specification and a grammar specification given as an operation specification of a generator, and an input specification that defines an operation specification of a generator output program is generated. Input specification expressing the syntax analysis result using the data structure of the abstract syntax tree Syntax analysis means for generating an abstract syntax tree, and converting the output program fragment description in the conversion rule definition given as the operation specification of the generator into a conversion rule An application generator comprising: a conversion rule processing unit; and a conversion rule execution unit that executes the input specification abstract syntax tree based on the conversion rule from the conversion rule processing unit and outputs an execution result as a generator output program. Development support equipment.
【請求項2】 請求項1に記載のアプリケーションジェ
ネレータ開発支援装置において、 前記変換規則定義が、ジェネレータ変換規則と前記プロ
グラム断片記述とテキスト整形記述との組み合わせから
なり、 前記変換規則処理手段が、 前記変換規則定義中の出力プログラム断片記述を抽出す
る手段と、 前記テキスト整形記述に対応するテキスト整形規則が格
納される記憶手段と、 前記抽出した出力プログラム断片記述にテキスト整形記
述が含まれているとき、前記記憶手段から取り出したテ
キスト整形規則による解釈結果を前記抽出した出力プロ
グラム断片記述に記述する手段と、 前記解釈結果が記述された出力プログラム断片記述と等
価な出力プログラムを出力する変換規則を生成する手段
とを備えることを特徴とするアプリケーションジェネレ
ータ開発支援装置。
2. The application generator development support device according to claim 1, wherein the conversion rule definition comprises a combination of a generator conversion rule, the program fragment description, and a text formatting description. Means for extracting the output program fragment description in the conversion rule definition; storage means for storing a text formatting rule corresponding to the text formatting description; and when the extracted output program fragment description includes a text formatting description Means for describing, in the extracted output program fragment description, the result of interpretation based on the text formatting rules extracted from the storage means, and generating a conversion rule for outputting an output program equivalent to the output program fragment description in which the interpretation result is described. Characterized by comprising means for performing Generator development support equipment.
【請求項3】 請求項1または請求項2に記載のアプリ
ケーションジェネレータ開発支援装置において、 前記構文解析手段が、文法仕様から、構文解析器と、構
文解析の結果得られる抽象構文木を表現するための抽象
構文木のデータ構造とを生成する手段として、記憶部
と、 前記文法仕様から非終端記号の情報を取り出して各非終
端記号の型名を決定し、型名決定済み非終端記号の情報
を前記記憶部に格納する手段と、 前記文法仕様からノードの情報を取り出し、構文木に組
み入れる必要のあるノードを選択し、選択したノード情
報を前記記憶部に格納する手段と、 前記記憶部から決定された非終端記号の型名及び前記選
択されたノード情報を取り出し、それらに基づき各ノー
ドの型を決定し、決定したノードの型を前記記憶部に格
納する手段と、 前記文法仕様のルールに付随する値構成子と前記記憶部
から取り出した前記決定された非終端記号の型名及び前
記決定したノードの型とに基づき非終端記号のデータ型
を生成する手段と、 前記文法仕様と前記生成した非終端記号のデータ型と前
記記憶部から取り出した前記選択されたノード情報とに
基づき抽象構文木を構築する動作を生成する手段と、 前記文法仕様と前記生成した非終端記号のデータ型と前
記生成した抽象構文木を構築する動作とに基づき構文解
析器を生成する手段と、 前記生成した非終端記号のデータ型に基づき抽象構文木
データ型を出力する手段とを備えることを特徴とするア
プリケーションジェネレータ開発支援装置。
3. The application generator development support device according to claim 1, wherein the syntax analysis unit is configured to express a syntax analyzer and an abstract syntax tree obtained as a result of the syntax analysis from a grammar specification. As a means for generating a data structure of an abstract syntax tree of: a storage unit, extracting information of non-terminal symbols from the grammar specification, determining a type name of each non-terminal symbol, and storing the information of the type-name determined non-terminal symbol in the storage unit. Means for storing the node information from the grammar specification, selecting a node that needs to be incorporated into the syntax tree, and storing the selected node information in the storage unit; and The type name of the non-terminal symbol and the selected node information are taken out, the type of each node is determined based on them, and the determined node type is stored in the storage unit. Means for generating a data type of a non-terminal symbol based on a value constructor associated with a rule of the grammar specification, a type name of the determined non-terminal symbol retrieved from the storage unit, and a type of the determined node. Means for generating an operation for constructing an abstract syntax tree based on the grammar specification, the data type of the generated non-terminal symbol, and the selected node information retrieved from the storage unit, and the grammar specification and the generated non-terminal Means for generating a parser based on the data type of the symbol and the operation of constructing the generated abstract syntax tree; and means for outputting an abstract syntax tree data type based on the data type of the generated non-terminal symbol Application generator development support device characterized by the following.
【請求項4】 ジェネレータの動作仕様として与えられ
る字句解析仕様及び文法仕様から字句解析器と構文解析
器及び抽象構文木のデータ構造とを生成し、ジェネレー
タ出力プログラムの動作仕様を規定する入力仕様の構文
解析結果を抽象構文木のデータ構造を用いて表現した入
力仕様抽象構文木を生成する工程と、 ジェネレータの動作仕様として与えられる変換規則定義
中の出力プログラム断片記述を変換規則に変換する工程
と、 前記入力仕様抽象構文木を前記変換規則処理手段からの
変換規則に基づき実行し、実行結果をジェネレータ出力
プログラムとして出力する工程とを備えることを特徴と
するアプリケーションジェネレータ開発支援方法。
4. A lexical analyzer, a parser, and a data structure of an abstract syntax tree are generated from a lexical analysis specification and a grammatical specification given as an operation specification of a generator, and an input specification that defines an operation specification of a generator output program is generated. A step of generating an input specification abstract syntax tree expressing a syntax analysis result using a data structure of the abstract syntax tree; and a step of converting an output program fragment description in a conversion rule definition given as an operation specification of a generator into a conversion rule. Executing the input specification abstract syntax tree based on a conversion rule from the conversion rule processing means, and outputting an execution result as a generator output program.
【請求項5】 請求項1に記載のアプリケーションジェ
ネレータ開発支援方法において、 前記変換規則定義が、ジェネレータ変換規則と前記プロ
グラム断片記述とテキスト整形記述との組み合わせから
なり、 前記変換規則に変換する工程が、 前記変換規則定義中の出力プログラム断片記述を抽出す
る手順と、 前記抽出した出力プログラム断片記述にテキスト整形記
述が含まれているとき、記憶手段から取り出したテキス
ト整形規則による解釈結果を前記抽出した出力プログラ
ム断片記述に記述する手順と、 前記解釈結果が記述された出力プログラム断片記述と等
価な出力プログラムを出力する変換規則へ変換する手順
とを備えることを特徴とするアプリケーションジェネレ
ータ開発支援方法。
5. The application generator development supporting method according to claim 1, wherein the conversion rule definition comprises a combination of a generator conversion rule, the program fragment description, and a text formatting description. Extracting the output program fragment description in the conversion rule definition; and, when the extracted output program fragment description includes a text formatting description, extracting the interpretation result by the text formatting rule extracted from the storage unit. An application generator development support method, comprising: a procedure to be described in an output program fragment description; and a procedure to convert to a conversion rule that outputs an output program equivalent to the output program fragment description in which the interpretation result is described.
【請求項6】 請求項1または請求項2に記載のアプリ
ケーションジェネレータ開発支援方法において、 前記文法仕様から、構文解析器と、構文解析の結果得ら
れる抽象構文木を表現するための抽象構文木のデータ構
造とを生成する手順として、 前記文法仕様から非終端記号の情報を取り出して各非終
端記号の型名を決定し、型名決定済み非終端記号の情報
を記憶部に格納する手順と、 前記文法仕様からノードの情報を取り出し、構文木に組
み入れる必要のあるノードを選択し、選択したノード情
報を前記記憶部に格納する手順と、 前記記憶部から決定された非終端記号の型名及び前記選
択されたノード情報を取り出し、それらに基づき各ノー
ドの型を決定し、決定したノードの型を前記記憶部に格
納する手順と、 前記文法仕様のルールに付随する値構成子と前記記憶部
から取り出した前記決定された非終端記号の型名及び前
記決定したノードの型とに基づき非終端記号のデータ型
を生成する手順と、 前記文法仕様と前記生成した非終端記号のデータ型と前
記記憶部から取り出した前記選択されたノード情報とに
基づき抽象構文木を構築する動作を生成する手順と、 前記文法仕様と前記生成した非終端記号のデータ型と前
記生成した抽象構文木を構築する動作とに基づき構文解
析器を生成する手順と、 前記生成した非終端記号のデータ型に基づき抽象構文木
データ型を出力する手順とを備えることを特徴とするア
プリケーションジェネレータ開発支援方法。
6. The application generator development supporting method according to claim 1, wherein a syntax analyzer and an abstract syntax tree for expressing an abstract syntax tree obtained as a result of the syntax analysis are obtained from the grammar specification. A procedure for extracting the non-terminal symbol information from the grammar specification, determining a type name of each non-terminal symbol, and storing the information on the type name determined non-terminal symbol in a storage unit as a procedure for generating a data structure; and A procedure for extracting the node information from the node, selecting a node that needs to be incorporated in the syntax tree, and storing the selected node information in the storage unit; and a type name of the non-terminal symbol determined from the storage unit and the selected A step of extracting node information, determining a type of each node based on the node information, and storing the determined node type in the storage unit; A procedure for generating a data type of a non-terminal symbol based on an associated value constructor, the type name of the determined non-terminal symbol extracted from the storage unit, and the determined node type; and the grammar specification and the generated non-terminal Generating an operation for constructing an abstract syntax tree based on a data type of a symbol and the selected node information extracted from the storage unit; a grammar specification, a data type of the generated non-terminal symbol, and the generated abstract An application generator development method comprising: a step of generating a parser based on an operation of constructing a syntax tree; and a step of outputting an abstract syntax tree data type based on the data type of the generated non-terminal symbol. .
JP11178031A 1999-06-24 1999-06-24 Device and method for aiding development of application generator Pending JP2001005655A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP11178031A JP2001005655A (en) 1999-06-24 1999-06-24 Device and method for aiding development of application generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP11178031A JP2001005655A (en) 1999-06-24 1999-06-24 Device and method for aiding development of application generator

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2004129526A Division JP2004246924A (en) 2004-04-26 2004-04-26 Application generator development support device and application generator development support method

Publications (1)

Publication Number Publication Date
JP2001005655A true JP2001005655A (en) 2001-01-12

Family

ID=16041389

Family Applications (1)

Application Number Title Priority Date Filing Date
JP11178031A Pending JP2001005655A (en) 1999-06-24 1999-06-24 Device and method for aiding development of application generator

Country Status (1)

Country Link
JP (1) JP2001005655A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100460645B1 (en) * 2002-09-13 2004-12-08 유티스타콤코리아 유한회사 Method for automatically packing message in wcdma asynchronous system
CN111639501A (en) * 2020-05-04 2020-09-08 国网浙江省电力有限公司 Power grid service micro-service combination method based on AMSL

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100460645B1 (en) * 2002-09-13 2004-12-08 유티스타콤코리아 유한회사 Method for automatically packing message in wcdma asynchronous system
CN111639501A (en) * 2020-05-04 2020-09-08 国网浙江省电力有限公司 Power grid service micro-service combination method based on AMSL

Similar Documents

Publication Publication Date Title
Hutton Higher-order functions for parsing
KR101099212B1 (en) An intermediate representation for multiple exception handling models
Wile Abstract syntax from concrete syntax
US7823139B2 (en) Method and system for translating programming languages
US20020019973A1 (en) Compiler and method for compiling easily adaptable to processor specifications
JP2004295398A (en) Compiler, method for compiling and program developing tool
Miecznikowski et al. Decompiling Java using staged encapsulation
US20120167065A1 (en) Compiler compiler system with syntax-controlled runtime and binary application programming interfaces
JP2006243838A (en) Program development device
JPH0762825B2 (en) Code generation method and apparatus
US20080141230A1 (en) Scope-Constrained Specification Of Features In A Programming Language
GB2366402A (en) Syntax validation using syntax trees
KR102614967B1 (en) Automation system and method for extracting intermediate representation based semantics of javascript
JP2001005655A (en) Device and method for aiding development of application generator
Cervelle et al. Tatoo: an innovative parser generator
GB2420638A (en) Method of substituting code fragments in Internal Representation
JPH11296359A (en) Program development support tool
JP2004246924A (en) Application generator development support device and application generator development support method
Wang et al. Ompparser: A standalone and unified OpenMP parser
JPH0756745A (en) Compiler processing system for language processing program
JP3194372B2 (en) Parser generator preprocessor system, preprocessing method for parser generator
JPH10154079A (en) Program conversion device and storage medium
JPH08272622A (en) Program conversion device
JP2000132405A (en) In-line expansion processing device and method
Fritzson Modelica Meta-Programming and Symbolic Transformations MetaModelica Programming Guide

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20031209

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040209

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20040302

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20040401

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20040426

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20040401

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20040511

A912 Removal of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A912

Effective date: 20040625

RD01 Notification of change of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7421

Effective date: 20050311