⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opcode.h

📁 这是一些于C++做的经典例子
💻 H
字号:
#ifndef __Opcodes_H__
#define __Opcodes_H__


// This enumeration defines the set of opcodes that the interpreter
// understands.  The code generator needs to use this enumeration to generate
// the proper bytecode stream, and the interpreter uses this enumeration to
// actually evaluate the instructions.
enum Opcode {
  // Define the four basic math opcodes.
  Add_Opcode,
  Subtract_Opcode,
  Multiply_Opcode,
  Divide_Opcode,

  // Push & pop add and remove a value from the interpreter's stack.
  Push_Opcode,
  Pop_Opcode,

  // The dupe opcode takes the stack element and pushes a copy of it onto the
  // stack.
  Dupe_Opcode,

  // These two opcodes loads and stores a variable off of the stack.  The
  // opcode's argument is the offset (in stack words) from the first element
  // in the stack where the variable exists.
  Load_Opcode,
  Store_Opcode,

  // Increments the instruction pointer by the opcode's argument (i.e., a
  // relative jump).
  Jump_Opcode,

  // Pops the stack element off and increments the instruction pointer by
  // the opcode's argument if the stack element is zero (i.e., performs a
  // relative jump on zero).
  IfZero_Opcode,

  // This simply defines the maximum number of opcodes used.
  Num_Opcode
};


#endif // __Opcodes_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -