coins.cfront
クラス Evaluator

java.lang.Object
  |
  +--coins.cfront.Evaluator
すべての実装インタフェース:
TokenId, TypeId

class Evaluator
extends java.lang.Object
implements TokenId, TypeId

Evaluator computes constant expressions. All integer constants are processed as long int values.


フィールドの概要
(パッケージプライベート)  int[] toSize
           
 
インタフェース coins.ast.TokenId から継承したフィールド
AND_E, ANDAND, ARROW, ASM, AUTO, BAD_TOKEN, BREAK, CASE, CAST_OP, CHAR, CHAR_CONST, COND_OP, CONST, CONTINUE, DEFAULT, DIV_E, DO, DOUBLE, DOUBLE_CONST, ELLIPSIS, ELSE, ENUM, EOF, EQ, EXOR_E, EXTERN, FLOAT, FLOAT_CONST, FOR, FUNCALL, GE, GOTO, IDENTIFIER, IF, IGNORE, INDEX_OP, INLINE, INT, INT_CONST, LE, LONG, LONG_CONST, LONG_DOUBLE_CONST, LONGLONG_CONST, LSHIFT, LSHIFT_E, MINUS_E, MINUSMINUS, MOD_E, MUL_E, MUTABLE, NEQ, OR_E, OROR, PLUS_E, PLUSPLUS, PRAGMA, REGISTER, RESTRICT, RETURN, RSHIFT, RSHIFT_E, SHORT, SIGNED, SIZEOF, SKIP_GCC_ASM, SKIP_GCC_ATTRIBUTE, STATIC, STRING_L, STRING_WL, STRUCT, SWITCH, TYPEDEF, TYPEDEF_NAME, UINT_CONST, ULONG_CONST, ULONGLONG_CONST, UNION, UNSIGNED, VOID, VOLATILE, WHILE
 
インタフェース coins.ast.TypeId から継承したフィールド
ARRAY_T, CHAR_T, CONST_T, DOUBLE_T, ELLIPSIS_T, ENUM_BEGIN, ENUM_END, FLOAT_T, FUNCTION_T, INT_T, LONG_DOUBLE_T, LONG_LONG_T, LONG_T, NO_DIMENSION_T, OFFSET_T, POINTER_T, RESTRICT_T, RETURN_T, S_AUTO, S_EXTERN, S_INLINE, S_NONE, S_REGISTER, S_STATIC, SHORT_T, SIGNED_T, SIZE_T, STRUCT_BEGIN, STRUCT_END, UNION_BEGIN, UNION_END, UNSIGNED_T, VOID_T, VOLATILE_T
 
コンストラクタの概要
Evaluator(MachineParam mp)
           
 
メソッドの概要
 ConstantExpr applyBinaryOp(Lex lex, ConstantExpr expr1, int op, ConstantExpr expr2)
          Constant folding for arithmetic binary expression.
 ConstantExpr applyUnaryOp(Lex lex, int op, ConstantExpr expr)
          Constant folding for arithmetic unary expression.
 ConstantExpr cast(Lex lex, ConstantExpr expr, EncodedType etype)
          Do constant folding by casting the constant expression expr to the type shown by etype.
 ConstantExpr make(double value)
           
 ConstantExpr make(double value, byte[] type)
           
 ConstantExpr make(double value, char type)
          Make floating constant expression.
 ConstantExpr make(double value, EncodedType type)
           
 ConstantExpr make(long value)
           
 ConstantExpr make(long value, byte[] type)
           
 ConstantExpr make(long value, char sign, char type)
          Make integer constant expression.
 ConstantExpr make(long value, EncodedType type)
           
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

toSize

final int[] toSize
コンストラクタの詳細

Evaluator

public Evaluator(MachineParam mp)
メソッドの詳細

make

public ConstantExpr make(long value)

make

public ConstantExpr make(long value,
                         byte[] type)

make

public ConstantExpr make(long value,
                         EncodedType type)

make

public ConstantExpr make(long value,
                         char sign,
                         char type)
Make integer constant expression. If the precision of "type" is less than 64, upper bits are filled by sign extension (if "sign" is S) or 0-extension (if "sign" is U).

戻り値:
Constant expression.

make

public ConstantExpr make(double value)

make

public ConstantExpr make(double value,
                         byte[] type)

make

public ConstantExpr make(double value,
                         EncodedType type)

make

public ConstantExpr make(double value,
                         char type)
Make floating constant expression. (How to adjust precision according to "type" ?)

戻り値:
Constant expression.

cast

public ConstantExpr cast(Lex lex,
                         ConstantExpr expr,
                         EncodedType etype)
                  throws ParseError
Do constant folding by casting the constant expression expr to the type shown by etype.

戻り値:
Constant expression.
ParseError

applyUnaryOp

public ConstantExpr applyUnaryOp(Lex lex,
                                 int op,
                                 ConstantExpr expr)
                          throws ParseError
Constant folding for arithmetic unary expression.

戻り値:
Constant expression.
ParseError

applyBinaryOp

public ConstantExpr applyBinaryOp(Lex lex,
                                  ConstantExpr expr1,
                                  int op,
                                  ConstantExpr expr2)
                           throws ParseError
Constant folding for arithmetic binary expression.

戻り値:
Constant expression.
ParseError