|
|
@@ -1,67 +1,106 @@
|
|
|
+(** Utility functions used by multiple phases. *)
|
|
|
+(**
|
|
|
+Extended description...
|
|
|
+*)
|
|
|
+
|
|
|
+(** *)
|
|
|
val repeat : string -> int -> string
|
|
|
+
|
|
|
+(** *)
|
|
|
val expand : int -> string -> string
|
|
|
|
|
|
-(* Logging functions, they print to stderr and consider the verbosity flag *)
|
|
|
-val hline : string
|
|
|
+(** Logging functions, they print to stderr and consider the verbosity flag *)
|
|
|
+val hline : string
|
|
|
+
|
|
|
+(** *)
|
|
|
val prt_line : string -> unit
|
|
|
+
|
|
|
+(** *)
|
|
|
val prt_node : Types.node -> unit
|
|
|
+
|
|
|
+(** *)
|
|
|
val log_line : int -> string -> unit
|
|
|
+
|
|
|
+(** *)
|
|
|
val log_plain_line : int -> string -> unit
|
|
|
+
|
|
|
+(** *)
|
|
|
val log_node : int -> Types.node -> unit
|
|
|
|
|
|
-(* Generate a fresh variable from a given prefix, e.g. "foo" -> "foo$1" *)
|
|
|
+(** Generate a fresh variable from a given prefix, e.g. "foo" -> "foo$1" *)
|
|
|
val fresh_var : string -> string
|
|
|
|
|
|
-(* Generate a fresg constant from a given prefix, e.g. "foo" -> "foo$$1" *)
|
|
|
+(** Generate a fresg constant from a given prefix, e.g. "foo" -> "foo$$1" *)
|
|
|
val fresh_const : string -> string
|
|
|
|
|
|
-(* Generate an Types.location tuple from Lexing data structures *)
|
|
|
+(** Generate an Types.location tuple from Lexing data structures *)
|
|
|
val loc_from_lexpos : Lexing.position -> Lexing.position -> Types.location
|
|
|
|
|
|
-(* Default transformation traversal for AST nodes *)
|
|
|
+(** Default transformation traversal for AST nodes *)
|
|
|
val transform_children : (Types.node -> Types.node) -> Types.node -> Types.node
|
|
|
|
|
|
-(* Add a single annotation to a node (no traversal) *)
|
|
|
+(** Add a single annotation to a node (no traversal) *)
|
|
|
val annotate : Types.annotation -> Types.node -> Types.node
|
|
|
|
|
|
-(*val visit_children : (Types.node -> unit) -> Types.node -> unit*)
|
|
|
+(** Extract annotation from node *)
|
|
|
+val annof : Types.node -> Types.annotation list
|
|
|
|
|
|
-(* Extract annotation from node *)
|
|
|
-val annof : Types.node -> Types.annotation list
|
|
|
-val locof : Types.node -> Types.location
|
|
|
+(** *)
|
|
|
+val locof : Types.node -> Types.location
|
|
|
+
|
|
|
+(** *)
|
|
|
val depthof : Types.node -> int
|
|
|
+
|
|
|
+(** *)
|
|
|
val indexof : Types.node -> int
|
|
|
-val typeof : Types.node -> Types.ctype
|
|
|
+
|
|
|
+(** *)
|
|
|
+val typeof : Types.node -> Types.ctype
|
|
|
+
|
|
|
+(** *)
|
|
|
val labelof : Types.node -> string
|
|
|
|
|
|
+(** *)
|
|
|
val const_type : Types.const -> Types.ctype
|
|
|
|
|
|
-(* Print file location to stderr *)
|
|
|
+(** Print file location to stderr *)
|
|
|
val prerr_loc : Types.location -> unit
|
|
|
|
|
|
-(* Print file location to stderr *)
|
|
|
+(** Print file location to stderr *)
|
|
|
val prerr_loc_msg : Types.location -> string -> unit
|
|
|
|
|
|
-(* Flatten Block nodes into the given array of nodes *)
|
|
|
+(** Flatten Block nodes into the given array of nodes *)
|
|
|
val flatten_blocks : Types.node list -> Types.node list
|
|
|
|
|
|
-(* Extract the node list from a Block node *)
|
|
|
+(** Extract the node list from a Block node *)
|
|
|
val block_body : Types.node -> Types.node list
|
|
|
|
|
|
-(* Get the basic type of a declaration, removing array dimensions *)
|
|
|
+(** Get the basic type of a declaration, removing array dimensions *)
|
|
|
val basetypeof : Types.node -> Types.ctype
|
|
|
|
|
|
-(* Get name from variable or function declaration *)
|
|
|
+(** Get name from variable or function declaration *)
|
|
|
val nameof : Types.node -> string
|
|
|
|
|
|
+(** *)
|
|
|
val optmap : ('a -> 'b) -> 'a list option -> 'b list option
|
|
|
+
|
|
|
+(** *)
|
|
|
val optmapl : ('a -> 'b) -> 'a list option -> 'b list
|
|
|
|
|
|
-(* List.mapi clone (only available in OCaml version >= 4.00 *)
|
|
|
+(** List.mapi clone (only available in OCaml version >= 4.00 *)
|
|
|
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
|
|
|
|
|
|
+(** *)
|
|
|
val is_immediate_const : Types.const -> bool
|
|
|
|
|
|
+(** *)
|
|
|
val is_array : Types.node -> bool
|
|
|
|
|
|
+(** *)
|
|
|
val node_warning : Types.node -> string -> unit
|
|
|
+
|
|
|
+(** *)
|
|
|
+val noloc : Types.location
|
|
|
+
|
|
|
+(** *)
|
|
|
+val immediate_consts : Types.const list
|