Ver Fonte

Code cleanup

Taddeus Kroes há 12 anos atrás
pai
commit
05b4f8ca70
1 ficheiros alterados com 8 adições e 12 exclusões
  1. 8 12
      phases/print.ml

+ 8 - 12
phases/print.ml

@@ -1,16 +1,12 @@
 open Types
 open Util
+open Stringify
 
 let tab = "    "
 let max_instr_width = 26
 
 let si = string_of_int
 
-let ctype2str = Stringify.type2str
-let type2str = function
-  | ArrayDims (t, dims) -> ctype2str t ^ repeat "," (List.length dims - 1)
-  | t -> ctype2str t
-
 let op2str = function
   | Neg -> "neg"
   | Not -> "not"
@@ -31,13 +27,13 @@ let prefix = function
   | Bool _  -> "b"
   | Int _   -> "i"
   | Float _ -> "f"
-  | Void  -> ""
-  | _     -> "a"
+  | Void    -> ""
+  | _       -> "a"
 
 let suffix = function
-  | Glob    -> "g"
-  | Current   -> ""
-  | Local     -> "l"
+  | Glob        -> "g"
+  | Current     -> ""
+  | Local       -> "l"
   | Rel nesting -> "n " ^ si nesting
 
 let rtn_suffix = function
@@ -64,7 +60,7 @@ let rec instr2str = function
   | Global ctype ->
     ".global " ^ (type2str ctype)
   | ConstDef value ->
-    ".const " ^ type2str (const_type value) ^ " " ^ Stringify.const2str value
+    ".const " ^ type2str (const_type value) ^ " " ^ const2str value
 
   (* Store *)
   | Store (ctype, scope, index) ->
@@ -162,7 +158,7 @@ let rec print_assembly oc instrs =
 let phase = function
   | Ast node as input ->
     prerr_endline hline;
-    prerr_endline (Stringify.node2str node);
+    prerr_endline (node2str node);
     prerr_endline hline;
     input