aboutsummaryrefslogtreecommitdiff
path: root/IO.icl
diff options
context:
space:
mode:
authorCamil Staps2016-07-01 09:11:02 +0200
committerCamil Staps2016-07-01 09:11:02 +0200
commit55e6cadc298beda9d079d99147b3cb0f50ce25ec (patch)
treedd28e78845843d2dff7d2b3daa2b60f5520e8b7e /IO.icl
parentFixes (diff)
Printing
Diffstat (limited to 'IO.icl')
-rw-r--r--IO.icl27
1 files changed, 26 insertions, 1 deletions
diff --git a/IO.icl b/IO.icl
index 0cec8fb..f2b0e29 100644
--- a/IO.icl
+++ b/IO.icl
@@ -1,3 +1,28 @@
implementation module ABC.IO
-:: IO = IO
+import StdEnv
+
+import ABC.Machine
+import ABC.Misc
+
+:: IO :== [Char]
+
+io_init :: IO
+io_init = []
+
+io_print :: a IO -> IO | toString a
+io_print x 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}
+ = "output : " <+ io <+ "\n" <+
+ "pc : " <+ pc <+ "\n" <+
+ "A-stack : " <+ astack <+ "\n" <+
+ "B-stack : " <+ bstack <+ "\n" <+
+ "C-stack : " <+ cstack <+ "\n" <+
+ "Graph :\n" <+ show_graphstore graphstore descstore