state->start while (config->has_more_input) { if (state->attempt_transition_for(config->current_input)) { # move config->remember(state->type) if state->accepts # memo config->input->advance # advance } else { config->rewind # rewind push (output_queue, token { # token type = config->type value = config->string }) state->start # restart } }