push method

void push(
  1. List<int> stack,
  2. int stack_top,
  3. int conflict_index,
  4. int curtok,
  5. int action_length,
)

Implementation

void push(List<int> stack, int stack_top, int conflict_index, int curtok,
    int action_length) {
  var configuration = ConfigurationElement();
  var hash_address = curtok % TABLE_SIZE;
  configuration.next = table[hash_address];
  table[hash_address] = configuration;
  max_configuration_size++; // keep track of number of configurations

  configuration.stack_top = stack_top;
  stacks_size +=
      (stack_top + 1); // keep track of number of stack elements processed
  configuration.last_element =
      findOrInsertStack(state_root, stack, 0, stack_top);
  configuration.conflict_index = conflict_index;
  configuration.curtok = curtok;
  configuration.action_length = action_length;

  configuration_stack.add(configuration);

  return;
}