c trop nul le perl
- cette fonction ne marche pas si il n´est pas deteministe
sub accepter_mot ( \%$ ) {
my @automate= @{$_[0]{delta}} ;
my @etat_final= @{$_[0]{final}};
shift;
my $mot = $_[0];
shift @_;
my $etat_courant = 0;
my $symb;
analyse: while ( $symb = $mot =~ / \S/g) { # attention $symb contient le fait de savoir si cela match ou pas
# et non le caractere matche;
last analyse if ( ! defined ( $automate[$etat_courant]{$& }[0]) ) ; # on sort de la boucle
print STDERR " $etat_courant $& \n";
$etat_courant = $automate[$etat_courant]{$& }[0] ; # on change d´etat
}
print STDERR " $etat_courant |$symb|\n"; # on trace pour voir
if ( $symb || ! $etat_final[$etat_courant]) { return " ko";} # valeur de retour
else { return " ok"; }
}