summaryrefslogtreecommitdiff
path: root/src/ocaml_backend.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/ocaml_backend.ml')
-rw-r--r--src/ocaml_backend.ml20
1 files changed, 1 insertions, 19 deletions
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml
index 970dea83..a2c40b03 100644
--- a/src/ocaml_backend.ml
+++ b/src/ocaml_backend.ml
@@ -52,6 +52,7 @@ open Ast
open Ast_util
open PPrint
open Type_check
+open Util
module Big_int = Nat_big_num
@@ -77,25 +78,6 @@ let gensym () =
incr gensym_counter;
string gs
-let zchar c =
- let zc c = "z" ^ String.make 1 c in
- if Char.code c <= 41 then zc (Char.chr (Char.code c + 16))
- else if Char.code c <= 47 then zc (Char.chr (Char.code c + 23))
- else if Char.code c <= 57 then String.make 1 c
- else if Char.code c <= 64 then zc (Char.chr (Char.code c + 13))
- else if Char.code c <= 90 then String.make 1 c
- else if Char.code c <= 94 then zc (Char.chr (Char.code c - 13))
- else if Char.code c <= 95 then "_"
- else if Char.code c <= 96 then zc (Char.chr (Char.code c - 13))
- else if Char.code c <= 121 then String.make 1 c
- else if Char.code c <= 122 then "zz"
- else if Char.code c <= 126 then zc (Char.chr (Char.code c - 39))
- else raise (Invalid_argument "zchar")
-
-let zencode_string str = "z" ^ List.fold_left (fun s1 s2 -> s1 ^ s2) "" (List.map zchar (Util.string_to_list str))
-
-let zencode_upper_string str = "Z" ^ List.fold_left (fun s1 s2 -> s1 ^ s2) "" (List.map zchar (Util.string_to_list str))
-
let zencode ctx id =
try string (string_of_id (Bindings.find id ctx.externs)) with
| Not_found -> string (zencode_string (string_of_id id))