|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectorg.oklab.compiler.syntaxtree.Node
public abstract class Node
シンタックスツリー(構文木)の基盤となるクラス. このクラスは構文木の基盤となるクラスで、継承されることを前提に作っている. 構文木で共通化できるメソッドなどはこのクラスで実装する.またサブパッケージ内 の各クラスに当てはまるものであれば、このプログラミング言語の文法となる. 以下がサブパッケージの概要である.
| フィールドの概要 | |
|---|---|
protected Node |
parent
|
| コンストラクタの概要 | |
|---|---|
Node(Node parent)
|
|
| メソッドの概要 | |
|---|---|
int |
getReturnType()
ツリー構造の構文解析木の葉から根に向かって、メソッドの戻り値を取得する. |
int |
localVariableCount()
ツリー構造の構文解析木の葉から根に向かってローカル変数の数を取得する. |
protected Expression |
parseExpression(boolean requireArguments,
SourceReader sReader)
returnキーワード後の式を解析.引数の解析. |
protected Expression |
parseFactor(boolean requireArguments,
SourceReader sReader)
Factor(要素)の解析. |
protected Expression |
parseRefferenceOrCall(Node node,
java.lang.String curentIdentifer,
SourceReader sReader)
関数呼び出しまたは、変数の参照の構文解析. |
Statement |
parseStatement(int token,
SourceReader sReader)
どの文の解析かをトークンから割り出して、実際の構文解析処理は各クラスに委譲する. |
protected Expression |
parseTerm(boolean requireArguments,
SourceReader sReader)
Term(用語)の解析. 1 + hogeValueの1やhogeValueにあたるオペランドを解析する.オペランドが関数呼び出しや さらに括弧でくくられている場合はさらに内部を解析していく. |
void |
setParent(Node parent)
|
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
|---|
protected Node parent
| コンストラクタの詳細 |
|---|
public Node(Node parent)
| メソッドの詳細 |
|---|
public void setParent(Node parent)
public int localVariableCount()
public int getReturnType()
Method.getReturnType()
public Statement parseStatement(int token,
SourceReader sReader)
throws CompileError
CompileError
protected Expression parseExpression(boolean requireArguments,
SourceReader sReader)
throws CompileError
requireArguments - 例えば式がhoge();でもよい場合はtrueにする.もし
falseにすると式hoge(10);のように式に引数が必要となる.
リターン式の例 return hoge_func(); return hoge_func(1); return intValue; return 10; return (10 * 10) / 2;
CompileError
protected Expression parseTerm(boolean requireArguments,
SourceReader sReader)
throws CompileError
CompileError
protected Expression parseFactor(boolean requireArguments,
SourceReader sReader)
throws CompileError
requireArguments - nullを容認するかしないか.sReader - ソースコードリーダ.
CompileError
protected Expression parseRefferenceOrCall(Node node,
java.lang.String curentIdentifer,
SourceReader sReader)
throws CompileError
CompileErrorBlock.parseRefferenceOrCall(Node, String, SourceReader),
Method.parseRefferenceOrCall(Node, String, SourceReader)
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||