4.1.2

Интерпретатор конечного автомата на Рефале

 
Auto {    (eP) sS ()  =  sS;  
(eP) sS (sX eY)  =
  <Auto (eP) <Lookup sX <Lookup sS eP>> (eY)>;
}
Lookup   { sX (sX eA) eT  =  eA;
sX (sY eA) eT  =  <Lookup sX eT>;
}
 
Parity {
eX  =  <Auto   ( ( O  ('0'   O ) ('1'   I ))
( I  ('0' I ) ('1' O )))
O (eX)>;
}
 

 

<Parity '10'>

<Auto ((O('0'O)('1'I)) (I('0'I)('1'O))) O ('10')>
<Auto (...) <Lookup '1' <Lookup O (O('0'O)('1'I)) (I('0'I)('1'O))>> ('0')>
<Auto (...) <Lookup '1' ('0'O)('1'I)> ('1')>
<Auto (...) <Lookup '1' ('1'I)> ('1')>
<Auto (...) I ('1')>
<Auto (...) <Lookup '0' <Lookup I (O('0'O)('1'I)) (I('0'I)('1'O))>> ()>
<Auto (...) <Lookup '0' <Lookup I (I('0'I)('1'O))>> ()>
<Auto (...) <Lookup '0' ('0'I)('1'O)> ()>
<Auto (...) I ()>

I