JPS61204741A - Compressing method for source program - Google Patents
Compressing method for source programInfo
- Publication number
- JPS61204741A JPS61204741A JP60044477A JP4447785A JPS61204741A JP S61204741 A JPS61204741 A JP S61204741A JP 60044477 A JP60044477 A JP 60044477A JP 4447785 A JP4447785 A JP 4447785A JP S61204741 A JPS61204741 A JP S61204741A
- Authority
- JP
- Japan
- Prior art keywords
- symbol table
- variable
- source program
- string
- word
- 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
Links
Landscapes
- Devices For Executing Special Programs (AREA)
Abstract
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明はパーソナルコンビーータにおいて広く利用され
ているBASICインiシリタなどのイン〆ケリタにお
いて、ソースプログラムを中間コードに変換する際のソ
ースプログラムの圧縮方法に関する。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention is applied to a source program for converting a source program into intermediate code in an inverter such as a BASIC initiator that is widely used in personal converters. Concerning a compression method.
例えば従来のRASICインタープリタなどのインター
プリタでは、ソースプログラムに殆んど変換を加えない
で直接解釈実行するものや、中間コード化してデータを
圧縮した後解釈実行するものなどがある。しかし、従来
の中間コード化方法においては、一部の演算子、予約語
および数値定数のみフード化し、それ以外の文字列定数
および変数については、外部表現の文字コードのまま中
間コードに転記する様な方法がとられてい比。For example, among interpreters such as conventional RASIC interpreters, there are those that directly interpret and execute the source program with almost no conversion, and those that compress data by converting it into intermediate code and then execute the interpretation. However, in the conventional intermediate coding method, only some operators, reserved words, and numeric constants are converted into hoods, and other string constants and variables are transferred to the intermediate code with the character code of the external representation. A method is being used.
このような従来の方法においては、ソースプログラムに
殆ど変換を加えないものは勿論、中間コード化して圧縮
する方法においても、一部の演算子、予約語および数値
定数はコード化されていても、それ以外のものは外部表
現の文字コードのitのデータであるので、ソースプロ
グラムのデータの大きさと比べての圧縮率は小さい。In such conventional methods, not only methods that hardly transform the source program, but also methods that compress the source program by converting it into intermediate code, even if some operators, reserved words, and numerical constants are encoded, Since the other data is externally expressed character code IT data, the compression rate is small compared to the size of the source program data.
また、中間コード化されていても、このように一部が外
部表現の文字コードのままであるため、このようなプロ
グラムを実行する場合には、字句解析を行いつつ解釈実
行する必要がある。Furthermore, even if the program is converted into an intermediate code, part of it remains in the character code of the external representation, so when executing such a program, it is necessary to interpret and execute it while performing lexical analysis.
例えば、変数にお込て、変数名の文字長が8文字まで許
されているとすると、最大8回文字コードを読んで字句
解析を行い実行することになるので、実行速度の向上の
うえで制約となる。For example, if you put it in a variable and the length of the variable name is allowed to be up to 8 characters, the character code will be read a maximum of 8 times, lexical analysis will be performed, and the execution will be executed. It becomes a constraint.
ま之、例えば「goto *ラベル」の如く、ラベルに
よって分岐する処理の場合もラベル名を外部表現の文字
コードのまま転記するような方法であったため、これも
−々文字コードを読んだ上で解釈実行することになり、
更に「*ラベル」の飛び先が実行している行よシ後にあ
る場合には中間コードを「*ラベル」が現れるまで1文
字ずつ読み飛ばしていかざるを得す、実行速度の低下は
免れない。For example, in the case of a process that branches by a label, such as "goto *label", the label name was transcribed as it is in the external representation character code, so this is also done after reading the character code. Interpretation will be carried out,
Furthermore, if the jump destination of "*label" is after the line being executed, the intermediate code must be skipped character by character until "*label" appears, which inevitably reduces execution speed.
本発明はこのような従来の欠点に鑑み、中間コードの圧
縮率を上げ、特に処理速度の向上を可能にするソースプ
ログラムの圧縮方法を提供するものでおる。In view of these conventional drawbacks, the present invention provides a source program compression method that increases the compression rate of intermediate code and, in particular, makes it possible to improve processing speed.
前記問題点を解決するための手段は、コード化処理手段
と、予め登録した予約記号衣と変数記号表の登録領域を
備えた記憶手段を有し、前記コード化処理手段はソース
プログラムを構成する字句を演算子予約語群、数値定数
群、文字列定数群と変数群に分類すると共に前記予約記
号衣をそれぞれ参照して演算子予約語群に属する字句に
は対応する字句番号を与え、数値定数群に属する字句に
は対応する字句番号とコード化した数値を与え、文字列
定数群に属する字句には対応する字句番号と該文字列の
長さを示す数値と該文字列の字句を与え、変数群に属す
る字句については該字句を変数記号表に登録しかつ対応
する字句番号と該記号表上の登録位置番号を与えて、出
力することを特徴とするソースプログラムの圧縮方法で
ある。Means for solving the above problem includes an encoding processing means and a storage means having a registration area for reserved symbols and variable symbol tables registered in advance, and the encoding processing means constitutes a source program. Classify the tokens into operator reserved word group, numeric constant group, string constant group, and variable group, refer to each of the reserved symbols, give the corresponding token number to the token belonging to the operator reserved word group, and assign numerical value. A token belonging to a constant group is given a corresponding token number and a coded numerical value, and a token belonging to a string constant group is given a corresponding token number, a numerical value indicating the length of the string, and the token of the string. , is a source program compression method characterized by registering a token belonging to a variable group in a variable symbol table, giving a corresponding token number and a registration position number on the symbol table, and outputting the token.
本発明を実施例に基き詳細に説明する。第1図は本発明
の概念を示すブロック図、第2図は第1図のコード化処
理手段をプログラムで実現した場合の例を示すフローチ
ャート、第3図はソースプログラムの例、第4図は該ソ
ースプログラムを前記実施例に従って中間コード化した
例を示す。第1図において、コード化処理手段2はソー
スプログラム1から次々に字句を得てこれを分類し、字
句と字句番号の対応表を有する予約記号衣3を参照して
対応する字句番号等を生成しこれを中間コード5として
出力する。The present invention will be explained in detail based on examples. Fig. 1 is a block diagram showing the concept of the present invention, Fig. 2 is a flowchart showing an example of implementing the encoding processing means of Fig. 1 as a program, Fig. 3 is an example of a source program, and Fig. 4 is An example in which the source program is converted into intermediate code according to the embodiment described above is shown. In FIG. 1, the encoding processing means 2 obtains tokens one after another from the source program 1, classifies them, and generates corresponding token numbers etc. by referring to a reserved symbol 3 having a correspondence table of tokens and token numbers. This is then output as intermediate code 5.
即ち、コード化処理手段2は第2図において、以下のよ
うに動作する。まず次々に字句を得て1)行番号であれ
ば、字句番号と行番号を出力する。That is, the encoding processing means 2 operates as follows in FIG. First, it obtains tokens one after another and 1) If it is a line number, outputs the token number and line number.
2)演算子が予約語であれば、各々に対応する字句番号
を出力する。2) If the operators are reserved words, output the lexical number corresponding to each.
3)数値定数であれば字句番号と内部表現に変換した数
値を出力する。3) If it is a numerical constant, output the lexical number and the numerical value converted to internal representation.
4)文字列定数であれば、字句番号と文字長と該文字列
を出力する。4) If it is a string constant, output the lexical number, character length, and the string.
5)上記の1)〜4)のいずれでもなければ変数として
変数記号表に登録し、字句番号と登録位置番号を出力す
る。5) If it is none of the above 1) to 4), register it as a variable in the variable symbol table and output the lexical number and registration position number.
以上のように動作するから、この例に第3図のソースプ
ログラムを入力すると、行の先頭の数字100は行番号
であるので、対応する字句番号(=1)と行番号(=1
00)が出力される。次のSUMは、行番号、演算子、
予約語、数値定数、文字列定数のいずれでもないので、
変゛数記号表に登録し、字句番号(=10)と登録位置
番号(=1)が出力される。次の=は演算子であるので
、対応する字句番号(=7)が出力され、以下同様の動
作によって、第4図に示すような中間コードと変数記号
表が作成出力される。うベルについては、変数として取
り扱われ、変数記号表に登録されると共に、変数に対応
する字句番号と登録位置番号が与えられる。Since it operates as described above, if you input the source program shown in Figure 3 into this example, the number 100 at the beginning of the line is the line number, so the corresponding lexical number (=1) and line number (=1
00) is output. The next SUM contains the line number, operator,
It is not a reserved word, numeric constant, or string constant, so
It is registered in the variable symbol table, and the lexical number (=10) and registration position number (=1) are output. Since the next = is an operator, the corresponding lexical number (=7) is output, and the same operation is performed to create and output an intermediate code and variable symbol table as shown in FIG. The variable is treated as a variable and registered in the variable symbol table, and is given the lexical number and registration position number corresponding to the variable.
以上のとおり本発明のソースプログラムの圧縮方法によ
れば、演算子、予約語、数値定数のみならず、変数、文
字列定数についてもコード化するので圧縮率が大きい。As described above, according to the source program compression method of the present invention, not only operators, reserved words, and numerical constants, but also variables and character string constants are encoded, so that the compression ratio is high.
更に変数(ラベルを含む)等全ての字句について字句番
号が与えられ、中間コードは字句番号によって直ちにそ
の意味が理解される。特に変数、ラベルについては従来
の如く一文字ずつ読んで字句解析をしたうえ実行する手
間がなく、字句番号と変数記号表によって直ちにその内
容を知ることができ、実行速度の高速化を図ることがで
きるなどの多くの利点がある。Furthermore, lexical numbers are given to all lexical items such as variables (including labels), and the meaning of the intermediate code can be immediately understood by the lexical numbers. In particular, for variables and labels, there is no need to read each character one by one, perform lexical analysis, and then execute it, as in the past, and the contents can be immediately known from the lexical number and variable symbol table, increasing execution speed. There are many advantages such as.
第1図は本発明の概念を示すプロ、り図、第2図はコー
ド化処理手段の例を示すフローチャート、第3図はソー
スプログラムの例、第4図は第3図のソースプログラム
を中間コード化した例の説明図である。Fig. 1 is a program diagram showing the concept of the present invention, Fig. 2 is a flowchart showing an example of the encoding processing means, Fig. 3 is an example of a source program, and Fig. 4 is an intermediate diagram of the source program of Fig. 3. FIG. 2 is an explanatory diagram of a coded example.
Claims (1)
号表の登録領域を備えた記憶手段を有し、前記コード化
処理手段はソースプログラムを構成する字句を演算子予
約語群、数値定数群、文字列定数群と変数群に分類する
と共に前記予約記号表をそれぞれ参照して演算子予約語
群に属する字句には対応する字句番号を与え、数値定数
群に属する字句には対応する字句番号とコード化した数
値を与え、文字列定数群に属する字句には対応する字句
番号と該文字列の長さを示す数値と該文字列の字句を与
え、変数群に属する字句については該字句を変数記号表
に登録しかつ対応する字句番号と該記号表上の登録位置
番号を与えて出力することを特徴とするソースプログラ
ムの圧縮方法。It has an encoding processing means and a storage means having a registration area for a reserved symbol table and a variable symbol table registered in advance. , and classify them into a string constant group and a variable group, refer to the reserved symbol table, and assign corresponding lexical numbers to tokens belonging to the operator reserved word group, and give corresponding lexical numbers to tokens belonging to the numeric constant group. For the tokens belonging to the string constant group, give the corresponding token number, the numerical value indicating the length of the string, and the token of the string, and for the tokens belonging to the variable group, give the token. A method for compressing a source program, characterized in that a variable is registered in a symbol table, and a corresponding lexical number and a registered position number on the symbol table are given and output.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP60044477A JPS61204741A (en) | 1985-03-06 | 1985-03-06 | Compressing method for source program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP60044477A JPS61204741A (en) | 1985-03-06 | 1985-03-06 | Compressing method for source program |
Publications (1)
Publication Number | Publication Date |
---|---|
JPS61204741A true JPS61204741A (en) | 1986-09-10 |
Family
ID=12692610
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP60044477A Pending JPS61204741A (en) | 1985-03-06 | 1985-03-06 | Compressing method for source program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS61204741A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6394336A (en) * | 1986-10-08 | 1988-04-25 | Nec Corp | Conversion processing system for interpreter type simple language |
JPH0764798A (en) * | 1993-08-24 | 1995-03-10 | Nec Corp | Program translation system |
JP2001028585A (en) * | 1999-07-13 | 2001-01-30 | Sony Corp | Delivery content generation method, content delivery method and apparatus, and code conversion method |
US7117485B2 (en) | 1996-10-25 | 2006-10-03 | Axalto Sa | Using a high level programming language with a microcontroller |
JP2011076619A (en) * | 2010-11-19 | 2011-04-14 | Mitsubishi Electric Corp | Program code compression device, program code compression method, and program of program code compression method |
US8527967B2 (en) | 2005-02-03 | 2013-09-03 | Mitsubishi Electric Corporation | Program code compression processing device and method and program thereof |
WO2016199255A1 (en) * | 2015-06-10 | 2016-12-15 | 富士通株式会社 | Information processing device, information processing method, and information processing program |
WO2021245950A1 (en) * | 2020-06-05 | 2021-12-09 | 富士通株式会社 | Information processing program, information processing method, and information processing device |
-
1985
- 1985-03-06 JP JP60044477A patent/JPS61204741A/en active Pending
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6394336A (en) * | 1986-10-08 | 1988-04-25 | Nec Corp | Conversion processing system for interpreter type simple language |
JPH0764798A (en) * | 1993-08-24 | 1995-03-10 | Nec Corp | Program translation system |
US7117485B2 (en) | 1996-10-25 | 2006-10-03 | Axalto Sa | Using a high level programming language with a microcontroller |
JP2001028585A (en) * | 1999-07-13 | 2001-01-30 | Sony Corp | Delivery content generation method, content delivery method and apparatus, and code conversion method |
US7653752B2 (en) | 1999-07-13 | 2010-01-26 | Sony Corporation | Distribution contents forming method, contents distributing method and apparatus, and code converting method |
US8527967B2 (en) | 2005-02-03 | 2013-09-03 | Mitsubishi Electric Corporation | Program code compression processing device and method and program thereof |
US8572557B2 (en) | 2005-02-03 | 2013-10-29 | Mitsubishi Electric Corporation | Program code generation support device and method, program execution device and method, and program code compression processing device and method and program thereof |
JP2011076619A (en) * | 2010-11-19 | 2011-04-14 | Mitsubishi Electric Corp | Program code compression device, program code compression method, and program of program code compression method |
WO2016199255A1 (en) * | 2015-06-10 | 2016-12-15 | 富士通株式会社 | Information processing device, information processing method, and information processing program |
JPWO2016199255A1 (en) * | 2015-06-10 | 2018-03-29 | 富士通株式会社 | Information processing apparatus, information processing method, and information processing program |
US10684831B2 (en) | 2015-06-10 | 2020-06-16 | Fujitsu Limited | Information processing apparatus, information processing method, and recording medium |
WO2021245950A1 (en) * | 2020-06-05 | 2021-12-09 | 富士通株式会社 | Information processing program, information processing method, and information processing device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5317509A (en) | Regular expression factoring for scanning multibyte character sets with a single byte automata machine | |
US6003049A (en) | Data handling and transmission systems employing binary bit-patterns based on a sequence of standard decomposed strokes of ideographic characters | |
JPS61204741A (en) | Compressing method for source program | |
JPS61267824A (en) | Japanese data sorting processing method | |
JP3322313B2 (en) | Event analyzer | |
JPS63221475A (en) | Analyzing method for syntax | |
JPS62286105A (en) | Numerical control device | |
JPH02266413A (en) | Code converting method | |
JPH06282566A (en) | Information processor | |
Sommerville | A pattern matching system | |
JPH0475550B2 (en) | ||
JPH021027A (en) | Compiling system for compressed source program | |
JP2726543B2 (en) | Translation method | |
JPH0338772A (en) | Compression system for character code data | |
Baars et al. | Syntax Macros (Unfinished draft) | |
JPH04372047A (en) | Kana/kanji converter | |
JPH0778155A (en) | Document recognizing device | |
JPH0340033A (en) | Caller code system recognition processing method | |
JPS62235643A (en) | Program language translator | |
JPH0535492A (en) | Circuit description form converter | |
Wong | Proof of Time Bounds for Recognizing Unambiguous and LR (k) Grammars Using Earley's Algorithm | |
JPS60243765A (en) | Information input method | |
JPH02297151A (en) | Document editing device | |
Lee | Code Generation | |
JPS593688A (en) | Normalizing and converting device of equation in equation processing system |