exception Reconnu
let reconnaitre automate str=
let rec reconrec a s k=
if String.length s = k then
(if a.terminal then
raise Reconnu
else
false)
else
match a.voisins with
None -> false
| Some vss ->
(for i=0 to (Array.length vss)-1 do
let v = (Array.get vss i) in
match v.conditions_darrive with
None -> reconrec v s k
| Some cdts ->
(for j=0 to (Array.length cdts)-1 do
if ( Char.compare s.[k] (Array.get cdts j) )=0 then
reconrec v s (k+1)
else
false
done);
false
done);
false
in
try
reconrec automate str 0
with
Reconnu -> true
Add a code snippet to your website: www.paste.org