X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=ocaml%2Fparser.ml;h=6bcb70d909fd0b6117292aa2cdcb3b9a7d88da0f;hb=0a50c398d9eef65620f18f99ef675770b50a920c;hp=15c72bd7df1fdd139c0e9f6b2826d42257564ffa;hpb=2d56686ea25883e77d0a69f1245e6e840fc8be5f;p=fireball-separation.git diff --git a/ocaml/parser.ml b/ocaml/parser.ml index 15c72bd..6bcb70d 100644 --- a/ocaml/parser.ml +++ b/ocaml/parser.ml @@ -29,10 +29,10 @@ let explode s = ;; let implode l = - let res = String.create (List.length l) in + let res = Bytes.create (List.length l) in let rec aux i = function | [] -> res - | c :: l -> res.[i] <- c; aux (i + 1) l in + | c :: l -> Bytes.set res i c; aux (i + 1) l in aux 0 l ;; @@ -118,13 +118,11 @@ let parse x = | _, _, _ -> raise (ParsingError "???") ;; -let var_zero = "Z";; (* the name for the zero *) - let parse_many strs = let f (x, y) z = match read_smt y (explode z) with | Some[tm], [], vars -> (tm :: x, vars) | _, _, _ -> raise (ParsingError "???") - in let aux = List.fold_left f ([], ([], [var_zero])) (* index zero is reserved *) + in let aux = List.fold_left f ([], ([], [])) (* index zero is reserved *) in let (tms, (_, free)) = aux strs in (List.rev tms, free) ;; @@ -191,7 +189,7 @@ let problem_of_string s = | #nf_nob as t -> t | `Bottom -> raise (ParsingError "Input term not in normal form") in let rec aux_nob lev : nf_nob -> nf = function - | `I((n,_), args) -> `I((n,1 + Listx.length args), Listx.map (fun t -> exclude_bottom (aux_nob lev t)) args) + | `I((n,_), args) -> `I((n,(if lev = 0 then 0 else 1) + Listx.length args), Listx.map (fun t -> exclude_bottom (aux_nob lev t)) args) | `Var(n,_) -> fix lev n | `Lam(_,t) -> `Lam (true, aux (lev+1) t) | `Match _ | `N _ -> assert false