JP5399601B2 - Implementation code development system and implementation code development program - Google Patents

Implementation code development system and implementation code development program Download PDF

Info

Publication number
JP5399601B2
JP5399601B2 JP2005160427A JP2005160427A JP5399601B2 JP 5399601 B2 JP5399601 B2 JP 5399601B2 JP 2005160427 A JP2005160427 A JP 2005160427A JP 2005160427 A JP2005160427 A JP 2005160427A JP 5399601 B2 JP5399601 B2 JP 5399601B2
Authority
JP
Japan
Prior art keywords
class
source code
code
hot spot
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2005160427A
Other languages
Japanese (ja)
Other versions
JP2006338190A (en
Inventor
聡 石田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 JP2005160427A priority Critical patent/JP5399601B2/en
Publication of JP2006338190A publication Critical patent/JP2006338190A/en
Application granted granted Critical
Publication of JP5399601B2 publication Critical patent/JP5399601B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、フレームワークのホットスポットを実装する技術に関する。特に、本発明は、フレームワークのホットスポットを実装するホットスポット実装コードを開発するためのシステム及びプログラムに関する。   The present invention relates to a technique for mounting a hot spot of a framework. In particular, the present invention relates to a system and program for developing a hot spot mounting code for mounting a framework hot spot.

システムやソフトウェアを開発する際、開発効率を向上させるために「フレームワーク」がしばしば利用される。フレームワークとは、特定のアーキテクチャに基づいて実装されたできあいの半完成のシステムのことである。このフレームワークに、プラグインとして作成される特定のソフトウェア部品をはめ込むことにより、所望のシステムを効率的に構築することが可能である。   When developing systems and software, a “framework” is often used to improve development efficiency. A framework is a semi-finished system that is implemented based on a specific architecture. By inserting specific software components created as plug-ins into this framework, it is possible to efficiently construct a desired system.

フレームワークにおいて、今後の変更が起こらないと分析される部分は「フローズンスポット」と呼ばれる。このフローズンスポットの実装は、フレームワークの開発者によって行われる。一方、新たな要求の発生が予想される部分は「ホットスポット(可変部分)」と呼ばれる。このホットスポットの実装は、フレームワークの使用者によって行われる。つまり、フレームワークの使用者は、ホットスポットの変更に応じたプラグインを開発し、そのプラグインを用いてホットスポットを実装する。   The part of the framework that is analyzed if no future changes occur is called the “frozen spot”. The implementation of this frozen spot is done by the framework developer. On the other hand, a portion where a new request is expected to occur is called a “hot spot (variable portion)”. This hot spot is implemented by the user of the framework. That is, the user of the framework develops a plug-in according to the change of the hot spot, and implements the hot spot using the plug-in.

オブジェクト指向によるフレームワークの場合、ホットスポットには、そのフレームワークが提供する抽象クラス(インターフェース)が用意される。そのホットスポットの実装を行うためには、その抽象クラスを継承するサブクラスがプラグインとして用意されればよい。つまり、ホットスポットに適合するサブクラスが規定されたコードが開発され、そのコードがホットスポットに適用されればよい。以下、このコードは、「ホットスポット実装コード」と参照される。   In the case of an object-oriented framework, an abstract class (interface) provided by the framework is prepared in the hot spot. In order to implement the hot spot, a subclass that inherits the abstract class may be prepared as a plug-in. That is, a code in which a subclass suitable for a hot spot is defined is developed, and the code may be applied to the hot spot. Hereinafter, this code is referred to as a “hot spot mounting code”.

フレームワークを利用した開発では、フレームワーク自体(フローズンスポット)の実装言語と同じ言語を利用して、ホットスポット実装コードを開発する必要がある。このことは、システムの開発効率の低下を招く可能性がある。例えば、複雑な行列計算処理でホットスポットを実装する必要があり、その行列計算コード(ホットスポット実装コード)をJava(登録商標)言語により開発する必要がある場合を考える。行列計算の例として「E=AB+CD」を考える。この場合、開発者は、次のようなJava(登録商標)コードを記述する必要がある。   In the development using the framework, it is necessary to develop the hot spot implementation code by using the same language as the implementation language of the framework itself (frozen spot). This may lead to a reduction in system development efficiency. For example, consider a case where a hot spot needs to be implemented by a complicated matrix calculation process, and the matrix calculation code (hot spot implementation code) needs to be developed in the Java (registered trademark) language. As an example of matrix calculation, consider “E = AB + CD”. In this case, the developer needs to write the following Java (registered trademark) code.

E = A.multiply(B).add(C.multiply(D))   E = A. multiply (B). add (C. multiply (D))

Java(登録商標)言語は、演算子のオーバーロードをサポートしていないため、“メソッド呼び出し”という形式を用いて行列計算を記述せざるを得ない。そのために、上記行列計算コードの可読性は良好ではなく、保守性も低下してしまう。また、Java(登録商標)の標準ライブラリには行列クラスが含まれていないため、開発者は、適当な行列クラスを作成するか、適当な数値計算パッケージを入手する必要がある。   Since the Java (registered trademark) language does not support operator overloading, the matrix calculation must be described using a method called “method call”. Therefore, the readability of the matrix calculation code is not good and the maintainability is also lowered. In addition, since the standard library of Java (registered trademark) does not include a matrix class, the developer needs to create an appropriate matrix class or obtain an appropriate numerical calculation package.

一方、科学や工学で必要とされる数値や数式計算をサポートする記述性に優れたプログラミング言語も存在する。そのようなプログラミング言語の1つとして、MatLabが挙げられる。MatLabで記述されるプログラムファイルの拡張子は“.m”であるため、MatLabファイルは「Mファイル」と呼ばれる場合もある。このMatLabを用いる場合、上述の行列計算(E=AB+CD)は、次のように記述される。   On the other hand, there are programming languages with excellent descriptiveness that support numerical and mathematical calculations required in science and engineering. One such programming language is MatLab. Since the extension of a program file described in MatLab is “.m”, the MatLab file may be called “M file”. When this MatLab is used, the above matrix calculation (E = AB + CD) is described as follows.

E = A * B + C * D   E = A * B + C * D

この表現方式は、Java(登録商標)による行列計算の表現方式と比較すると、可読性及び保守性の点において優れていると言える。また、Matlabは数値計算ライブラリを内包しているので、開発者は、行列計算のためのライブラリを入手する必要はない。   This representation method is superior in terms of readability and maintainability as compared to the representation method of matrix calculation by Java (registered trademark). Further, since Matlab includes a numerical calculation library, the developer does not need to obtain a library for matrix calculation.

一般に、C言語やJava(登録商標)言語といったソフトウェア開発でよく用いられるプログラミング言語においては、行列演算や数式をネイティブに扱うための仕組みが言語レベルでは用意されていない。従って、行列演算などを扱いたい場合、開発者は、第三者が作成したライブラリを別途利用する必要がある。一方、MatLabはそのようなライブラリを内包したマクロ的言語である。よって、C言語やJava(登録商標)言語と比較して、行列演算等の数値計算を簡潔に記述することが可能となる。   In general, in a programming language often used in software development such as C language or Java (registered trademark) language, a mechanism for natively handling matrix operations and mathematical expressions is not prepared at the language level. Therefore, when it is desired to handle matrix operations, the developer needs to use a library created by a third party separately. On the other hand, MatLab is a macro language including such a library. Therefore, numerical calculations such as matrix operations can be described in a concise manner as compared with C language or Java (registered trademark) language.

このように、様々なプログラミング言語は、それぞれ異なるプロパティを有しており、それぞれ異なる長所・短所を有している。ある言語で構築されたフレームワークのホットスポットに、ある処理を適用する場合、その処理の内容によっては、ホットスポット実装コードの開発が困難になる可能性がある。つまり、フレームワークという制限のために、ホットスポット実装コードの開発効率が低下するという問題点があった。ホットスポット実装コードの開発効率を向上させることができる技術が望まれる。   As described above, various programming languages have different properties, and have different advantages and disadvantages. When a certain process is applied to a hot spot of a framework constructed in a certain language, it may be difficult to develop a hot spot implementation code depending on the contents of the process. In other words, due to the limitation of the framework, there is a problem that the development efficiency of the hot spot mounting code is lowered. A technique capable of improving the development efficiency of hot spot mounting codes is desired.

尚、フレームワークやソフトウェアの開発に関連する技術として以下のものが知られている。   The following technologies are known as technologies related to the development of frameworks and software.

特許文献1には、アプリケーションに共通する雛型ソフトウェアを有するモデルを用いて、利用者が要求する要求機能を実行するフレームワークの開発を支援するフレームワーク開発支援装置が開示されている。このフレームワーク開発支援装置は、利用者からフレームワークに対する要求機能の入力を受け付け、受け付けた要求機能を編集する要求機能編集部と、要求機能編集部が編集した要求機能を格納する要求機能格納部と、モデルを編集するモデル編集部と、モデル編集部が編集したモデルを格納するモデル格納部と、モデル格納部に格納されたモデルと要求機能格納部に格納された要求機能とを対応づける追跡関係を生成する追跡関係編集部と、追跡関係編集部が生成した追跡関係を格納する追跡関係格納部とを備える。   Patent Document 1 discloses a framework development support apparatus that supports the development of a framework that executes a requested function requested by a user using a model having template software common to applications. The framework development support apparatus receives a request function input to the framework from a user, edits the received request function, a request function editing unit, and stores a request function edited by the request function editing unit A model editing unit that edits a model, a model storage unit that stores a model edited by the model editing unit, and a model that stores a model stored in the model storage unit and a request function stored in the request function storage unit A tracking relationship editing unit that generates a relationship and a tracking relationship storage unit that stores the tracking relationship generated by the tracking relationship editing unit.

特許文献2には、オブジェクト指向による再利用可能なソフトウェア部品の開発を支援するソフトウェア部品開発支援装置が開示されている。このソフトウェア部品開発支援装置は、分析モデル生成手段と、変換手段とを備えている。分析モデル生成手段は、ある問題領域のアプリケーションに共通となる要求仕様の分析時に、仕様の変動性に関する情報を入力し、該情報を用いて要求仕様を分析して分析モデルを生成する。変換手段は、分析モデルを入力して、アプリケーション開発環境の要素となる再利用可能ソフトウェアの設計情報に変換する。   Patent Document 2 discloses a software component development support apparatus that supports development of reusable software components by object orientation. This software component development support apparatus includes an analysis model generation unit and a conversion unit. The analysis model generation means inputs information related to specification variability when analyzing a requirement specification common to applications in a certain problem area, and analyzes the requirement specification using the information to generate an analysis model. The conversion means inputs the analysis model and converts it into design information of reusable software that is an element of the application development environment.

特許文献3には、ディジタルシグナルプロセッサ(DSP)のプログラムのソースコードを中間コードに変換し、その中間コードを上記DSPに対応したオブジェクトコードに変換するコンパイル方法が開示されている。このコンパイル方法において、上記中間コードは、DSPのプログラムを記述するための複数の言語、または複数のDSPにそれぞれ対応したオブジェクトコードに共通である。   Patent Document 3 discloses a compiling method in which a source code of a digital signal processor (DSP) program is converted into an intermediate code, and the intermediate code is converted into an object code corresponding to the DSP. In this compiling method, the intermediate code is common to a plurality of languages for describing a DSP program or an object code corresponding to each of a plurality of DSPs.

特開2002−157117号公報JP 2002-157117 A 特開平11−237982号公報Japanese Patent Laid-Open No. 11-237982 特開平5−342012号公報JP-A-5-342012

本発明の目的は、フレームワークを利用するシステム開発の開発効率を向上させることができる技術を提供することにある。   An object of the present invention is to provide a technique capable of improving the development efficiency of system development using a framework.

本発明の他の目的は、フレームワークのホットスポットを実装するホットスポット実装コードの開発効率を向上させることができる技術を提供することにある。   Another object of the present invention is to provide a technique capable of improving the development efficiency of a hot spot mounting code for mounting a framework hot spot.

本発明の更に他の目的は、フレームワークの利用者が、ホットスポットを実装する処理内容に応じて、最適な開発言語を選択することができる開発システム及び開発プログラムを提供することにある。   Still another object of the present invention is to provide a development system and a development program that allow a user of a framework to select an optimal development language according to the processing contents for mounting a hot spot.

以下に、[発明を実施するための最良の形態]で使用される番号・符号を用いて、[課題を解決するための手段]を説明する。これらの番号・符号は、[特許請求の範囲]の記載と[発明を実施するための最良の形態]との対応関係を明らかにするために括弧付きで付加されたものである。ただし、それらの番号・符号を、[特許請求の範囲]に記載されている発明の技術的範囲の解釈に用いてはならない。   [Means for Solving the Problems] will be described below using the numbers and symbols used in [Best Mode for Carrying Out the Invention]. These numbers and symbols are added in parentheses in order to clarify the correspondence between the description of [Claims] and [Best Mode for Carrying Out the Invention]. However, these numbers and symbols should not be used for the interpretation of the technical scope of the invention described in [Claims].

本発明によれば、開発者によって様々な言語で記述されたソースコードが、一つの共通なオブジェクトモデルへ変換される。そのオブジェクトモデルは、メモリ上に展開される。そのオブジェクトモデルから、ホットスポットを実装するソースコード(ホットスポット実装コード)が生成される。つまり、本発明に係る実装コード開発システム及び開発プログラムは、オブジェクトモデルを中間表現として利用することによって、開発者が作成するソースコードを、ホットスポットに適合するホットスポット実装コードに変換する。   According to the present invention, source code described in various languages by a developer is converted into one common object model. The object model is expanded on the memory. From the object model, a source code for mounting a hot spot (hot spot mounting code) is generated. In other words, the implementation code development system and the development program according to the present invention use the object model as an intermediate representation to convert the source code created by the developer into a hot spot implementation code suitable for the hot spot.

本発明に係る実装コード開発システム(10)は、フレームワーク(1)のホットスポット(3)を実装するホットスポット実装コード(50)を開発する。その実装コード開発システム(10)は、記録媒体(13)と、ソースコードパース部(110)と、継承情報付与部(120)と、アウトプット部(130)とを備える。記録媒体(13)には、ソースコード(20)、及びホットスポット(3)に適合する条件が記述された継承情報記述ファイル(40)が格納される。ソースコードパース部(110)は、記録媒体(13)から読み込まれるソースコード(20)の内容に応じて所定のクラス群をインスタンス化し、ソースコード(20)の内容を示す第1オブジェクトモデル(30A)をメモリ(12)上に展開する。継承情報付与部(120)は、記録媒体(13)から継承情報記述ファイル(40)を読み込み、第1オブジェクトモデル(30A)を、上記条件が付与された第2オブジェクトモデル(30B)に変更する。アウトプット部(130)は、メモリ(12)上に展開された第2オブジェクトモデル(30B)をコード化することにより、ホットスポット実装コード(50)を作成する。   The mounting code development system (10) according to the present invention develops a hot spot mounting code (50) for mounting the hot spot (3) of the framework (1). The implementation code development system (10) includes a recording medium (13), a source code parsing unit (110), an inheritance information adding unit (120), and an output unit (130). The recording medium (13) stores a source code (20) and an inheritance information description file (40) in which conditions suitable for the hot spot (3) are described. The source code parsing unit (110) instantiates a predetermined class group according to the contents of the source code (20) read from the recording medium (13), and shows a first object model (30A) indicating the contents of the source code (20). ) On the memory (12). The inheritance information adding unit (120) reads the inheritance information description file (40) from the recording medium (13), and changes the first object model (30A) to the second object model (30B) to which the above condition is assigned. . The output unit (130) creates the hot spot mounting code (50) by coding the second object model (30B) developed on the memory (12).

上記ソースコードパース部(110)は、字句解析部(111)と構文解析部(112)とを備える。字句解析部(111)は、ソースコード(20)を受け取り、そのソースコード(20)に含まれる字句を抽出する。構文解析部(112)は、抽出された字句に基づいて、ソースコード(20)の構文を解析する。構文解析部(112)は、構文の解析結果に基づいて所定のクラス群をインスタンス化することにより、第1オブジェクトモデル(30A)をメモリ(12)上に展開する。   The source code parsing unit (110) includes a lexical analyzer (111) and a syntax analyzer (112). The lexical analyzer (111) receives the source code (20) and extracts a lexical phrase included in the source code (20). The syntax analysis unit (112) analyzes the syntax of the source code (20) based on the extracted lexical phrase. The syntax analysis unit (112) develops the first object model (30A) on the memory (12) by instantiating a predetermined class group based on the syntax analysis result.

また、上記ソースコードパース部(110)は、複数のファイル形式のそれぞれに対応した複数の字句解析部(111)と、複数のファイル形式のそれぞれに対応した複数の構文解析部(112)とを備える。複数の字句解析部(111)の各々は、ソースコード(20)に含まれる字句を抽出する。複数の構文解析部(112)の各々は、抽出された字句に基づいて、ソースコード(20)の構文を解析する。ソースコード(20)は、複数の字句解析部(111)のうち、ソースコード(20)のファイル形式に対応する一の字句解析部(111)に入力される。複数の構文解析部(112)のうちソースコード(20)のファイル形式に対応する一の構文解析部(112)は、構文の解析結果に基づいて所定のクラス群をインスタンス化することにより、第1オブジェクトモデル(30A)をメモリ(12)上に展開する。   The source code parsing unit (110) includes a plurality of lexical analyzers (111) corresponding to each of a plurality of file formats and a plurality of syntax analyzers (112) corresponding to each of the plurality of file formats. Prepare. Each of the plurality of lexical analyzers (111) extracts a lexical included in the source code (20). Each of the plurality of syntax analysis units (112) analyzes the syntax of the source code (20) based on the extracted lexical phrase. The source code (20) is input to one lexical analyzer (111) corresponding to the file format of the source code (20) among the plurality of lexical analyzers (111). One syntax analysis unit (112) corresponding to the file format of the source code (20) among the plurality of syntax analysis units (112) instantiates a predetermined class group based on the result of the syntax analysis. One object model (30A) is developed on the memory (12).

ソースコードパース部(110)は、更に、拡張子判定部(113)を備えていてもよい。この拡張子判定部(113)は、ソースコード(20)の拡張子を識別することにより、複数の字句解析部(111)から上記一の字句解析部(111)を決定する。そして、拡張子判定部(113)は、ソースコード(20)を、決定された一の字句解析部(111)に出力する。   The source code parsing unit (110) may further include an extension determination unit (113). The extension determination unit (113) identifies the one lexical analysis unit (111) from the plurality of lexical analysis units (111) by identifying the extension of the source code (20). Then, the extension determining unit (113) outputs the source code (20) to the determined one lexical analyzer (111).

継承情報記述ファイル(40)に記述される情報は、ホットスポット(3)における抽象クラスを継承するための継承情報(4000)を含む。   The information described in the inheritance information description file (40) includes inheritance information (4000) for inheriting the abstract class in the hot spot (3).

アウトプット部(130)は、デザインパターンであるVisitorパターンに基づいて構築されてもよい。この場合、アウトプット部(130)は、第2オブジェクトモデル(30B)に含まれる複数のインスタンスを順番に巡りながら、第2オブジェクトモデル(30B)をコード化する。   The output unit (130) may be constructed based on a visitor pattern that is a design pattern. In this case, the output unit (130) codes the second object model (30B) while sequentially visiting a plurality of instances included in the second object model (30B).

本発明に係る実装コード開発プログラム(100)は、フレームワーク(1)のホットスポット(3)を実装するホットスポット実装コード(50)を開発するためのプログラムであり、コンピュータにより実行される。そのコンピュータは、ソースコード(20)及びホットスポット(3)に適合する条件が記述された継承情報記述ファイル(40)が格納される記録媒体(13)と、メモリ(12)とを備える。本発明に係る実装コード開発プログラム(100)は、(A)記録媒体(13)からソースコード(20)を読み込むステップと、(B)ソースコード(20)の内容に応じて所定のクラス群をインスタンス化し、ソースコード(20)の内容を示す第1オブジェクトモデル(30A)をメモリ(12)上に展開するステップと、(C)記録媒体(13)から継承情報記述ファイル(40)を読み込み、第1オブジェクトモデル(30A)を、上記条件が付与された第2オブジェクトモデル(30B)に変更するステップと、(D)メモリ(12)上に展開された第2オブジェクトモデル(30B)をコード化することにより、ホットスポット実装コード(50)を作成するステップとをコンピュータに実行させる。   The mounting code development program (100) according to the present invention is a program for developing a hot spot mounting code (50) for mounting the hot spot (3) of the framework (1), and is executed by a computer. The computer includes a recording medium (13) in which a succession information description file (40) in which conditions conforming to the source code (20) and the hot spot (3) are described is stored, and a memory (12). The implementation code development program (100) according to the present invention includes (A) a step of reading the source code (20) from the recording medium (13), and (B) a predetermined class group according to the contents of the source code (20). Instantiating, expanding the first object model (30A) indicating the contents of the source code (20) on the memory (12), (C) reading the inheritance information description file (40) from the recording medium (13), A step of changing the first object model (30A) to a second object model (30B) to which the above conditions are given; and (D) encoding the second object model (30B) developed on the memory (12). This causes the computer to execute the step of creating the hot spot mounting code (50).

上記(B)ステップは、(B1)ソースコード(20)に含まれる字句を抽出するステップと、(B2)抽出された字句に基づいて、ソースコード(20)の構文を解析するステップと、(B3)構文の解析結果に基づいて所定のクラス群をインスタンス化することにより、第1オブジェクトモデル(30A)をメモリ(12)上に展開するステップとを含む。   The (B) step includes (B1) extracting a lexical character included in the source code (20), (B2) analyzing the syntax of the source code (20) based on the extracted lexical character, And B3) developing a first object model (30A) on the memory (12) by instantiating a predetermined class group based on the analysis result of the syntax.

また、上記(B)ステップは、(b1)ソースコード(20)の拡張子を識別することにより、ソースコード(20)のファイル形式を決定するステップと、(b2)そのファイル形式に準拠して、ソースコード(20)に含まれる字句を抽出するステップと、(b3)抽出された字句及びファイル形式に基づいて、ソースコード(20)の構文を解析するステップと、(b4)構文の解析結果に基づいて所定のクラス群をインスタンス化することにより、第1オブジェクトモデル(30A)をメモリ(12)上に展開するステップとを含む。   The step (B) includes (b1) determining the file format of the source code (20) by identifying the extension of the source code (20), and (b2) complying with the file format. , A step of extracting a lexical included in the source code (20), (b3) a step of analyzing the syntax of the source code (20) based on the extracted lexical and file format, and (b4) a result of the syntax analysis And developing a first object model (30A) on the memory (12) by instantiating a predetermined class group based on the above.

継承情報記述ファイル(40)に記述される情報は、ホットスポット(3)における抽象クラスを継承するための継承情報(4000)を含む。   The information described in the inheritance information description file (40) includes inheritance information (4000) for inheriting the abstract class in the hot spot (3).

上記(D)ステップは、デザインパターンであるVisitorパターンに基づいて、第2オブジェクトモデル(30B)に含まれる複数のインスタンスを順番に巡りながら、第2オブジェクトモデル(30B)をコード化するステップを含む。   The step (D) includes a step of coding the second object model (30B) while sequentially visiting a plurality of instances included in the second object model (30B) based on the visitor pattern which is a design pattern. .

上記所定のクラス群は、ソースコード(20)を表現するためのSourceFileクラス(1000)と、ソースコード(20)に含まれる関数群を表現するためのFunctionsクラス(1100)と、ソースコード(20)に含まれる変数群を表現するためのVariablesクラス(1200)とを含む。SourceFileクラス(1000)は、集約クラスであり、Functionsクラス(1100)及びVariablesクラス(1200)を含む。   The predetermined class group includes a SourceFile class (1000) for expressing the source code (20), a Functions class (1100) for expressing a function group included in the source code (20), and a source code (20 ) Variables class (1200) for expressing a variable group included in (). The SourceFile class (1000) is an aggregation class, and includes a Functions class (1100) and a Variables class (1200).

上記Functionsクラス(1100)は、集約クラスであり、関数群に含まれる関数を表現するためのFunctionクラス(1300)を含む。また、Functionクラス(1300)も、集約クラスである。Functionクラス(1300)は、関数に含まれるメソッド群を表現するためのStatementsクラス(1400)と、関数の引数を表現するためのArgumentListクラス(1500)と、関数で用いられる変数群を表現するためのVariablesクラス(1200)と、関数で用いられる定数を表現するためのConstantクラス(1930)とを含む。   The Functions class (1100) is an aggregation class and includes a Function class (1300) for expressing a function included in a function group. The Function class (1300) is also an aggregation class. The Function class (1300) is a Statements class (1400) for expressing a method group included in a function, an ArgumentList class (1500) for expressing a function argument, and a variable group used in the function. The Variables class (1200) and the Constant class (1930) for expressing constants used in the function are included.

本発明に係る開発システム及び開発プログラムによれば、フレームワークの利用者(システムの開発者)は、ホットスポットを実装する処理内容に応じて、最適な開発言語を選択することが可能となる。つまり、本発明によれば、開発者は、自分が得意とするプログラミング言語を利用して、ホットスポット実装コードを開発することが可能となる。従って、ホットスポット実装コードの開発効率が向上する。最適な言語を利用してホットスポットの実装を行うことができるため、開発者は、フレームワークを利用するシステムを短期間で効率良く開発することが可能となる。   According to the development system and the development program according to the present invention, a framework user (system developer) can select an optimal development language in accordance with the processing content for mounting a hot spot. That is, according to the present invention, a developer can develop a hot spot mounting code by using a programming language that he is good at. Therefore, the development efficiency of the hot spot mounting code is improved. Since a hot spot can be implemented using an optimal language, a developer can efficiently develop a system using a framework in a short period of time.

添付図面を参照して、本発明に係るホットスポット実装コードの開発システム及び開発プログラムを説明する。   A hot spot mounting code development system and development program according to the present invention will be described with reference to the accompanying drawings.

図1は、本発明の全体を概念的に示している。本発明において、所望のシステムはフレームワーク1を利用することによって開発される。そのフレームワーク1は、フローズンスポット2とホットスポット3を備えている。フレームワーク1は、オブジェクト指向によるフレームワークであり、ホットスポット3には、そのフレームワーク1が提供する「抽象クラス(インターフェース)」が用意される。   FIG. 1 conceptually shows the whole of the present invention. In the present invention, the desired system is developed by utilizing the framework 1. The framework 1 includes a frozen spot 2 and a hot spot 3. The framework 1 is an object-oriented framework, and an “abstract class (interface)” provided by the framework 1 is prepared in the hot spot 3.

所望のシステムを構築するために、所望の機能を実現するプログラムによりホットスポット3の実装が行われる。そのプログラムのソースコード、すなわちホットスポット実装コード50は、フレームワーク1の開発言語と同じプログラミング言語で記述される。例えば、フレームワーク1がJava(登録商標)で開発された場合、ホットスポット実装コード50もJava(登録商標)で記述される。また、そのホットスポット実装コード50には、ホットスポット3における抽象クラスを継承するサブクラスが規定される必要がある。このようなホットスポット実装コード50、つまりホットスポット3に適合するようなホットスポット実装コード50は、本発明に係る実装コード開発システム10によって作成される。   In order to construct a desired system, the hot spot 3 is mounted by a program that realizes a desired function. The source code of the program, that is, the hot spot implementation code 50 is described in the same programming language as the development language of the framework 1. For example, when the framework 1 is developed in Java (registered trademark), the hot spot mounting code 50 is also described in Java (registered trademark). Further, the hot spot implementation code 50 needs to define a subclass that inherits the abstract class in the hot spot 3. Such a hot spot mounting code 50, that is, a hot spot mounting code 50 suitable for the hot spot 3, is created by the mounting code development system 10 according to the present invention.

図1に示されるように、本発明に係る実装コード開発システム10は、システム開発者によって作成されるソースコード20を入力し、ホットスポット実装コード50を出力する。ソースコード20は、Java(登録商標)、C言語、MatLab、XMLなど様々なプログラミング言語で作成される。ソースコード20を記述する言語は、フレームワーク1の開発言語と異なっていてもよいし、同一でもよい。開発者は、自分が得意とするプログラミング言語を用いてソースコード20を開発すればよい。   As shown in FIG. 1, the mounting code development system 10 according to the present invention inputs source code 20 created by a system developer and outputs a hot spot mounting code 50. The source code 20 is created in various programming languages such as Java (registered trademark), C language, MatLab, and XML. The language describing the source code 20 may be different from the development language of the framework 1 or may be the same. The developer may develop the source code 20 using a programming language that he is good at.

後述されるように、実装コード開発システム10には、所定の「クラス群」が規定されている。入力されたソースコード20の内容に応じてそのクラス群をインスタンス化することにより、ソースコード20の内容が反映されたオブジェクトモデル30が生成される。そして、共通のクラス群に基づいて作成されたオブジェクトモデル30が、ホットスポット3に適合するホットスポット実装コード50に変換される。生成されたホットスポット実装コード50はコンパイルされ、ホットスポット3に適用される。これにより、ホットスポット3の実装が完了する。   As will be described later, the implementation code development system 10 defines a predetermined “class group”. By instantiating the class group according to the contents of the input source code 20, an object model 30 reflecting the contents of the source code 20 is generated. Then, the object model 30 created based on the common class group is converted into a hot spot mounting code 50 adapted to the hot spot 3. The generated hot spot mounting code 50 is compiled and applied to the hot spot 3. Thereby, the mounting of the hot spot 3 is completed.

このように、本発明に係る実装コード開発システム10は、様々な言語で記述され得るソースコード20を、ホットスポット3に適合する一の言語で記述されるホットスポット実装コード50に変換する。その変換過程において、実装コード開発システム10は、オブジェクトモデル30を「中間表現」として利用している。オブジェクトモデルとは、プログラム上で扱われるデータがオブジェクト指向設計によってモデリングされた、データ構造とそれに与えられる一連の動作の骨組みのことである。代表的なオブジェクトモデルとして、XMLファイルを表現するためのDOM(Document Object Model)が挙げられる。本発明に係るオブジェクトモデル30は、ある処理を行うプログラムのソースコードを表現するためのオブジェクトモデルであると言える。   As described above, the implementation code development system 10 according to the present invention converts the source code 20 that can be described in various languages into the hot spot implementation code 50 that is described in one language suitable for the hot spot 3. In the conversion process, the implementation code development system 10 uses the object model 30 as an “intermediate expression”. An object model is a framework of a data structure and a series of operations given thereto, in which data handled in a program is modeled by object-oriented design. As a typical object model, there is a DOM (Document Object Model) for expressing an XML file. The object model 30 according to the present invention can be said to be an object model for expressing the source code of a program that performs a certain process.

以下、本発明に係る実装コード開発システム10の構成及び動作が、更に詳細に説明される。   Hereinafter, the configuration and operation of the implementation code development system 10 according to the present invention will be described in more detail.

(構成)
図2は、本発明に係る実装コード開発システム10の構成を示すブロック図である。実装コード開発システム10は、演算処理装置11、メモリ12、記録媒体13、入力装置14、及び表示装置15を備えている。メモリ12は、データ処理用の一時記憶装置であり、例としてDRAM(Dynamic Random Access Memory)が挙げられる。記録媒体13は、データやプログラムを格納するための記憶装置であり、例としてハードディスクが挙げられる。入力装置14としては、キーボードやマウスが例示される。表示装置15としては、液晶ディスプレイが例示される。演算処理装置11は、プログラムの命令に従って、各種演算や各装置の制御を実行する。開発者は、表示装置15に表示される情報を参照しながら、入力装置14を用いてファイルの編集やコマンドの入力を行うことができる。この実装コード開発システム10は、例えばワークステーション上に構築される。
(Constitution)
FIG. 2 is a block diagram showing the configuration of the implementation code development system 10 according to the present invention. The mounted code development system 10 includes an arithmetic processing device 11, a memory 12, a recording medium 13, an input device 14, and a display device 15. The memory 12 is a temporary storage device for data processing, and examples thereof include a DRAM (Dynamic Random Access Memory). The recording medium 13 is a storage device for storing data and programs, and an example is a hard disk. Examples of the input device 14 include a keyboard and a mouse. An example of the display device 15 is a liquid crystal display. The arithmetic processing unit 11 executes various calculations and control of each device in accordance with instructions of the program. The developer can edit a file and input a command using the input device 14 while referring to information displayed on the display device 15. The implementation code development system 10 is constructed on a workstation, for example.

記録媒体13には、ソースコード20、継承情報記述ファイル40、及びホットスポット実装コード50が格納される。ソースコード20は、実装コード開発システム10によってホットスポット実装コード50に変換されるファイルである。開発者は、入力装置14を用いることによって、ソースコード20を作成・編集することができる。また、開発者は、入力装置14を用いることによって、入力されるソースコード20のファイル形式(MatLab等)を指定することができる。継承情報記述ファイル40は、後述されるように、実装コード開発システム10によるファイル変換処理に用いられるファイルである。継承情報記述ファイル40には、ホットスポット3における抽象クラスを継承するための情報、つまり、ホットスポット3に適合する条件が記述される。開発者は、入力装置14を用いることによって、継承情報記述ファイル40(例えばXMLファイル)を作成・編集することができる。ホットスポット実装コード50は、実装コード開発システム10によって作成されるファイルである。開発者は、入力装置14を用いることによって、出力されるホットスポット実装コード50のファイル形式、すなわちホットスポット3に適合する所望のファイル形式(Java(登録商標)等)を指定することができる。   The recording medium 13 stores the source code 20, the inheritance information description file 40, and the hot spot mounting code 50. The source code 20 is a file that is converted into the hot spot mounting code 50 by the mounting code development system 10. The developer can create and edit the source code 20 by using the input device 14. Further, the developer can specify the file format (MatLab or the like) of the input source code 20 by using the input device 14. The inheritance information description file 40 is a file used for file conversion processing by the implementation code development system 10 as described later. In the inheritance information description file 40, information for inheriting the abstract class in the hot spot 3, that is, a condition suitable for the hot spot 3 is described. The developer can create and edit the inheritance information description file 40 (for example, an XML file) by using the input device 14. The hot spot mounting code 50 is a file created by the mounting code development system 10. By using the input device 14, the developer can specify a file format of the output hot spot mounting code 50, that is, a desired file format (such as Java (registered trademark)) that matches the hot spot 3.

また、記録媒体13には変換プログラム(実装コード開発プログラム)100が格納される。この変換プログラム100は、ソースコード20をホットスポット実装コード50に変換するためのプログラムであり、演算処理装置11によって実行される。逆に言えば、演算処理装置11は、変換プログラム100による命令に従って、ソースコード20をホットスポット実装コード50に変換する。この変換プログラム100は、ソースコードパース部110、継承情報付与部120、及びアウトプット部130を含んでいる。後述されるように、ソースコードパース部110は、ソースコード20をオブジェクトモデル30に変換し、オブジェクトモデル30をメモリ12上に展開する機能を備えている。継承情報付与部120は、継承情報記述ファイル40に記述された情報を、オブジェクトモデル30に付与する機能を備えている。アウトプット部130は、メモリ12上に展開されたオブジェクトモデル30から、ホットスポット実装コード50を作成する機能を備えている。   The recording medium 13 stores a conversion program (implemented code development program) 100. The conversion program 100 is a program for converting the source code 20 into the hot spot mounting code 50 and is executed by the arithmetic processing unit 11. In other words, the arithmetic processing unit 11 converts the source code 20 into the hot spot mounting code 50 in accordance with an instruction from the conversion program 100. The conversion program 100 includes a source code parsing unit 110, an inheritance information adding unit 120, and an output unit 130. As will be described later, the source code parsing unit 110 has a function of converting the source code 20 into an object model 30 and developing the object model 30 on the memory 12. The inheritance information assigning unit 120 has a function of assigning information described in the inheritance information description file 40 to the object model 30. The output unit 130 has a function of creating the hot spot mounting code 50 from the object model 30 developed on the memory 12.

(動作)
図3A及び図3Bは、本発明に係る実装コード開発システム10におけるデータ処理の流れを示している。以下、図2と共にこれら図3A及び図3Bを参照することによって、ソースコード20がホットスポット実装コード50に変換されるまでの処理を説明する。尚、ソースコード20及び継承情報記述ファイル40は、開発者により予め作成され、記録媒体13に格納されているとする。ソースコード20は、開発者が得意とするプログラミング言語により作成されている。また、継承情報記述ファイル40は、所定の言語により作成されている。また、作成されるホットスポット実装コード50のファイル形式、すなわち所望のファイル形式は、開発者により予め指定されている。例えば、出力ファイル形式は、Java(登録商標)に設定される。以下に示される処理は、演算処理装置11と、その演算処理装置11によって実行される変換プログラム100とによって実現される。
(Operation)
3A and 3B show the flow of data processing in the mounted code development system 10 according to the present invention. Hereinafter, the processing until the source code 20 is converted into the hot spot mounting code 50 will be described with reference to FIGS. 3A and 3B together with FIG. It is assumed that the source code 20 and the inheritance information description file 40 are created in advance by the developer and stored in the recording medium 13. The source code 20 is created in a programming language that the developer is good at. The inheritance information description file 40 is created in a predetermined language. Further, the file format of the hot spot mounting code 50 to be created, that is, the desired file format is designated in advance by the developer. For example, the output file format is set to Java (registered trademark). The processing shown below is realized by the arithmetic processing device 11 and the conversion program 100 executed by the arithmetic processing device 11.

1.処理前半(入力から中間表現まで)
図3Aは、本発明に係るデータ処理の前半を示しており、ソースコード20からオブジェクトモデル30が作成されるまでの処理を示している。開発者が入力装置14を用いてソースコード20を指定すると、変換プログラム100のソースコードパース部110は、指定されたソースコード20を記録媒体13から読み込む。そして、ソースコードパース部110は、そのソースコード20の内容を示すオブジェクトモデル30(以下、「ソースコードオブジェクトモデル30A」と参照される)を生成する。ソースコードパース部110は、生成されるソースコードオブジェクトモデル30Aをメモリ12上に展開する。
1. First half of processing (from input to intermediate representation)
FIG. 3A shows the first half of the data processing according to the present invention, and shows the processing until the object model 30 is created from the source code 20. When the developer specifies the source code 20 using the input device 14, the source code parsing unit 110 of the conversion program 100 reads the specified source code 20 from the recording medium 13. Then, the source code parsing unit 110 generates an object model 30 (hereinafter referred to as “source code object model 30A”) indicating the contents of the source code 20. The source code parsing unit 110 expands the generated source code object model 30A on the memory 12.

具体的には、ソースコードパース部110は、字句解析部111と構文解析部112を有している。まず、ソースコード20は、字句解析部111に入力される。字句解析部111は、受け取ったソースコード20に含まれる字句を抽出する。言い換えれば、字句解析部111は、ソースコード20中の文言を単語(トークン)ごとに切り分ける。例えば、ソースコード20中に「i = 1」というコードが記述されている場合、スペースがセパレータの役目を果たしている。よって、字句解析部111は、スペースを認識することにより、ソースコード20に含まれる文言をトークンごとに読み込むことができる。また例えば、字句解析部111は、ソースコード20中の「=」を認識することにより、トークンの読み込みを行うこともできる。   Specifically, the source code parsing unit 110 includes a lexical analysis unit 111 and a syntax analysis unit 112. First, the source code 20 is input to the lexical analyzer 111. The lexical analyzer 111 extracts lexical characters included in the received source code 20. In other words, the lexical analyzer 111 cuts the wording in the source code 20 into words (tokens). For example, when a code “i = 1” is described in the source code 20, the space serves as a separator. Therefore, the lexical analyzer 111 can read the word included in the source code 20 for each token by recognizing the space. Further, for example, the lexical analyzer 111 can read a token by recognizing “=” in the source code 20.

ここで、ソースコード20は様々なプログラミング言語で記述され得るため、図3Aに示されるように、字句解析部111は、ソースコード20のファイル形式ごとに複数設けられてもよい。例えば、C言語で記述されたソースコード20−1は、字句解析部111−1に入力される。Matlabで記述されたソースコード20−2は、字句解析部111−2に入力される。Java(登録商標)で記述されたソースコード20−3は、字句解析部111−3に入力される。各字句解析部は、ソースコード20のファイル形式に準拠して、ソースコード20に含まれる字句を抽出する。   Here, since the source code 20 can be described in various programming languages, a plurality of lexical analyzers 111 may be provided for each file format of the source code 20, as shown in FIG. 3A. For example, the source code 20-1 described in C language is input to the lexical analyzer 111-1. The source code 20-2 described in Matlab is input to the lexical analyzer 111-2. The source code 20-3 described in Java (registered trademark) is input to the lexical analyzer 111-3. Each lexical analyzer extracts a lexical included in the source code 20 in accordance with the file format of the source code 20.

ソースコード20が複数の字句解析部111のうちどの字句解析部111に入力されるかは、例えば、開発者によって予め指定される。開発者は、入力装置14を用い、変換対象のソースコード20のファイル形式を指定する。ソースコード20は、その指定されたファイル形式に対応する字句解析部111に入力される。例えば、ファイル形式としてMatLabが指定される場合、ソースコード20−2は、字句解析部111−2に入力される。   For example, the developer specifies in advance which lexical analyzer 111 of the plurality of lexical analyzers 111 the source code 20 is input to. The developer uses the input device 14 to specify the file format of the source code 20 to be converted. The source code 20 is input to the lexical analyzer 111 corresponding to the designated file format. For example, when MatLab is specified as the file format, the source code 20-2 is input to the lexical analyzer 111-2.

あるいは、ソースコード20のファイル形式は、ソースコード20の拡張子(.c, .m, .java等)に基づいて自動的に判定されてもよい。その場合、ソースコードパース部110は、入力されるソースコード20の拡張子を自動的に識別する拡張子判定部113を有する。拡張子判定部113は、ソースコード20のファイル形式を判別し、そのファイル形式に応じた一の字句解析部111を、複数の字句解析部111の中から決定する。例えば、MatLabで記述されたソースコード20−2(Mファイル)が入力された場合、拡張子判定部113は、複数の字句解析部111から字句解析部111−2を選択する。これにより、ソースコード20−2が、対応する字句解析部111−2に入力される。   Alternatively, the file format of the source code 20 may be automatically determined based on the extension (.c, .m, .java, etc.) of the source code 20. In that case, the source code parsing unit 110 includes an extension determination unit 113 that automatically identifies the extension of the input source code 20. The extension determination unit 113 determines the file format of the source code 20 and determines one lexical analyzer 111 corresponding to the file format from the plurality of lexical analyzers 111. For example, when the source code 20-2 (M file) described in MatLab is input, the extension determination unit 113 selects the lexical analysis unit 111-2 from the plurality of lexical analysis units 111. As a result, the source code 20-2 is input to the corresponding lexical analyzer 111-2.

次に、字句解析部111によって抽出された字句を表す情報(トークン列)が、構文解析部112に入力される。字句解析部111と同様に、構文解析部112は、ソースコード20のファイル形式ごとに複数設けられる。例えば、字句解析部111−1からのトークン列は、C言語に対して設けられた構文解析部112−1に入力される。字句解析部111−2からのトークン列は、MatLabに対して設けられた構文解析部112−2に入力される。字句解析部111−3からのトークン列は、Java(登録商標)言語に対して設けられた構文解析部112−3に入力される。各構文解析部112は、ソースコード20のトークン列を受け取り、そのトークン列に基づいてソースコード20の構文と文脈を解析する。構文・文脈の解析は、対応するファイル形式に準拠して、すなわち各プログラミング言語の文法に基づいて行われる。   Next, information (token string) representing the lexical extracted by the lexical analysis unit 111 is input to the syntax analysis unit 112. Similar to the lexical analysis unit 111, a plurality of syntax analysis units 112 are provided for each file format of the source code 20. For example, the token string from the lexical analysis unit 111-1 is input to the syntax analysis unit 112-1 provided for the C language. The token string from the lexical analyzer 111-2 is input to the syntax analyzer 112-2 provided for MatLab. The token string from the lexical analysis unit 111-3 is input to the syntax analysis unit 112-3 provided for the Java (registered trademark) language. Each syntax analysis unit 112 receives a token string of the source code 20, and analyzes the syntax and context of the source code 20 based on the token string. The syntax / context analysis is performed according to the corresponding file format, that is, based on the grammar of each programming language.

また、構文解析部112は、構文の解析結果に基づいて、ソースコード20の構造を表現するようなソースコードオブジェクトモデル30Aを作成する。そのためには、様々なプログラミング言語によるソースコード20を表現できるような「共通のクラス群」が予め用意され、そのクラス群が構文解析部112に組み込まれていればよい。様々なプログラミング言語は、それぞれ異なる文法を有しているが、「変数の宣言」「分岐」といった処理内容は、どのようなソースコード20についても共通である。従って、「変数の宣言」を表現するためのクラスや、「分岐」を表現するためのクラスなどが用意されていればよい。   Also, the syntax analysis unit 112 creates a source code object model 30A that expresses the structure of the source code 20 based on the syntax analysis result. For this purpose, a “common class group” that can represent the source code 20 in various programming languages is prepared in advance, and the class group may be incorporated in the syntax analysis unit 112. Various programming languages have different grammars, but the processing contents such as “variable declaration” and “branch” are common to any source code 20. Therefore, a class for expressing “declaration of variable”, a class for expressing “branch”, and the like need only be prepared.

言い換えれば、本発明に係るクラス群は、ソースコード20中の各処理の内容を格納するための1セットのクラスである。このクラス群は、様々なプログラミング言語によるソースコード20に対して共通に用いられる。ソースコード20を記述する言語が変わっても、構文解析部112に規定されるクラス群を変更する必要はない。構文解析部112は、構文の解析結果をうけて、ソースコード20の処理内容を反映するように上記クラス群をインスタンス化する。つまり、構文解析部112は、ソースコード20の処理内容に応じて、上記クラス群をインスタンス化する。これにより、ソースコード20の処理内容を示すソースコードオブジェクトモデル30Aが生成される。構文解析部112は、ソースコードオブジェクトモデル30Aをメモリ12上に展開する。   In other words, the class group according to the present invention is a set of classes for storing the contents of each process in the source code 20. This class group is commonly used for the source code 20 in various programming languages. Even if the language describing the source code 20 changes, it is not necessary to change the class group defined in the syntax analysis unit 112. The syntax analysis unit 112 receives the syntax analysis result and instantiates the class group so as to reflect the processing content of the source code 20. That is, the syntax analysis unit 112 instantiates the class group according to the processing content of the source code 20. Thereby, a source code object model 30A indicating the processing content of the source code 20 is generated. The syntax analysis unit 112 expands the source code object model 30A on the memory 12.

図4は、ソースコードオブジェクトモデル30Aを構成するためのクラス群を示すクラス図であり、UML(Unified Modeling Language)に準拠して記載されている。SourceFileクラス(1000)は、1つのソースコード20を表現するためのクラスである。1つのソースコード20に対し、1つのSourceFileオブジェクトが対応する。従って、n個のソースファイル20がオブジェクトモデル化されると、n個のSourceFileオブジェクトが生成される。   FIG. 4 is a class diagram showing classes for configuring the source code object model 30A, and is described in conformity with UML (Unified Modeling Language). The SourceFile class (1000) is a class for expressing one source code 20. One SourceFile object corresponds to one source code 20. Accordingly, when n source files 20 are object modeled, n source file objects are generated.

SourceFileクラス(1000)は、集約クラスであり、Functionsクラス(1100)とVariablesクラス(1200)を含んでいる。Functionsクラス(1100)は、ソースコード20中で定義された関数群の全てを表現するためのクラスである。また、Functionsクラス(1100)は、集約クラスであり、Functionクラス(1300)を含む。1つのFunctionクラス(1300)は、ソースコード20中の1つの関数を表現するためのクラスである。つまり、Functionsクラス(1100)は、関数群のそれぞれを表現する一群のFunctionクラス(1300)を含む。また、Variablesクラス(1200)は、ソースコード20中のグローバル変数群を表現するためのクラスである。   The SourceFile class (1000) is an aggregation class, and includes a Functions class (1100) and a Variables class (1200). The Functions class (1100) is a class for expressing all the functions defined in the source code 20. Also, the Functions class (1100) is an aggregation class and includes the Function class (1300). One Function class (1300) is a class for expressing one function in the source code 20. That is, the Functions class (1100) includes a group of Function classes (1300) representing each of the function groups. The Variables class (1200) is a class for expressing a global variable group in the source code 20.

作成されるSourceFileオブジェクト内を走査することにより、ソースコード20に記述されたプログラムの内容を把握することができる。図5は、C言語で記述されたソースコード20(test.c)がオブジェクトモデル化される例を示している。ソースコード20中には、大域変数21、main関数22、f1関数23、及びf2関数24が記述されている。このソースコード20の内容に従い、対応するクラスをインスタンス化することによって、1つのSouceFileオブジェクト(3000)が作成される。   The content of the program described in the source code 20 can be grasped by scanning the created SourceFile object. FIG. 5 shows an example in which the source code 20 (test.c) described in the C language is converted into an object model. In the source code 20, a global variable 21, a main function 22, an f1 function 23, and an f2 function 24 are described. One SourceFile object (3000) is created by instantiating the corresponding class according to the contents of the source code 20.

SourceFileオブジェクト(3000)は、Functionsオブジェクト(3100)及びVariablesオブジェクト(3200)を含んでいる。Functionsオブジェクト(3100)は、Functionオブジェクト(3300−1〜3300−3)を含んでいる。Variablesオブジェクト(3200)は、大域変数21に応じてVariablesクラス(1200)をインスタンス化することにより得られる。Functionオブジェクト(3300−1)は、main関数22の内容に基づいて、Functionクラス(1300)をインスタンス化することにより得られる。Functionオブジェクト(3300−2)は、f1関数23の内容に基づいて、Functionクラス(1300)をインスタンス化することにより得られる。Functionオブジェクト(3300−3)は、f2関数24の内容に基づいて、Functionクラス(1300)をインスタンス化することにより得られる。   The SourceFile object (3000) includes a Functions object (3100) and a Variables object (3200). The Functions object (3100) includes Function objects (3300-1 to 3300-3). The Variables object (3200) is obtained by instantiating the Variables class (1200) according to the global variable 21. The Function object (3300-1) is obtained by instantiating the Function class (1300) based on the content of the main function 22. The Function object (3300-2) is obtained by instantiating the Function class (1300) based on the contents of the f1 function 23. The Function object (3300-3) is obtained by instantiating the Function class (1300) based on the content of the f2 function 24.

また、図4を参照して、Functionクラス(1300)は、集約クラスである。このFunctionクラス(1300)は、Variablesクラス(1200)、Statementsクラス(1400)、ArgumentListクラス(1500)、及びConstantクラス(1930)を含んでいる。Statementsクラス(1400)は、関数に含まれるメソッド群を表現するためのクラスである。ArgumentListクラス(1500)は、関数の引数を表現するためのクラスである。Constantクラス(1930)は、関数で用いられる定数を表現するためのクラスである。また、この場合のVariablesクラス(1200)は、関数中で用いられる変数群を表現するためのクラスである。   Also, referring to FIG. 4, the Function class (1300) is an aggregation class. The Function class (1300) includes a Variables class (1200), a Statements class (1400), an ArgumentList class (1500), and a Constant class (1930). The Statements class (1400) is a class for expressing a method group included in the function. The ItemList class (1500) is a class for expressing function arguments. The Constant class (1930) is a class for expressing constants used in functions. In this case, the Variables class (1200) is a class for expressing a variable group used in the function.

Statementsクラス(1400)は、集約クラスであり、Statementクラス(1600)を含む。1つのStatementクラス(1600)は、関数中の1つのメソッド(文)を表現するためのクラスである。つまり、Statementsクラス(1400)は、メソッド群のそれぞれを表現する一群のStatementクラス(1600)を含む。また、Statementクラス(1600)は、「抽象クラス」である。Statementクラス(1600)を特化したサブクラスとして、クラス1601〜1609、及び1800が挙げられる。逆に言えば、様々なメソッドを表現するサブクラス1601〜1609、及び1800が汎化されたクラスが、Statementクラス(1600)である。   The Statements class (1400) is an aggregation class and includes a Statement class (1600). One Statement class (1600) is a class for expressing one method (statement) in the function. That is, the Statements class (1400) includes a group of Statement classes (1600) representing each of the method groups. The Statement class (1600) is an “abstract class”. As subclasses specialized for the Statement class (1600), classes 1601 to 1609 and 1800 are listed. Conversely, a class in which subclasses 1601 to 1609 and 1800 representing various methods are generalized is a Statement class (1600).

Statementクラス(1600)のサブクラスであるBreakクラス(1601)は、“Break文”を表現するためのクラスである。Continueクラス(1602)は、“Continue文”を表現するためのクラスである。DefineVariableクラス(1603)は、“変数宣言文”を表現するためのクラスである。DoWhileクラス(1604)は、“Do−Whileループ文”を表現するためのクラスである。Forクラス(1605)は、“Forループ文”を表現するためのクラスである。Ifクラス(1606)は、“If文”を表現するためのクラスである。Returnクラス(1607)は、“Return文”を表現するためのクラスである。Switchクラス(1608)は、“Switch文”を表現するためのクラスである。Whileクラス(1609)は、“While文”を表現するためのクラスである。   A Break class (1601), which is a subclass of the Statement class (1600), is a class for expressing a “Break statement”. The Continue class (1602) is a class for expressing a “Continue statement”. The Define Variable class (1603) is a class for expressing a “variable declaration statement”. The DoWhile class (1604) is a class for expressing a “Do-While loop statement”. The For class (1605) is a class for expressing a “For loop statement”. The If class (1606) is a class for expressing an “If statement”. The Return class (1607) is a class for expressing a “Return statement”. The Switch class (1608) is a class for expressing a “Switch statement”. The While class (1609) is a class for expressing a “while sentence”.

また、Statementクラス(1600)のサブクラスであるExpressionクラス(1800)は、演算子を用いる文を表現するためのクラスである。演算子を用いる文としては、例えば、「i = 1」が挙げられる。   An Expression class (1800), which is a subclass of the Statement class (1600), is a class for expressing a sentence using an operator. An example of a sentence that uses an operator is “i = 1”.

図6は、C言語で記述されたソースコード20中のForループ文がオブジェクトモデル化される例を示している。Forループ文中には、「初期化文」、「ループ条件文」、「更新文」、及び「実行文」が記述される。このように、Forループ文中には、更に文(Statements)が含まれており、特に、初期化文やループ条件文といった演算子を用いる文(Expression)が含まれている。ネストされた制御構文を表現するために、図7に示されるようにクラス階層を構成する。Statementsクラス(1400)は、Statementクラス(1600)のサブクラスであるForクラス(1605)、Ifクラス(1606)、Whileクラス(1609)といったループ文用クラスのリストを保持できる。各ループ文用クラスは、さらにその「実行文」を保持するためのStatementsクラス(1400)を保持する。このような構成により、多重ネストした制御構文を保持することが可能となる。尚、図4において、図7に示されたクラス階層の記載が省略されている。   FIG. 6 shows an example in which a For loop statement in the source code 20 written in C language is converted into an object model. In the For loop statement, an “initialization statement”, a “loop condition statement”, an “update statement”, and an “execution statement” are described. As described above, the For loop statement further includes statements (Statements), and particularly includes a statement (Expression) using an operator such as an initialization statement and a loop condition statement. In order to express the nested control syntax, a class hierarchy is constructed as shown in FIG. The Statements class (1400) can hold a list of loop statement classes such as a For class (1605), an If class (1606), and a While class (1609), which are subclasses of the Statement class (1600). Each loop statement class further holds a Statements class (1400) for holding the “executed statement”. With such a configuration, it is possible to maintain multiple nested control syntaxes. In FIG. 4, the class hierarchy shown in FIG. 7 is omitted.

図6に示されるように、Forループ文がオブジェクトモデル化されることにより、Forオブジェクト3605が作成される。Forオブジェクト3605は、Expressionオブジェクト3800−1〜3800−3、及びStatementsオブジェクト3400を含んでいる。Expressionオブジェクト(3800−1)は、初期化文の内容に基づいて、Expressionクラス(1800)をインスタンス化することにより得られる。Expressionオブジェクト(3800−2)は、ループ条件文の内容に基づいて、Expressionクラス(1800)をインスタンス化することにより得られる。Expressionオブジェクト(3800−3)は、更新文の内容に基づいて、Expressionクラス(1800)をインスタンス化することにより得られる。Statementsオブジェクト(3400)は、実行文の内容に基づいて、Statementsクラス(1400)をインスタンス化することにより得られる。このようにして、ネストされた制御構文がオブジェクトモデル化される。   As shown in FIG. 6, a For object 3605 is created by subjecting the For loop statement to an object model. The For object 3605 includes an Expression object 3800-1 to 3800-3 and a Statements object 3400. The Expression object (3800-1) is obtained by instantiating the Expression class (1800) based on the contents of the initialization statement. The Expression object (3800-2) is obtained by instantiating the Expression class (1800) based on the contents of the loop condition statement. The Expression object (3800-3) is obtained by instantiating the Expression class (1800) based on the content of the update sentence. The Statements object (3400) is obtained by instantiating the Statements class (1400) based on the contents of the executable statement. In this way, the nested control syntax is object modeled.

また、Expressionクラス(1800)は、Expressionsクラス(1700)に含まれており、Symbolクラス(1900)を含んでいる。このSymbolクラス(1900)は、シンボルを表現するための抽象クラスである。シンボルとは四則演算や代入文を構成する個々の値や演算子のことを指す。例えば、「i = 1」という文(Expression)は、“i”、“=”及び“1”という3つのシンボルの組み合わせにより構成されている。これら3つのシンボルはそれぞれ、変数、二項演算子及び定数に分類される。これら値や演算子を表現するために、Symbolクラス(1900)を特化したサブクラスとして、Valueクラス(1910)やOperatorクラス(1920)が用意されている。   The Expression class (1800) is included in the Expressions class (1700), and includes the Symbol class (1900). The Symbol class (1900) is an abstract class for expressing a symbol. Symbols refer to the individual values and operators that make up four arithmetic operations and assignment statements. For example, a sentence (Expression) “i = 1” is composed of a combination of three symbols “i”, “=”, and “1”. Each of these three symbols is classified as a variable, a binary operator, and a constant. In order to express these values and operators, a Value class (1910) and an Operator class (1920) are prepared as subclasses specialized in the Symbol class (1900).

Valueクラス(1910)は、Symbolクラス(1900)のサブクラスであり、「値」を表現するためのサブクラスである。同時に、Valueクラス(1910)は抽象クラスであり、そのサブクラスとして、変数を表現するためのVariableクラス(1940)と定数を表現するためのConstantクラス(1930)が用意されている。Variableクラス(1940)も抽象クラスであり、そのサブクラスとしては、例えば、整数の変数を表現するためのIntegerVariableクラス(1941)が挙げられる。また、Constanctクラス(1930)も抽象クラスであり、そのサブクラスとしては、例えば、変数の定数を表現するためのIntegerConstantクラス(1931)が挙げられる。   The Value class (1910) is a subclass of the Symbol class (1900), and is a subclass for expressing “value”. At the same time, the Value class (1910) is an abstract class, and as its subclass, a Variable class (1940) for expressing a variable and a Constant class (1930) for expressing a constant are prepared. The Variable class (1940) is also an abstract class, and its subclass includes, for example, an Integrated Variable class (1941) for expressing an integer variable. The Constant class (1930) is also an abstract class, and an example of a subclass thereof is an IntegratorConstant class (1931) for expressing a constant of a variable.

Operatorクラス(1920)は、Symbolクラス(1900)のサブクラスであり、「演算子」を表現するためのサブクラスである。同時に、Operatorクラス(1920)は抽象クラスであり、そのサブクラスとして、二項演算子を表現するためのBinaryOperatorクラス(1950)と、単項演算子を表現するためのMonadicOperatorクラス(1960)とが用意されている。BinaryOperatorクラス(1950)も抽象クラスであり、そのサブクラスとしては、例えば“=”を表現するためのAssignmentクラス(1951)が挙げられる。   The Operator class (1920) is a subclass of the Symbol class (1900), and is a subclass for expressing an “operator”. At the same time, the operator class (1920) is an abstract class, and as its subclasses, a binary operator class (1950) for expressing a binary operator and a magic operator class (1960) for expressing a unary operator are prepared. ing. The BinaryOperator class (1950) is also an abstract class, and its subclass includes, for example, an Assignment class (1951) for expressing “=”.

上述の「i = 1」という文の場合、シンボル“i”は、IntegerVariableクラス(1941)を用いてオブジェクト化される。同様に、シンボル“=”は、Assignmentクラス(1951)を用いてオブジェクト化される。また、シンボル“1”は、IntegerConstantクラス(1931)を用いてオブジェクト化される。図8は、「i = 1」を表現するExpressionオブジェクトを示している。このExpressionオブジェクトは、IntegerVariableオブジェクト(3941)、IntegerConstantオブジェクト(3931)、及びAssignmentオブジェクト(3951)を有している。図8に示されるように、これらオブジェクト(3941、3931、3951)は、「i、1、=」というように、逆ポーランド記法に準拠してスタックされている。このように、Expressionオブジェクトは、保持する文を構成するシンボルを、逆ポーランド順でスタックすることにより保持する。   In the case of the above-mentioned sentence “i = 1”, the symbol “i” is converted into an object using the IntegerVariable class (1941). Similarly, the symbol “=” is converted into an object using the Assignment class (1951). Further, the symbol “1” is converted into an object by using an IntegerConstant class (1931). FIG. 8 shows an Expression object representing “i = 1”. This Expression object has an Integer Variable object (3941), an Integrant Constant object (3931), and an Assignment object (3951). As shown in FIG. 8, these objects (3941, 3931, 3951) are stacked in conformity with the reverse Polish notation, such as “i, 1, =”. In this way, the Expression object holds the symbols constituting the sentence to be held by stacking them in reverse Polish order.

以上に説明された事項を参照して、あるソースコード20からソースコードオブジェクトモデル30Aが作成される1つの具体例を示す。図9は、変換されるソースコード20の例として、MatLabで記述されたMファイル(myfunc.m)を示している。このMファイルは、1つの関数「myfunc」からなる。関数myfuncは、行列の足し算を行い(C=A+B)、その演算結果を戻り値として返すという処理を行う。本発明に係る変換プログラム100のソースコードパース部110は、その処理内容に応じて、図4に示されたクラス群を適宜インスタンス化する。これにより、Mファイルがオブジェクトモデル化され、その処理内容を示すソースコードオブジェクトモデル30Aがメモリ12上に展開される。   A specific example in which a source code object model 30A is created from a certain source code 20 will be described with reference to the items described above. FIG. 9 shows an M file (myfunc.m) described in MatLab as an example of the source code 20 to be converted. This M file is composed of one function “myfunc”. The function myfunc performs matrix addition (C = A + B) and returns the result of the operation as a return value. The source code parsing unit 110 of the conversion program 100 according to the present invention appropriately instantiates the class group shown in FIG. 4 according to the processing content. As a result, the M file is converted into an object model, and a source code object model 30A indicating the processing content is developed on the memory 12.

図10は、本例において生成されるソースコードオブジェクトモデル30Aを示している。ソースコード20であるMファイルがオブジェクトモデル化されることにより、1つのSourceFileオブジェクト(3000)が生成される。このSourceFileオブジェクト(3000)は、関数myfuncに対応する1つのFunctionオブジェクト(3300)を有している。Functionオブジェクト(3300)は、関数内のメソッド群を表すStatementsオブジェクト(3400)を有している。また、Functionオブジェクト(3300)は、関数名や戻り値の型といったシグネチャをあらわすオブジェクト群を有している。   FIG. 10 shows a source code object model 30A generated in this example. One source file object (3000) is generated by converting the M file as the source code 20 into an object model. This SourceFile object (3000) has one Function object (3300) corresponding to the function myfunc. The Function object (3300) has a Statements object (3400) representing a method group in the function. The Function object (3300) has an object group representing a signature such as a function name and a return value type.

また、Statementsオブジェクト(3400)は、それぞれの演算文を表すExpressionオブジェクト(3800−1〜3800−4)を有している。図10に示されるように、各Expressionオブジェクトにおいて、Symbolオブジェクトは逆ポーランド記法に準拠してスタックされている。また、Statementsオブジェクト(3400)は、変数宣言を表すDefineVariableオブジェクト(3603)、及びreturn文を表すReturnオブジェクト(3607)を有している。本例において、これら2つのオブジェクト(3603、3607)は、構文解析部112の判断により自動的に作成される。つまり、構文解析部112は、読み込まれたソースコード20の文脈に基づいて、必要なオブジェクトを作成する。   Further, the Statements object (3400) has Expression objects (3800-1 to 3800-4) representing the respective operation statements. As shown in FIG. 10, in each Expression object, the Symbol object is stacked according to the reverse Polish notation. The Statements object (3400) includes a Define Variable object (3603) representing a variable declaration and a Return object (3607) representing a return statement. In this example, these two objects (3603, 3607) are automatically created based on the judgment of the syntax analysis unit 112. That is, the syntax analysis unit 112 creates a necessary object based on the context of the read source code 20.

2.処理後半(中間表現から出力まで)
図3Bは、本発明に係るデータ処理の後半を示しており、オブジェクトモデル30からホットスポット実装コード50が作成されるまでの処理を示している。現在、メモリ12上には、図10に示されたソースコードオブジェクトモデル30Aが作成されている。
2. Second half of processing (from intermediate representation to output)
FIG. 3B shows the second half of the data processing according to the present invention, and shows the processing until the hot spot mounting code 50 is created from the object model 30. Currently, the source code object model 30A shown in FIG.

ソースコードオブジェクトモデル30Aが作成された後、変換プログラム100は、記録媒体13から継承情報記述ファイル40を読み込む。この継承情報記述ファイル40には、生成されるホットスポット実装コード50をホットスポット3に適合させるための情報が記述されている。つまり、継承情報記述ファイル40には、実装対象であるホットスポット3に適合する条件が記述されており、生成されるホットスポット実装コード50に影響を及ぼす情報が記述されている。例えば、継承情報記述ファイル40に記述される情報は、ホットスポット3における抽象クラスを継承するための継承情報を含んでいる。   After the source code object model 30 </ b> A is created, the conversion program 100 reads the inheritance information description file 40 from the recording medium 13. In this inheritance information description file 40, information for adapting the generated hot spot mounting code 50 to the hot spot 3 is described. In other words, the inheritance information description file 40 describes conditions that match the hot spot 3 to be mounted, and describes information that affects the generated hot spot mounting code 50. For example, information described in the inheritance information description file 40 includes inheritance information for inheriting an abstract class in the hot spot 3.

図11は、継承情報記述ファイル40の一例を示している。継承情報記述ファイル40は、例えばXML(eXtensible Markup Language)で記述されるXMLファイルである。拡張子より前の名前は、例えば、ソースコード20(myfunc.m)と同じ名前である。図11に示された継承情報記述ファイル40(myfunc.xml)には、以下の継承情報が記述されている。   FIG. 11 shows an example of the inheritance information description file 40. The inheritance information description file 40 is an XML file described in, for example, XML (eXtensible Markup Language). The name before the extension is the same as the source code 20 (myfunc.m), for example. In the inheritance information description file 40 (myfunc.xml) shown in FIG. 11, the following inheritance information is described.

・“com.nec.some.frameworkパッケージ”を利用すること。
・スーパークラスは、上記パッケージの“FrameworkTemplateクラス”であること。つまり、出力されるコードは、上記パッケージの“FrameworkTemplateクラス”を継承する。
・出力されるコードは、staticクラスではない(“false”)こと。
Use the “com.nec.some.framework package”.
-The super class is the “Framework Template class” of the above package. That is, the output code inherits the “FrameworkTemplate class” of the package.
-The output code must not be a static class ("false").

このような継承情報記述ファイル40は、実装対象のホットスポット3の規格に応じて、開発者により作成されればよい。図3Bに示されるように、変換プログラム100の継承情報付与部120が、記録媒体13から継承情報記述ファイル40を読み込む。そのため、継承情報付与部120は、例えばXMLパーサ121を含んでいる。継承情報付与部120は、継承情報記述ファイル40に記述された継承情報を、ソースコードオブジェクトモデル30Aに付与する。これにより、継承情報が付与されたオブジェクトモデル30(以下、「継承情報付与後オブジェクトモデル30B」と参照される)が作成される。つまり、継承情報付与部120は、継承情報記述ファイル40を参照することによって、ソースコードオブジェクトモデル30Aを継承情報付与後オブジェクトモデル30Bに変換される。この継承情報付与後オブジェクトモデル30Bは、メモリ12上に展開されている。   Such an inheritance information description file 40 may be created by a developer according to the standard of the hot spot 3 to be mounted. As illustrated in FIG. 3B, the inheritance information adding unit 120 of the conversion program 100 reads the inheritance information description file 40 from the recording medium 13. Therefore, the inheritance information adding unit 120 includes an XML parser 121, for example. The inheritance information assigning unit 120 assigns the inheritance information described in the inheritance information description file 40 to the source code object model 30A. Thereby, the object model 30 to which the inheritance information is given (hereinafter referred to as “the object model 30B after the inheritance information is given”) is created. That is, the inheritance information adding unit 120 converts the source code object model 30A into the inherited information-added object model 30B by referring to the inheritance information description file 40. The inherited information-given object model 30B is expanded on the memory 12.

図12は、本例において生成される継承情報付与後オブジェクトモデル30Bを示している。図12に示されるように、継承情報付与後オブジェクトモデル30Bには、継承情報4000が付与されている。具体的には、SourceFileオブジェクト(3000)は、継承情報を格納するためのフィールド4100〜4500を有している。それらフィールド4100〜4500のそれぞれに、継承情報記述ファイル40に記述された情報が格納されている。例えば、フィールド4100には、パッケージ名“com.nec.som.framework”が記録されている。フィールド4200には、スーパークラス名“FrameworkTemplate”が記録されている。フィールド4500には、“false”が記録されている。このように、継承情報付与部120は、ソースコード20の処理内容が反映されたソースコードオブジェクトモデル30Aが保持していない情報を付与する。これにより、ホットスポット30に適合するホットスポット実装コード50を生成するための準備が整う。   FIG. 12 shows the inherited information-added object model 30B generated in this example. As shown in FIG. 12, the inheritance information 4000 is assigned to the object model 30B after the inheritance information is given. Specifically, the SourceFile object (3000) has fields 4100 to 4500 for storing inheritance information. Information described in the inheritance information description file 40 is stored in each of the fields 4100 to 4500. For example, in the field 4100, a package name “com.nec.som.framework” is recorded. In the field 4200, a super class name “Framework Template” is recorded. In the field 4500, “false” is recorded. As described above, the inheritance information assigning unit 120 assigns information that is not held by the source code object model 30A in which the processing content of the source code 20 is reflected. Thereby, the preparation for generating the hot spot mounting code 50 suitable for the hot spot 30 is completed.

最後に、変換プログラム100のアウトプット部130は、メモリ12上の継承情報付与後オブジェクトモデル30B中の各インスタンスをコード化することにより、ホットスポット実装コード50を作成する。例えば、アウトプット部130は、デザインパターンの一つである「Visitorパターン」に基づいて構築される。一般に、Visitorオブジェクトは、集合の要素を一つ一つ巡って、所定の処理を実行していく。本例の場合、「集合の要素」とは、図12に示された継承情報付与後オブジェクトモデル30Bの各インスタンスである。また、「所定の処理」とは、各インスタンスの内容を解釈し、コードを作成することである。図4に示されたクラス群の各々は、Visitorオブジェクトを受けいれる(Acceptする)ように設定されていればよい。アウトプット部130は、図12に示されたSourceFileオブジェクト3000をルート要素とするオブジェクトツリー上を渡り歩き、各オブジェクトを順次コード化する。   Finally, the output unit 130 of the conversion program 100 creates the hot spot mounting code 50 by encoding each instance in the object model 30B after the inheritance information is added on the memory 12. For example, the output unit 130 is constructed based on a “Visitor pattern” that is one of design patterns. In general, a Visitor object goes through each element of a set and executes a predetermined process. In the case of this example, the “elements of the set” are each instance of the inherited information added object model 30B shown in FIG. The “predetermined process” is to interpret the contents of each instance and create a code. Each of the class groups shown in FIG. 4 only needs to be set so as to receive (Accept) a Visitor object. The output unit 130 walks over an object tree having the Source File object 3000 shown in FIG. 12 as a root element, and sequentially encodes each object.

図13は、アウトプット部130による処理を示すフローチャートである。また、図14は、作成されるホットスポット実装コード50の一例を示している。本例において、出力ファイルの形式は、Java(登録商標)に設定されているとする。この場合、ホットスポット実装コード50として、Java(登録商標)ファイル(myfunc.java)が作成される。尚、ホットスポット実装コード50において、数値計算ライブラリ(com.nec.some.numericalパッケージ)も利用されるとする。   FIG. 13 is a flowchart showing processing by the output unit 130. FIG. 14 shows an example of the hot spot mounting code 50 to be created. In this example, it is assumed that the format of the output file is set to Java (registered trademark). In this case, a Java (registered trademark) file (myfunc.java) is created as the hot spot mounting code 50. In the hot spot mounting code 50, it is assumed that a numerical calculation library (com.nec.some.numeral package) is also used.

まず、アウトプット部130は、SourceFileオブジェクト3000を発見すると、クラスの出力を開始する(ステップS1)。アウトプット部130は、図12に示された継承情報4000を参照し、クラスの宣言部の出力を行う(ステップS2)。その結果、図14に示されるように、クラスの継承関係が、ホットスポット実装コード50の宣言部に出力される。   First, when the output unit 130 finds the SourceFile object 3000, it starts outputting the class (step S1). The output unit 130 refers to the inheritance information 4000 shown in FIG. 12, and outputs the class declaration unit (step S2). As a result, as shown in FIG. 14, the class inheritance relationship is output to the declaration part of the hotspot implementation code 50.

次に、アウトプット部130は、各関数のコード化を行う。具体的には、未出力のFunctionオブジェクト3300があるかどうか判定される(ステップS3)。未出力のFunctionオブジェクト3300がある場合(ステップS3;Yes)、アウトプット部130は、そのFunctionオブジェクト3300によるメソッドの出力を開始する(ステップS4)。まず、メソッドのシグネチャ(図12参照)の出力が行われる(ステップS5)。その結果、図14に示されるように、関数のシグネチャが出力される。   Next, the output unit 130 codes each function. Specifically, it is determined whether there is a function object 3300 that has not been output (step S3). When there is a function object 3300 that has not been output (step S3; Yes), the output unit 130 starts outputting a method using the function object 3300 (step S4). First, a method signature (see FIG. 12) is output (step S5). As a result, the signature of the function is output as shown in FIG.

次に、アウトプット部130は、各関数の実装文を順番にコード化する。具体的には、未出力のStatementオブジェクトがあるかどうか判定される(ステップS6)。未出力のStatementオブジェクトがある場合(ステップS6;Yes)、アウトプット部130は、そのStatementオブジェクトによる実装文を出力する(ステップS7)。   Next, the output unit 130 sequentially codes the implementation statements of each function. Specifically, it is determined whether there is an unoutput Statement object (step S6). When there is a statement object that has not been output (step S6; Yes), the output unit 130 outputs an implementation sentence based on the statement object (step S7).

処理中のFunctionオブジェクト3000が有する全てのStatementオブジェクトについてコード化が終了すると(ステップS6;No)、そのFunctionオブジェクト3300に関する出力処理は終了する(ステップS8)。全てのFunctionオブジェクト3300についてコード化が終了すると(ステップS3;No)、クラスの出力処理が終了する(ステップS9)。   When the encoding is completed for all the State objects included in the Function object 3000 being processed (Step S6; No), the output process related to the Function object 3300 is ended (Step S8). When encoding is completed for all Function objects 3300 (step S3; No), the class output process ends (step S9).

以上の処理により、ソースコード20は、実装対象のホットスポット3に適合したホットスポット実装コード50に変換される。上述の例においては、実装対象のフレームワーク1はJava(登録商標)言語で実装されているが、開発者は、ソースコード20をMatLabで開発することができる。つまり、数値計算の記述性に優れたMatlabを用いてホットスポット3のコーディングが行われ、Java(登録商標)フレームワークのホットスポット3の実装が行われている。継承情報記述ファイル40で指定された継承関係を参照することにより、ソースコード20中に記述された行列計算が、ホットスポット3に適合する形でホットスポット実装コード50中に実現されている。   Through the above processing, the source code 20 is converted into a hot spot mounting code 50 suitable for the hot spot 3 to be mounted. In the above example, the implementation target framework 1 is implemented in the Java (registered trademark) language, but the developer can develop the source code 20 with MatLab. That is, coding of the hot spot 3 is performed using Matlab which is excellent in descriptiveness of numerical calculation, and mounting of the hot spot 3 of the Java (registered trademark) framework is performed. By referring to the inheritance relationship specified in the inheritance information description file 40, the matrix calculation described in the source code 20 is realized in the hot spot implementation code 50 in a form suitable for the hot spot 3.

以上に説明されたように、本発明に係る開発システム及び開発プログラムによれば、フレームワーク1の利用者(システムの開発者)は、ホットスポット3を実装する処理内容に応じて、最適な開発言語を選択することが可能となる。つまり、本発明によれば、開発者は、自分が得意とするプログラミング言語を利用して、ホットスポット実装コード50を開発することが可能となる。従って、ホットスポット実装コード50の開発効率が向上する。最適な言語を利用してホットスポット3の実装を行うことができるため、開発者は、フレームワーク1を利用するシステムを短期間で効率良く開発することが可能となる。ソースコードパース部110とアウトプット部130がサポートするプログラミング言語を拡張することによって、あらゆるフレームワーク1に本発明を適用することが可能となる。   As described above, according to the development system and the development program according to the present invention, the user of the framework 1 (system developer) can perform the optimum development according to the processing content for mounting the hot spot 3. A language can be selected. That is, according to the present invention, the developer can develop the hot spot mounting code 50 using a programming language that he / she is good at. Therefore, the development efficiency of the hot spot mounting code 50 is improved. Since the hotspot 3 can be implemented using an optimal language, the developer can efficiently develop a system that uses the framework 1 in a short period of time. By extending the programming language supported by the source code parsing unit 110 and the output unit 130, the present invention can be applied to any framework 1.

図1は、本発明の全体的な概念を示す図である。FIG. 1 is a diagram showing the overall concept of the present invention. 図2は、本発明に係る実装コード開発システムの構成を示すブロック図である。FIG. 2 is a block diagram showing the configuration of the implementation code development system according to the present invention. 図3Aは、本発明に係るデータ処理の前半を示すブロック図である。FIG. 3A is a block diagram showing the first half of data processing according to the present invention. 図3Bは、本発明に係るデータ処理の後半を示すブロック図である。FIG. 3B is a block diagram showing the second half of the data processing according to the present invention. 図4は、本発明に係るオブジェクトモデルを構成するためのクラス群を示すクラス図である。FIG. 4 is a class diagram showing a class group for configuring the object model according to the present invention. 図5は、C言語で記述されたソースコードをオブジェクトモデルへ変換する例を示す図である。FIG. 5 is a diagram illustrating an example of converting source code described in C language into an object model. 図6は、ソースコード中のfor文をオブジェクトモデルへ変換する例を示す図である。FIG. 6 is a diagram illustrating an example of converting a for sentence in a source code into an object model. 図7は、ネストされた制御構文を表現するためのクラス階層を示す図である。FIG. 7 is a diagram showing a class hierarchy for expressing a nested control syntax. 図8は、「i=1」を表現するExpressionオブジェクト中のスタックの図である。FIG. 8 is a diagram of a stack in the Expression object representing “i = 1”. 図9は、ソースコードの例としてのMatlabファイルを示す図である。FIG. 9 is a diagram illustrating a Matlab file as an example of source code. 図10は、ソースコードオブジェクトモデルの一例を示す概念図である。FIG. 10 is a conceptual diagram illustrating an example of a source code object model. 図11は、継承情報記述ファイルの一例を示す図である。FIG. 11 is a diagram illustrating an example of the inheritance information description file. 図12は、継承情報付与後オブジェクトモデルの一例を示す概念図である。FIG. 12 is a conceptual diagram showing an example of the object model after the inheritance information is given. 図13は、本発明に係るアウトプット部による処理を示すフローチャートである。FIG. 13 is a flowchart showing processing by the output unit according to the present invention. 図14は、生成されるホットスポット実装コードの例としてのJava(登録商標)ファイルを示す図である。FIG. 14 is a diagram showing a Java (registered trademark) file as an example of the generated hot spot mounting code.

符号の説明Explanation of symbols

1 フレームワーク
2 フローズンスポット
3 ホットスポット
10 実装コード開発システム
11 演算処理装置
12 メモリ
13 記録媒体
14 入力装置
15 表示装置
20 ソースコード
30 オブジェクトモデル
30A ソースコードオブジェクトモデル
30B 継承情報付与後オブジェクトモデル
40 継承情報記述ファイル
50 ホットスポット実装コード
100 変換プログラム
110 ソースコードパース部
111 字句解析部
112 構文解析部
113 拡張子判定部
120 継承情報付与部
130 アウトプット部
1000 SourceFileクラス
1100 Functionsクラス
1200 Variablesクラス
1300 Functionクラス
1400 Statementsクラス
1600 Statementクラス
1800 Expressionクラス
3000 SourceFileオブジェクト
3100 Functionsオブジェクト
3200 Variablesオブジェクト
3300 Functionオブジェクト
3400 Statementsオブジェクト
3600 Statementオブジェクト
3800 Expressionオブジェクト
4000 継承情報
DESCRIPTION OF SYMBOLS 1 Framework 2 Frozen spot 3 Hot spot 10 Implementation code development system 11 Arithmetic processing device 12 Memory 13 Recording medium 14 Input device 15 Display device 20 Source code 30 Object model 30A Source code object model 30B Object model after giving inheritance information 40 Inheritance information Description file 50 Hot spot implementation code 100 Conversion program 110 Source code parsing section 111 Lexical analysis section 112 Syntax analysis section 113 Extension determination section 120 Inheritance information assignment section 130 Output section 1000 SourceFile class 1100 Functions class 1200 Variables class 1300 Function class 1400 Statements class 1600 Statement class 1800 Expression class 3000 SourceFile object 3100 Functions object 3200 Variables object 3300 Functions object 3400 Statements object 3600 Statement object 3800 Expression object 4000 Inheritance information

Claims (6)

フレームワークのホットスポットを実装するホットスポット実装コードを開発するための実装コード開発プログラムであって、
ソースコード、及び前記ホットスポットにおける抽象クラスを継承するための継承情報を含む継承情報記述ファイルが格納される記録媒体と、演算処理装置と、メモリと、を備えた実装コード開発システムにおいて、
前記演算処理装置に、
(A)前記記録媒体から前記ソースコードを読み込むステップと、
(B)プログラミング言語の種類に依らず共通な様々な処理内容を表現するための所定のクラス群を用い、前記ソースコードの処理内容を反映するように前記所定のクラス群をインスタンス化することによって、前記ソースコードの処理内容を示す第1オブジェクトモデルを生成し、前記第1オブジェクトモデルを前記メモリ上に展開するステップと、
(C)前記記録媒体から前記継承情報記述ファイルを読み込み、前記第1オブジェクトモデルに前記継承情報を格納したフィールドを追加し、前記継承情報が付与された第2オブジェクトモデルを生成するステップと、
(D)前記メモリ上に展開された前記第2オブジェクトモデルにおける継承情報を参照して、クラスの継承関係が前記ホットスポット実装コードの宣言部に出力し、前記第2オブジェクトモデルにおける関数がコード化して、所定のプログラミング言語で記述される前記ホットスポット実装コードを作成するステップと
を実行させる
実装コード開発プログラム。
An implementation code development program for developing a hot spot implementation code that implements a framework hot spot,
In an implementation code development system comprising a source code and a recording medium storing an inheritance information description file including inheritance information for inheriting an abstract class in the hot spot, an arithmetic processing unit, and a memory,
In the arithmetic processing unit,
(A) reading the source code from the recording medium;
(B) By using a predetermined class group for expressing various common processing contents regardless of the type of programming language, and instantiating the predetermined class group to reflect the processing contents of the source code Generating a first object model indicating the processing contents of the source code, and expanding the first object model on the memory;
(C) reading the inheritance information description file from the recording medium , adding a field storing the inheritance information to the first object model, and generating a second object model to which the inheritance information is assigned;
(D) Referring to the inheritance information in the second object model developed on the memory , the class inheritance relationship is output to the declaration part of the hot spot implementation code, and the function in the second object model is coded. And a step of creating the hot spot mounting code described in a predetermined programming language.
請求項1に記載の実装コード開発プログラムであって、
前記(B)ステップは、
(B1)前記ソースコードに含まれる字句を抽出するステップと、
(B2)前記抽出された字句に基づいて、前記ソースコードの構文を解析するステップと、
(B3)前記構文の解析結果に基づいて前記所定のクラス群をインスタンス化することにより、前記第1オブジェクトモデルを前記メモリ上に展開するステップと
を含む
実装コード開発プログラム。
An implementation code development program according to claim 1,
The step (B)
(B1) extracting a lexical phrase included in the source code;
(B2) analyzing the syntax of the source code based on the extracted lexical phrase;
(B3) An implementation code development program including the step of instantiating the predetermined class group based on the syntax analysis result to expand the first object model on the memory.
請求項1に記載の実装コード開発プログラムであって、
前記(B)ステップは、
(b1)前記ソースコードの拡張子を識別することにより、前記ソースコードのファイル形式を決定するステップと、
(b2)前記ファイル形式に準拠して、前記ソースコードに含まれる字句を抽出するステップと、
(b3)前記抽出された字句及び前記ファイル形式に基づいて、前記ソースコードの構文を解析するステップと、
(b4)前記構文の解析結果に基づいて前記所定のクラス群をインスタンス化することにより、前記第1オブジェクトモデルを前記メモリ上に展開するステップと
を含む
実装コード開発プログラム。
An implementation code development program according to claim 1,
The step (B)
(B1) determining a file format of the source code by identifying an extension of the source code;
(B2) extracting a lexical phrase included in the source code in accordance with the file format;
(B3) analyzing the syntax of the source code based on the extracted tokens and the file format;
(B4) A step of developing the first object model on the memory by instantiating the predetermined class group based on the analysis result of the syntax.
請求項1乃至3のいずれかに記載の実装コード開発プログラムであって、
前記(D)ステップは、デザインパターンであるVisitorパターンに基づいて、前記第2オブジェクトモデルに含まれる複数のインスタンスを順番に巡りながら、前記ホットスポット実装コードを作成する
実装コード開発プログラム。
An implementation code development program according to any one of claims 1 to 3,
The step (D) is a mounting code development program that creates the hot spot mounting code while sequentially visiting a plurality of instances included in the second object model based on a visitor pattern that is a design pattern.
請求項1乃至4のいずれかに記載の実装コード開発プログラムであって、
前記所定のクラス群は、
前記ソースコードを表現するためのSourceFileクラスと、
前記ソースコードに含まれる関数群を表現するためのFunctionsクラスと、
前記ソースコードに含まれる変数群を表現するためのVariablesクラスと
を含み、
前記SourceFileクラスは、集約クラスであり、前記Functionsクラス及び前記Variablesクラスを含む
実装コード開発プログラム。
An implementation code development program according to any one of claims 1 to 4,
The predetermined class group is:
A SourceFile class for representing the source code;
Functions class for expressing a function group included in the source code;
A Variables class for expressing a variable group included in the source code, and
The SourceFile class is an aggregation class, and includes the Functions class and the Variables class.
請求項5に記載の実装コード開発プログラムであって、
前記Functionsクラスは、集約クラスであり、前記関数群に含まれる関数を表現するためのFunctionクラスを含み、
前記Functionクラスは、集約クラスであり、
前記関数に含まれるメソッド群を表現するためのStatementsクラスと、
前記関数の引数を表現するためのArgumentListクラスと、
前記関数で用いられる変数群を表現するための前記Variablesクラスと、
前記関数で用いられる定数を表現するためのConstantクラスと
を含む
実装コード開発プログラム。
An implementation code development program according to claim 5,
The Functions class is an aggregation class, and includes a Function class for expressing a function included in the function group.
The Function class is an aggregation class,
A Statements class for representing a method group included in the function;
An ArgumentList class for expressing arguments of the function;
The Variables class for representing a group of variables used in the function;
An implementation code development program including a Constant class for expressing a constant used in the function.
JP2005160427A 2005-05-31 2005-05-31 Implementation code development system and implementation code development program Expired - Fee Related JP5399601B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005160427A JP5399601B2 (en) 2005-05-31 2005-05-31 Implementation code development system and implementation code development program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005160427A JP5399601B2 (en) 2005-05-31 2005-05-31 Implementation code development system and implementation code development program

Publications (2)

Publication Number Publication Date
JP2006338190A JP2006338190A (en) 2006-12-14
JP5399601B2 true JP5399601B2 (en) 2014-01-29

Family

ID=37558713

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005160427A Expired - Fee Related JP5399601B2 (en) 2005-05-31 2005-05-31 Implementation code development system and implementation code development program

Country Status (1)

Country Link
JP (1) JP5399601B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4971095B2 (en) * 2007-10-12 2012-07-11 株式会社野村総合研究所 Coding support device
JP4971096B2 (en) * 2007-10-12 2012-07-11 株式会社野村総合研究所 Coding support device
US9892272B2 (en) 2010-03-31 2018-02-13 Irdeto B.V. System and method for encapsulating and enabling protection through diverse variations in software libraries

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0231235A (en) 1988-07-20 1990-02-01 Nec Software Ltd Syntax analyzing system for plural languages
JPH02133824A (en) 1988-11-14 1990-05-23 Yokogawa Electric Corp Translator
JP2000112769A (en) 1998-10-02 2000-04-21 Nec Software Ltd Multistage translator
JP2001222486A (en) * 2000-02-10 2001-08-17 Mitsubishi Electric Corp Network management agent device, method for managing network and computer readable recording medium recording program for allowing computer to execute the method
JP2002157117A (en) * 2000-11-21 2002-05-31 Mitsubishi Electric Corp Framework development assisting device and framework development assisting method
US8122106B2 (en) * 2003-03-06 2012-02-21 Microsoft Corporation Integrating design, deployment, and management phases for systems
JP4686117B2 (en) 2003-06-05 2011-05-18 インターナショナル・ビジネス・マシーンズ・コーポレーション Source code conversion apparatus, source code conversion method, and program

Also Published As

Publication number Publication date
JP2006338190A (en) 2006-12-14

Similar Documents

Publication Publication Date Title
US11036614B1 (en) Data control-oriented smart contract static analysis method and system
JP4130713B2 (en) Program converter
US7293261B1 (en) Language-neutral representation of software code elements
EP1178404B1 (en) Method and system for compiling multiple languages
KR101086082B1 (en) An extensible type system for representing and checking consistency of program components during the process of compilation
US8516458B2 (en) System representation and handling techniques
KR101213890B1 (en) Using strong data types to express speech recognition grammars in software programs
US20060200796A1 (en) Program development apparatus, method for developing a program, and a computer program product for executing an application for a program development apparatus
Crary et al. Intensional polymorphism in type-erasure semantics
CN113504914A (en) Operating system construction compiling method and device, electronic equipment and storage medium
JP4652680B2 (en) Compiling method and apparatus, and compiler
RU2347269C2 (en) System and method of declarative definition and use of subclasses in marking
JP5399601B2 (en) Implementation code development system and implementation code development program
JP2009169864A (en) Compile method and compile program
JP2008276735A (en) Program code converter and program code conversion method
US9697021B2 (en) Modifiable high-level intermediate representation of source code
Fritzson et al. Metamodelica–a symbolic-numeric modelica language and comparison to julia
Amatriain et al. A framework for efficient and rapid development of cross-platform audio applications
KR100846203B1 (en) Method for generating mobile application and record media recorded program for realizing the same
Walia et al. Sham: A DSL for Fast DSLs
Jeffery Build Your Own Programming Language: A programmer's guide to designing compilers, interpreters, and DSLs for solving modern computing problems
Mårtensson et al. Extending a Small Language with a Java Bytecode Back End
KR100276086B1 (en) Method for generating a c++ code from lotos specitication
JP2000242485A (en) System and method for supporting programming language translation program development and recording medium
Zykov Elegance Enhanced: Object Types and Collections

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080414

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110330

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110819

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111013

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20111102

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111130

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20120112

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120411

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20120418

A912 Removal of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A912

Effective date: 20120511

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130906

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131024

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees