protected final short get_action(int state, int sym)
    {
      short tag;
      int first, last, probe;
      short[] row = action_tab[state];

      /* linear search if we are < 10 entries */
      if (row.length < 20)
        for (probe = 0; probe < row.length; probe++)
	  {
	    /* is this entry labeled with our Symbol or the default? */
	    tag = row[probe++];
	    if (tag == sym || tag == -1)
	      {
	        /* return the next entry */
	        return row[probe];
	      }
	  }
      /* otherwise binary search */
      else
	{
	  first = 0; 
	  last = (row.length-1)/2 - 1;  /* leave out trailing default entry */
	  while (first <= last)
	    {
	      probe = (first+last)/2;
	      if (sym == row[probe*2])
		return row[probe*2+1];
	      else if (sym > row[probe*2])
		first = probe+1;
	      else
	        last = probe-1;
	    }

	  /* not found, use the default at the end */
	  return row[row.length-1];
	}

      /* shouldn't happened, but if we run off the end we return the 
	 default (error == 0) */
      return 0;
    }