util.mli 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. (* Generate a fresh variable from a given prefix, e.g. "counter" -> "counter$1" *)
  2. val fresh_var : string -> string
  3. (* Generate an Ast.loc tuple from Lexing data structures *)
  4. val loc_from_lexpos : Lexing.position -> Lexing.position -> Ast.loc
  5. (* Default transformation traversal for AST nodes *)
  6. val transform_children : (Ast.node -> Ast.node) -> Ast.node -> Ast.node
  7. (* Transform all nodes in a list *)
  8. val transform_all : (Ast.node -> Ast.node) -> Ast.node list -> Ast.node list
  9. (*val visit_children : (Ast.node -> unit) -> Ast.node -> unit*)
  10. (* Extract location from node *)
  11. val locof : Ast.node -> Ast.loc
  12. (* Print file location to stderr *)
  13. val prerr_loc : Ast.loc -> unit
  14. (* Print file location to stderr *)
  15. val prerr_loc_msg : Ast.loc -> string -> int -> unit
  16. (* Flatten Block nodes into the given array of nodes *)
  17. val flatten_blocks : Ast.node list -> Ast.node list
  18. (* Get function / expression type *)
  19. val ctypeof : Ast.node -> Ast.ctype
  20. (* Extract the node list from a Block node *)
  21. val block_body : Ast.node -> Ast.node list