JPH0455944A - Production of syntactic analysis part of compiler - Google Patents

Production of syntactic analysis part of compiler

Info

Publication number
JPH0455944A
JPH0455944A JP16745890A JP16745890A JPH0455944A JP H0455944 A JPH0455944 A JP H0455944A JP 16745890 A JP16745890 A JP 16745890A JP 16745890 A JP16745890 A JP 16745890A JP H0455944 A JPH0455944 A JP H0455944A
Authority
JP
Japan
Prior art keywords
grammar
parsing
subroutine
syntax analysis
syntactic analysis
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP16745890A
Other languages
Japanese (ja)
Inventor
Kazuhiko Noba
和彦 野場
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP16745890A priority Critical patent/JPH0455944A/en
Publication of JPH0455944A publication Critical patent/JPH0455944A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE:To attain the syntactic analysis with use of a single LR(1) syntactic analysis table by putting a dummy token into the grammar used for production of an LR(1) syntactic analysis subroutine in order to show the type of the grammar to be analyzed and then treating plural grammars in common with each other. CONSTITUTION:A dummy token is put into the grammar used for production of an LR(1) syntactic analysis subroutine in order to show the type of the grammar to be analyzed. So that plural grammars can be treated in common with each other. For instance, a grammar 'S E¦bC¦cI' is added. In this case, (a - c) show the dummy tokens. Thus E showing an arithmetical formula C showing a conditional formula, and I showing a unique name are all reduced to a start symbol S. Then the syntactic analysis can be attained with use of a single LR(1) syntactic analysis table.

Description

【発明の詳細な説明】 [概要] コンパイラの構文解析部の一部をLR(1)構文解析法
で作成する場合の作成方法に関し、複数の文法を単一の
LR(1)構文解析表を用いて解析できるようにするこ
とを目的とし、コンパイラの構文解析部の一部をLR(
1)構文解析法で作成する場合において、LR(1)構
文解析サブルーチンを使用する部分で解析する文法が複
数存在する場合に、LR(1)構文解析サブルーチンを
作成するための文法に、解析する文法の種別を示すトー
クンを挿入することによって、複数の文法を解析するL
R(1)構文解析表を生成しておき(ステップ1)、こ
のLR(1)構文解析表を含むLR(1)構文解析サブ
ルーチンを呼出す際に、解析する文法の種別を挿入する
ことにより目的の文法を解析する(ステップ2)ように
構成する。
[Detailed Description of the Invention] [Summary] Regarding a method for creating a part of the parsing section of a compiler using the LR(1) parsing method, multiple grammars are combined into a single LR(1) parsing table. For the purpose of making it possible to analyze using the LR (
1) When creating using the syntax analysis method, if there are multiple grammars to be analyzed in the part that uses the LR(1) syntax analysis subroutine, analyze the grammar to create the LR(1) syntax analysis subroutine. L that parses multiple grammars by inserting tokens that indicate the type of grammar.
An R(1) parsing table is generated (step 1), and when calling the LR(1) parsing subroutine that includes this LR(1) parsing table, the purpose is determined by inserting the type of grammar to be analyzed. (step 2).

[産業上の利用分野] 本発明はコンパイラの構文解析部の一部をLR(1)構
文解析法で作成する場合の作成方法に関する。
[Industrial Application Field] The present invention relates to a method for creating a part of a parsing section of a compiler using the LR(1) parsing method.

[従来の技術] LR(1)構文解析法は、コンパイラの構文解析部を計
算機等で自動生成する上で最も強力で実用的な方法であ
る。ここてLR(1)構文解析法とは、ある文字列を左
から読込み、解釈は右から行い、次の動作を決める時に
は1つ先の語まで読込むという方法である。しかしなが
ら、強力なオブチマイザ(最適化ツール)がない場合に
は、構文解析部を全てLR(1)構文解析法で作成する
と、構文の自動生成ツールとしてのLR(1) 構文解
析表か膨大になってしまったり、解析速度が低下したり
する。
[Prior Art] The LR(1) parsing method is the most powerful and practical method for automatically generating the parsing section of a compiler using a computer or the like. The LR(1) parsing method is a method in which a character string is read from the left, interpretation is performed from the right, and when determining the next action, the next word is read. However, in the absence of a powerful optimizer (optimization tool), if the entire syntax analysis section is created using the LR(1) syntax analysis method, the LR(1) syntax analysis table used as an automatic syntax generation tool will become enormous. or the analysis speed may slow down.

第5図はLR(1)構文解析表の概念図である。FIG. 5 is a conceptual diagram of the LR(1) syntax analysis table.

図に示すように「状態」と「語」より構成されており、
ある状態の下である語が来たらどういう処理を行うかが
記載されている。例えば、ある状態のある語とで決定さ
れる図の斜線で示される部分では、以下のような遷移が
行われる。
As shown in the figure, it is composed of "state" and "word".
It describes what to do when a certain word comes under certain conditions. For example, in the shaded part of the diagram determined by a certain word in a certain state, the following transition is performed.

■1つ語を読んで、状態nに進む。■Read one word and proceed to state n.

■1つ語を読んで、それをスタックに積んで状態nに進
む。
■Read one word, put it on the stack and proceed to state n.

■還元処理;例えばA−A+Cという構文規則では、A
+Cを解析して、その結果をAに還元し、同時に+a、
cというコードを生成する。
■Reduction processing: For example, in the syntax rule A-A+C, A
Analyze +C, reduce the result to A, and at the same time +a,
Generates a code called c.

ところで、ある言語の一部が全てLR(1)文法でなけ
ればならないものではなく、文法によっては、制限が多
いが単純である演算子順位法や、LL (1)構文解析
法で十分な場合もある。演算子順位法とは、+、−、x
、  ÷等の演算子に優先度をつけて構文解析を行うよ
うにするものである。
By the way, part of a language does not necessarily have to be an LR(1) grammar; depending on the grammar, the operator rank method, which has many restrictions but is simple, or the LL(1) parsing method may be sufficient. There is also. The operator ranking method is +, -, x
This allows operators such as , ÷ to be prioritized and parsed.

またLL (1)構文解析法は、ある文字列を左から読
込み、解釈も左から行い、次の動作を決める時には1つ
先の語まで読込むという方法である。
The LL (1) parsing method is a method in which a certain character string is read from the left, interpretation is also performed from the left, and when determining the next action, the next word is read.

そのため、コンパイラを作成する上で、複数の構文解析
法を混在させることがある。コンパイラの一部をLR(
1)構文解析法で作成する場合、異なる文法要素である
が、それらが互いに関連しあっているため、それらを1
つの構文解析ルーチンで解析するほうが都合がよい場合
がある。例えば、以下に示す3つの文法があるものとす
る。
Therefore, when creating a compiler, multiple parsing methods may be mixed. LR (
1) When creating using the syntactic analysis method, although they are different grammatical elements, they are related to each other, so they can be combined into one
It may be more convenient to parse with one parsing routine. For example, suppose there are three grammars shown below.

■文法1(算術式ン E→E+111     (1) ■文法2(条件式) %式%(2) ここで、1は「又は」の意味である。−意名とはデータ
等の固定値を示す。これらの文法を用いて構文解析を行
う場合、それぞれの文法毎にLR(1)構文解析表が必
要となる。ところが上式より明らかなように、算術式に
は一意名を用い、条件式にも算術式を用いている。また
、−意名には算術式を用いている。このように、文法が
相互に関連があることが多い。このような場合、3つの
文法も同一のLR(1)構文解析表を用いた構文解析ル
ーチンで解析したほうが都合がよいことは明らかである
■ Grammar 1 (arithmetic expression E → E + 111 (1) ■ Grammar 2 (conditional expression) % expression % (2) Here, 1 means "or". - Significant name refers to a fixed value such as data. When performing syntax analysis using these grammars, an LR(1) syntax analysis table is required for each grammar.However, as is clear from the above formula, unique names are used for arithmetic expressions, and conditional expressions are Also, an arithmetic expression is used for -signature.In this way, grammars are often related to each other.In such cases, the three grammars also use the same LR (1) It is clear that it is more convenient to analyze with a syntax analysis routine using a syntax analysis table.

[発明が解決しようとする課題] しかしながら、コンパイラの構文解析部の一部をサブル
ーチンとしてLR(1)構文解析法で作成する場合には
、複数の文法を解析することができないという問題があ
った。このことを詳細に説明する。例えば、今、 i−i+i という文字列が前記文法を満足しているかどうかを調べ
る場合には、第6図に示すようなツリーを作成する。そ
して、最終的にEで終われば前記文字列はLR(1)構
文解析ができることになる。
[Problem to be solved by the invention] However, when creating a part of the parsing section of a compiler as a subroutine using the LR(1) parsing method, there is a problem that multiple grammars cannot be analyzed. . This will be explained in detail. For example, to check whether the character string i-i+i satisfies the above grammar, a tree as shown in FIG. 6 is created. If the string finally ends with E, the character string can be parsed using LR(1).

このような構文解析を行う場合文法GはfvN。When performing such syntax analysis, the grammar G is fvN.

V、、P、S+ なる4つの要素から成り立っている。It consists of four elements: V, , P, and S+.

VN ; E、T、F等の途中に現れる文字列VT  
: l + −+ 十等の最終的に現れる文字列P;規
則 S、E等の開始記号 ある文法を解析するサブルーチンを作成した場合、最終
的には最初の記号に戻って(る。ところが、文法の種別
(算術式9条件式等)によって開始記号が異なっている
。コンパイラの処理は開始記号まで戻す処理であるから
、開始記号か異なると、単一のLR(1)構文解析表で
複数の文法を解析することができなかった。
VN; Character string VT that appears in the middle of E, T, F, etc.
: l + -+ character string P that finally appears in tens etc.; start symbols of rules S, E, etc. If you create a subroutine that parses a certain grammar, it will eventually return to the first symbol (.However, The start symbol differs depending on the type of grammar (arithmetic expression 9 conditional expression, etc.).The compiler process returns to the start symbol, so if the start symbol is different, a single LR(1) parsing table can contain multiple start symbols. could not parse the grammar.

本発明はこのような課題に鑑みてなされたものであって
、複数の文法を単一のLR(1)構文解析表を用いて解
析できるようにすることができるコンパイラの構文解析
部の作成方法を提供することを目的としている。
The present invention has been made in view of these problems, and provides a method for creating a syntax analysis section of a compiler that can analyze multiple grammars using a single LR(1) syntax analysis table. is intended to provide.

[課題を解決するための手段] 第1図は本発明方法の原理を示すフローチャートである
。本発明は、 コンパイラの構文解析部の一部をLR(1)構文解析法
で作成する場合において、 LR(1)構文解析サブルーチンを使用する部分で解析
する文法が複数存在する場合に、LR(1)構文解析サ
ブルーチンを作成するための文法に、解析する文法の種
別を示すトークンを挿入することによって、複数の文法
を解析するLR(1)構文解析表を生成しておき(ステ
ップ1)、このLR(1)構文解析表を含むLR(1)
構文解析サブルーチンを呼出す際に、解析する文法の種
別を挿入することにより目的の文法を解析する(ステッ
プ2)ようにしたことを特徴としている。
[Means for Solving the Problems] FIG. 1 is a flowchart showing the principle of the method of the present invention. In the case where a part of the syntax analysis section of a compiler is created using the LR(1) syntax analysis method, and there are multiple grammars to be analyzed in the part that uses the LR(1) syntax analysis subroutine, the LR(1) syntax analysis subroutine is 1) Generate an LR(1) parsing table for parsing multiple grammars by inserting a token indicating the type of grammar to be analyzed into the grammar for creating the parsing subroutine (step 1); LR(1) containing this LR(1) parsing table
The present invention is characterized in that when calling the parsing subroutine, the type of grammar to be analyzed is inserted to parse the target grammar (step 2).

[作用コ LR(1)構文解析サブルーチンを作成するための文法
に、解析する文法の種別を示すダミーのトークンを挿入
して複数の文法を共通に扱えるようにする。例えば、前
記した(1)〜(3)式に加えて、 5−aE I bCl c I   (4)なる文法を
付加するのである。ここで、a、b。
[Operation LR (1) A dummy token indicating the type of grammar to be analyzed is inserted into the grammar used to create the parsing subroutine so that multiple grammars can be handled in common. For example, in addition to the above-mentioned expressions (1) to (3), the following grammar is added: 5-aE I bCl c I (4). Here, a, b.

Cがダミーのトークンである。これにより、算術式を示
すEも条件式を示すCも一意名を示す■も共に開始記号
Sに還元されるので、単一のLR(1)構文解析表を用
いて構文解析が行えるようになる。
C is a dummy token. As a result, E denoting an arithmetic expression, C denoting a conditional expression, and ■ denoting a unique name are all reduced to the start symbol S, making it possible to perform syntax analysis using a single LR(1) syntax analysis table. .

[実施例] 以下、図面を参照して本発明の実施例を詳細に説明する
[Example] Hereinafter, an example of the present invention will be described in detail with reference to the drawings.

算術式1条件式及びデータ名(−意名)を解析するサブ
ルーチンの場合、算術子はデータ名を構成要素として含
み、条件式は算術式、データ名を構成要素して含み、デ
ータ名は添字等に算術式を含むというように、相互に関
連している。このようなサブルーチンを解析する文法を
Gとした場合、文法Gの定義を以下のようにする。
Arithmetic expression 1 In the case of a subroutine that analyzes a conditional expression and a data name (-signature), the arithmetic operator includes the data name as a component, the conditional expression includes the arithmetic expression and the data name as a component, and the data name is a subscript. They are related to each other, such that they include arithmetic expressions. If G is a grammar for analyzing such a subroutine, the definition of grammar G is as follows.

Pは、 G−(VN 、VT 、P、5) VN = (S、 E、 C,11 V↑−((1+  1.−1 C+  )+  a+  b+  01Cがダミー〇ト
ークン S−→aElbclcl E4E+II C→E−E ■→i  (E) ここで、上式のa、  b。
P is G-(VN, VT, P, 5) VN = (S, E, C, 11 V↑-((1+ 1.-1 C+)+ a+ b+ 01C is a dummy token S-→aElbclcl E4E+II C →E−E ■→i (E) Here, a and b in the above equation.

で、それぞれの算術式9条件式、データ名の解析を示す
終端記号である。(5)〜(11)に示す文法を基にL
R(1)構文解析表を作成すると、算術式1条件式及び
データ名を解析するサブルーチンを作成することができ
る。ここで、サブルーチンを作ってみる。
These are terminal symbols that indicate the analysis of each arithmetic expression, nine conditional expressions, and data name. Based on the grammar shown in (5) to (11), L
By creating the R(1) syntax analysis table, it is possible to create a subroutine that analyzes the arithmetic expression 1 conditional expression and data name. Now let's create a subroutine.

算術式EはEという記号と十という記号とIという記号
又は■という記号で表されるものとし、これを E−E+I I I           (12)と
表すものとする。以下、条件式〇、データ名Iについて
も同様に考え、 C4E−E(13) I−i (E)            (14)と表
す。また、 S′からSが生成されるものと考えて S′→S              (15)という
生成規則を追加する。これら文法において、Eから生成
されるものには例えば i+i+i、i があり、Cから生成されるものには例えばi−i、i+
i−i があり、■から生成されるものには例えば、ii  (
i)がある。
The arithmetic expression E shall be represented by the symbol E, the symbol 10, the symbol I, or the symbol ■, and shall be expressed as E-E+I I I (12). Below, conditional expression 〇 and data name I will be considered in the same way and expressed as C4E-E(13) I-i (E) (14). Also, considering that S is generated from S', we add the generation rule S'→S (15). In these grammars, things generated from E include, for example, i+i+i, i, and things generated from C include, for example, i-i, i+
There is i-i, and what is generated from ■, for example, ii (
There is i).

何も読んでいない状態を■。、Ioからaを読んだ状態
をI、、Ioからbを読んだ状態をI2■1からiを読
んだ状態を13とすると、第2図に示すような状態と行
き先を決めるGOTO文(遷移先)が作成される。・は
トークンをどこまで読んだかを示している。これがLR
(1)構文解析表となる。I3の状態で次のトークンが
Cてなければiのオブジェクトコードを生成する。
■ A state where you are not reading anything. , the state where a is read from Io is I, the state where b is read from Io is I2■ the state where i is read from 1 is 13, then the GOTO statement (transition) that determines the state and destination as shown in Figure 2 destination) is created. - indicates how far the token has been read. This is LR
(1) It becomes a syntax analysis table. If the next token is not C in state I3, an object code of i is generated.

なお、このサブルーチンを呼び出す場合には、先頭のト
ークンとして算術式2条件式、データ名の先頭のトーク
ンではなく、a、b、cを示すトークンをサブルーチン
に渡すことによって、算術式1条件式、データ名を解析
することができる。
Note that when calling this subroutine, arithmetic expression 2 conditional expression, arithmetic expression 1 conditional expression, and arithmetic expression 1 conditional expression, by passing tokens indicating a, b, c to the subroutine instead of the first token of data name, as the first token. Data names can be parsed.

例えばaというトークンをサブルーチンに渡せば、算術
式だと思って解析を始める。またbというトークンをサ
ブルーチンに渡せば条件式だと思って解析を始める。
For example, if you pass the token a to a subroutine, it will start analyzing it, thinking it is an arithmetic expression. Also, if you pass the token b to the subroutine, it will think it is a conditional expression and start analyzing it.

第3図はサブルーチン内のトークンの読込み処理を示す
フローチャートである。先ず、文字列の読込みが1回目
であるかどうかチエツクする(Sl)。1回目である場
合には、本発明によるダミートークンの付加処理に入る
。つまり、文字列が条件式であるかどうかチエツクしく
S2)、そうであった場合には条件式を示すトークンの
cndを返す(S3)。
FIG. 3 is a flowchart showing the token reading process in the subroutine. First, it is checked whether the character string is being read for the first time (Sl). If it is the first time, dummy token addition processing according to the present invention begins. That is, it checks whether the character string is a conditional expression (S2), and if so, returns cnd of the token indicating the conditional expression (S3).

次に、条件式でなかった場合には、算術式であるかどう
かチエツクしくS4) 、そうであった場合には、算術
式を示すトークンのartを返す(S5)。次に、算術
式でなかった場合にはデータ名しか残っていないから、
データを示すトークンのdataを返す(S6)。若し
、文字列の読込みが1回目でない場合にはダミートーク
ンを返す必要はないから、読込んだトークンをそのまま
返せばよい(S7)。
Next, if it is not a conditional expression, it is checked whether it is an arithmetic expression (S4), and if so, the art of the token indicating the arithmetic expression is returned (S5). Next, if it is not an arithmetic expression, only the data name remains, so
The data of the token indicating the data is returned (S6). If this is not the first time the character string has been read, there is no need to return a dummy token, and the read token may be returned as is (S7).

第4図は本発明で用いるコンパイラの構成例を示す図で
ある。図において、1は読み込んだ文字列を解析する字
句解析部、2は本発明を特徴づける構文解析部、3は意
味解析部、4は最適化部、5は目的コード生成部である
。構文解析部2は、構文解析本体2a、構文解析サブル
ーチン2b及びダミートークン付加部2cより構成され
ている。
FIG. 4 is a diagram showing an example of the configuration of a compiler used in the present invention. In the figure, 1 is a lexical analysis unit that analyzes a read character string, 2 is a syntax analysis unit that characterizes the present invention, 3 is a semantic analysis unit, 4 is an optimization unit, and 5 is a target code generation unit. The syntax analysis section 2 is composed of a syntax analysis main body 2a, a syntax analysis subroutine 2b, and a dummy token addition section 2c.

構文解析本体2aには、LR(1)構文解析部は含まれ
ない。構文解析サブルーチン2bでLR(1,)構文解
析が行われる。また、構文解析サブルーチン2bには、
前記したLR(1)構文解析表が含まれる。
The parsing body 2a does not include the LR(1) parsing section. LR(1,) syntax analysis is performed in the syntax analysis subroutine 2b. In addition, the parsing subroutine 2b includes:
The above-mentioned LR(1) parsing table is included.

このように構成されたシステムにおいて、先ず文字列が
字句解析部1に読込まれる。読込まれた文字列は字句解
釈された後、構文解析部2に入力される。構文解析部2
では入力された文字列の先頭に算術式1条件式及びデー
タ名の種別に応じてその先頭にダミートクン付加部2c
によりダミートクンが付加される。そして、ダミートー
クンが付加された文字列の解析は構文解析サブルーチン
2bで解析され、構文解析本体2aに渡される。
In the system configured as described above, a character string is first read into the lexical analysis section 1. The read character string is lexically interpreted and then input to the syntactic analysis unit 2. Syntax analysis section 2
Then, add an arithmetic expression 1 to the beginning of the input character string according to the type of conditional expression and data name, and add a dummy code part 2c to the beginning.
A dummy Kun is added. Then, the character string to which the dummy token has been added is analyzed by the syntax analysis subroutine 2b, and then passed to the syntax analysis main body 2a.

この場合において、全ての文法が同一の開始記号に還元
されるので、共通のLR(1)解析表を用いて解析する
ことができる。
In this case, since all grammars are reduced to the same starting symbol, they can be analyzed using a common LR(1) analysis table.

構文解析部2で解析された結果は、次に意味解析部3に
渡され、意味の解析が行われる。その後、最適化部4で
最適化処理がなされた後、目的コード生成部5でオブジ
ェクトコードが生成される。
The results analyzed by the syntactic analysis unit 2 are then passed to the semantic analysis unit 3, where the meaning is analyzed. Thereafter, the optimization section 4 performs optimization processing, and then the object code generation section 5 generates an object code.

[発明の効果] 以上、詳細に説明しプこように、本発明によればLR(
1)構文解析サブルーチンを作成するための文法に、解
析する文法の種別を示すダミーのトークンを挿入して複
数の文法を共通に扱えるようにすることにより、算術式
を示すEも条件式を示すCも一意名を示すIも共に開始
記号Sに戻るので、単一のLR(1)構文解析表を用い
て構文解析を行うことができる。
[Effects of the Invention] As described above in detail, according to the present invention, LR (
1) By inserting a dummy token indicating the type of grammar to be analyzed into the grammar used to create the parsing subroutine so that multiple grammars can be handled in common, E, which indicates an arithmetic expression, also indicates a conditional expression. Since both C and I indicating a unique name return to the start symbol S, syntax analysis can be performed using a single LR(1) parsing table.

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

第1図は本発明方法の原理を示すフローチャート、 第2図は状態図とコール文を示す図、 第3図はサブルーチン内のトークンの読込み処理を示す
フローチャート、 第4図は本発明に用いるコンパイラの構成例を示す図、 第5図はLR(1)構文解析表の概念図、第6図は文字
列の解析法の説明図である。 第4図において、 1は字句解析部、 2は構文解析部、 2aは構文解析本体、 2bは構文解析サブルーチン、 2cはダミートークン付加部、 3は意味解析部、 4は最適化部、 5は目的コード生成部である。
Fig. 1 is a flowchart showing the principle of the method of the present invention, Fig. 2 is a diagram showing a state diagram and call statement, Fig. 3 is a flowchart showing token reading processing in a subroutine, and Fig. 4 is a compiler used in the present invention. FIG. 5 is a conceptual diagram of an LR(1) syntax analysis table, and FIG. 6 is an explanatory diagram of a character string analysis method. In Figure 4, 1 is a lexical analysis section, 2 is a syntax analysis section, 2a is a syntactic analysis body, 2b is a syntactic analysis subroutine, 2c is a dummy token addition section, 3 is a semantic analysis section, 4 is an optimization section, 5 is a syntax analysis section This is the target code generator.

Claims (1)

【特許請求の範囲】 コンパイラの構文解析部の一部をLR(1)構文解析法
で作成する場合において、 LR(1)構文解析サブルーチンを使用する部分で解析
する文法が複数存在する場合に、LR(1)構文解析サ
ブルーチンを作成するための文法に、解析する文法の種
別を示すトークンを挿入することによって、複数の文法
を解析するLR(1)構文解析表を生成しておき(ステ
ップ1)、このLR(1)構文解析表を含むLR(1)
構文解析サブルーチンを呼出す際に、解析する文法の種
別を挿入することにより目的の文法を解析する(ステッ
プ2)ようにしたことを特徴とするコンパイラの構文解
析部の作成方法。
[Claims] When a part of the parsing section of a compiler is created using the LR(1) parsing method, and there are multiple grammars to be analyzed in the part that uses the LR(1) parsing subroutine, An LR(1) parsing table for parsing multiple grammars is generated by inserting a token indicating the type of grammar to be analyzed into the grammar for creating the LR(1) parsing subroutine (step 1). ), LR(1) containing this LR(1) parsing table
A method for creating a syntax analysis section of a compiler, characterized in that when calling a syntax analysis subroutine, a target grammar is analyzed by inserting the type of grammar to be analyzed (step 2).
JP16745890A 1990-06-25 1990-06-25 Production of syntactic analysis part of compiler Pending JPH0455944A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16745890A JPH0455944A (en) 1990-06-25 1990-06-25 Production of syntactic analysis part of compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16745890A JPH0455944A (en) 1990-06-25 1990-06-25 Production of syntactic analysis part of compiler

Publications (1)

Publication Number Publication Date
JPH0455944A true JPH0455944A (en) 1992-02-24

Family

ID=15850054

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16745890A Pending JPH0455944A (en) 1990-06-25 1990-06-25 Production of syntactic analysis part of compiler

Country Status (1)

Country Link
JP (1) JPH0455944A (en)

Similar Documents

Publication Publication Date Title
Karlsson Constraint grammar as a framework for parsing running text
Pereira et al. Definite clause grammars for language analysis—a survey of the formalism and a comparison with augmented transition networks
Watson A practical approach to compiler construction
Schnelle et al. A net-linguistic “Early” parser
Johnstone et al. Evaluating GLR parsing algorithms
Grishman PROTEUS Parser Reference Manual.
JPH0455944A (en) Production of syntactic analysis part of compiler
Jain et al. Compiler Basic Design and Construction
Meijer The project on extended affix grammars at Nijmegen
Su et al. Principles of Compilers
Grigorev et al. String-embedded language support in integrated development environment
JPH07160490A (en) Coding assistance device
Sestoft From Concrete Syntax to Abstract Syntax
Scott et al. Multiple lexicalisation (a Java based study)
Whitington Haskell from the Very Beginning
WO1997007452A1 (en) Programmable compiler
Jones et al. Eager GLR parsing
Warren Teaching Prolog through Grammars.
JPH09185623A (en) Language processing apparatus and method
JP3370243B2 (en) Compilation method and apparatus
JP3141945B2 (en) Compiling device
Watson Lexical Analysis
JPS62245337A (en) Program language processing system
Rulifson A TREE META FOR THE XDS 940
Bîrleanu et al. A Didactic Implementation of a Minimalist Compiler