org.oklab.compiler.syntaxtree.expression
クラス OperatorOfBinary

java.lang.Object
  上位を拡張 org.oklab.compiler.syntaxtree.Node
      上位を拡張 org.oklab.compiler.syntaxtree.expression.Expression
          上位を拡張 org.oklab.compiler.syntaxtree.expression.OperatorOfBinary

public class OperatorOfBinary
extends Expression

二項演算子.

導入されたバージョン:
1.0
バージョン:
1.0
作成者:
Satoshi Okita satoshiokita@gmail.com

フィールドの概要
private  Expression leftOperand
           
private  int operatorBytecode
          二項演算子のオペレータは、このクラスがインスタンス化したと同時に分かるので その時点でバイトコードとして保持する.
private  Expression rightOperand
           
 
クラス org.oklab.compiler.syntaxtree.Node から継承されたフィールド
parent
 
コンストラクタの概要
OperatorOfBinary(Node parentNode, int operatorToken, Expression leftOperand, Expression rightOperand)
          二項演算子の構文木作成.
 
メソッドの概要
 int emitCode(CodeBufferManager code, int stackPointer)
          二項演算子をバイトコードに出力する.
 
クラス org.oklab.compiler.syntaxtree.expression.Expression から継承されたメソッド
parseXStatement
 
クラス org.oklab.compiler.syntaxtree.Node から継承されたメソッド
getReturnType, localVariableCount, parseExpression, parseFactor, parseRefferenceOrCall, parseStatement, parseTerm, setParent
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

leftOperand

private Expression leftOperand

operatorBytecode

private int operatorBytecode
二項演算子のオペレータは、このクラスがインスタンス化したと同時に分かるので その時点でバイトコードとして保持する.


rightOperand

private Expression rightOperand
コンストラクタの詳細

OperatorOfBinary

public OperatorOfBinary(Node parentNode,
                        int operatorToken,
                        Expression leftOperand,
                        Expression rightOperand)
                 throws CompileError
二項演算子の構文木作成.

例外:
CompileError
メソッドの詳細

emitCode

public int emitCode(CodeBufferManager code,
                    int stackPointer)
             throws CompileError
二項演算子をバイトコードに出力する. 二項演算子とは、1 + 50のようなオペランドを2つ持つ演算子のことである.これを 処理する方法は、リバース・ボーランド法と同じである.つまり左右のオペランド をスタックに積んで、その後演算装置(ALU)でオペランドを実行するのである. そのため、スタックに積むように、はじめに左右のオペランドをバイトコードに出力し その後、オペレータをバイトコードの出力する.

定義:
クラス Expression 内の emitCode
例外:
CompileError