aboutsummaryrefslogblamecommitdiff
path: root/ABC/Machine/IO.icl
blob: 1169c6bbb82bb31667267247cfa38314532268f1 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                    
 



                  
                  
 
                                                            
 
               
                                   
                                                       






                                                                          
                                               


                                                                       
implementation module ABC.Machine.IO

import StdEnv

import ABC.Machine
import ABC.Misc

:: IO =: IO [Char]

instance toString IO where toString (IO io) = {c \\ c <- io}

io_init :: IO
io_init = IO []

io_print :: a IO -> IO | toString a
io_print x (IO io) = IO (io ++ fromString (toString x))

show_node :: Node Desc -> String
show_node (Basic _ _ b) _           = toString b
show_node (Node _ _ _) (Desc _ _ n) = n

instance toString State
where
	toString {astack,bstack,cstack,graphstore,descstore,pc,program,io}
		= "pc      : " <+ pc <+ "\n" <+
		  "A-stack : " <+ astack <+ "\n" <+
		  "B-stack : " <+ bstack <+ "\n" <+
		  "C-stack : " <+ cstack <+ "\n" <+
		  "Graph   :\n" <+ show_graphstore graphstore descstore