Я хотел спросить, может ли исключение: «исключение Stack_overflow» вызывать бесконечный цикл, в частности, исключение возникает в следующем коде:
( *the loop "while" should stop when both stacks are empty*)
while (not (Stack.is_empty stackFalse) )|| ( not (Stack.is_empty stackTrue)) do
(
if (not ( Stack.is_empty stackTrue )) then
(
let q1 = Stack.pop stackTrue in
let (_,_,ptrs) = fst (Hashtbl.find graph ( fst q1) ) in
List.iter ( fun elem ->
let app = Hashtbl.find graph elem in
let (typeNode,last,ptrs') = fst app in
if typeNode = "Or-node" then
(
Stack.push (elem,true) stackTrue;
Hashtbl.add labeled elem true
)
else if last = false then
Hashtbl.replace graph elem ((typeNode,true,ptrs'),snd app)
else
(
Stack.push (elem,true) stackTrue;
Hashtbl.add labeled elem true
) ) ptrs ;
);
if (not ( Stack.is_empty stackFalse )) then
(
let q2 = Stack.pop stackFalse in
let (_,_,ptrs1) = fst (Hashtbl.find graph (fst q2) )in
List.iter ( fun elem ->
let app = Hashtbl.find graph elem in
let (typeNode,last,ptrs') = fst app in
if typeNode = "And-node" then
(
Stack.push (elem,false) stackFalse;
Hashtbl.add labeled elem false
)
else if last = false then
Hashtbl.replace graph elem ((typeNode,true,ptrs'),snd app)
else
(
Stack.push (elem,false) stackFalse;
Hashtbl.add labeled elem false
) ) ptrs1 ;
);
)
done;