Class Constant

java.lang.Object
com.maroontress.intexpr.impl.Constant
All Implemented Interfaces:
Instruction

public final class Constant extends Object implements Instruction
This class provides the instruction that places an integer constant (as an operand) to a stack.
  • Constructor Details

    • Constant

      public Constant(com.maroontress.clione.Token token)
      Creates a new instance.
      Parameters:
      token - The token representing an integer constant.
  • Method Details

    • accept

      public void accept(Deque<SyntaxNode> stack)
      Interacts with the specified stack of the SyntaxNode object to build a SyntaxTree object.
      Specified by:
      accept in interface Instruction
      Parameters:
      stack - The stack of a SyntaxNode object.
    • apply

      public int apply(int[] stack, int offset)
      Interacts with the specified stack of an integer.
      Specified by:
      apply in interface Instruction
      Parameters:
      stack - The stack of an integer.
      offset - The position of the top of the stack.
      Returns:
      The new offset of the top of the stack.
    • toString

      public String toString()
      Overrides:
      toString in class Object