6 itake box = IMove { m_count=1, m_recycle=False, m_tokenIn=False, m_dataIn=True,
7 m_latch=True, m_dataOut=False, m_tokenOut=False, m_dest=Nothing,
9 move box = (itake box){ m_dataOut=True }
10 send box = (move box){ m_dataIn=False, m_latch=False }
16 | ILiteral Int BenkoBox
17 | IMove { m_benkobox :: BenkoBox ,
18 m_dest :: Maybe BenkoBox ,
27 showCount 0 True = "[*r] "
28 showCount 0 False = "[*] "
30 showCount n True = "["++(show n)++"r] "
31 showCount n False = "["++(show n)++"] "
33 instance Show Inst where
34 show (IKill bb count) = (show bb)++": "++(showCount count False)++" kill;"
35 show (ILiteral lit bb) = (show lit)++": sendto "++(show bb)++";"
36 show m@(_) = (show $ m_benkobox m) ++
38 (showCount (m_count m) $ m_recycle m) ++
39 (join ", " $ showrest m)++
42 showrest m = wait++takelatch++out++ack
44 wait = if m_tokenIn m then ["wait"] else []
45 takelatch = if m_dataIn m then (if m_latch m then ["take"] else ["drop"]) else []
46 out = if m_dataOut m then (case m_dest m of { Nothing -> ["deliver"]; (Just j) -> ["sendto "++(show j)] }) else []
47 ack = if m_tokenOut m then (case m_dest m of (Just j) -> ["ack "++(show j)]) else []