function find_first() { $dot = count($this->rhs); $last = $this->first[$dot] = new set(); while ($dot) { $dot--; $symbol_after_the_dot = $this->rhs[$dot]; $first = $symbol_after_the_dot->first->all(); bug_if(empty($first) and !$symbol_after_the_dot->lambda); $set = new set($first); if ($symbol_after_the_dot->lambda) { $set->union($last); if ($this->epsilon == $dot + 1) { $this->epsilon = $dot; } } $last = $this->first[$dot] = $set; } }