2023-07-29 00:11:09 +00:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace TLang.Common
|
|
|
|
{
|
|
|
|
public abstract class Instruction
|
|
|
|
{
|
|
|
|
public abstract int CalculateLength();
|
|
|
|
|
|
|
|
public abstract void WriteData(Stream strm);
|
|
|
|
|
|
|
|
|
|
|
|
public const byte ADD = 0x00;
|
|
|
|
public const byte SUB = 0x01;
|
|
|
|
public const byte TIMES = 0x02;
|
|
|
|
public const byte DIVIDE = 0x03;
|
|
|
|
public const byte MOD = 0x04;
|
|
|
|
|
|
|
|
public const byte POW = 0x05;
|
|
|
|
|
|
|
|
public const byte LSHIFT = 0x06;
|
|
|
|
public const byte RSHIFT = 0x07;
|
|
|
|
public const byte BOR = 0x08;
|
|
|
|
public const byte BAND = 0x09;
|
|
|
|
public const byte XOR = 0x0A;
|
|
|
|
|
|
|
|
public const byte NEG = 0x0B;
|
|
|
|
public const byte BNOT = 0x0C;
|
|
|
|
|
|
|
|
public const byte NEQ = 0x10;
|
|
|
|
public const byte EQ = 0x11;
|
|
|
|
|
|
|
|
public const byte LOR = 0x12;
|
|
|
|
|
|
|
|
public const byte LAND = 0x13;
|
|
|
|
|
|
|
|
public const byte LNOT = 0x14;
|
|
|
|
|
|
|
|
public const byte LT = 0x15;
|
|
|
|
public const byte LTE = 0x16;
|
|
|
|
public const byte GT = 0x17;
|
|
|
|
public const byte GTE = 0x18;
|
|
|
|
|
2023-07-30 07:55:10 +00:00
|
|
|
public const byte POP = 0xE9;
|
2023-07-29 00:11:09 +00:00
|
|
|
|
|
|
|
public const byte SCOPE_BEGIN = 0xEA;
|
|
|
|
public const byte SCOPE_END = 0xEB;
|
|
|
|
public const byte CALL_FUNC = 0xEC;
|
|
|
|
public const byte CALL_METHOD = 0xED;
|
|
|
|
public const byte JMP = 0xEE;
|
|
|
|
public const byte JMPC = 0xEF;
|
|
|
|
|
|
|
|
public const byte POP_ARRAY_VALUE = 0xF0;
|
|
|
|
public const byte PUSH_ARRAY_VALUE = 0xF1;
|
|
|
|
|
|
|
|
public const byte POP_FIELD_VALUE = 0xF2;
|
|
|
|
public const byte PUSH_FIELD_VALUE = 0xF3;
|
|
|
|
public const byte POP_VARIABLE_VALUE = 0xF4;
|
|
|
|
public const byte PUSH_VARIABLE_VALUE = 0xF5;
|
|
|
|
public const byte PUSH_CHAR = 0xF6;
|
|
|
|
public const byte PUSH_FALSE = 0xF7;
|
|
|
|
public const byte PUSH_TRUE = 0xF8;
|
|
|
|
public const byte PUSH_UNDEFINED = 0xF9;
|
|
|
|
public const byte PUSH_NULL = 0xFA;
|
|
|
|
public const byte PUSH_CLOSURE = 0xFB;
|
|
|
|
public const byte PUSH_STRING = 0xFC;
|
|
|
|
public const byte PUSH_DOUBLE = 0xFD;
|
|
|
|
public const byte NOP = 0xFE;
|
|
|
|
public const byte RET = 0xFF;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|