diff --git a/pieuvre.ml b/pieuvre.ml index f26cea5..ac17afe 100644 --- a/pieuvre.ml +++ b/pieuvre.ml @@ -23,11 +23,11 @@ let rec string_of_lam (l: lam) : string = match l with let split, tsplit = let splitter regex x = - if string_match regex x 0 + if (string_match regex x 0) then let xStr = matched_group 1 x in let xInt = matched_group 2 x in - (xStr, int_of_string xInt) + (xStr, if xInt="" then 0 else (int_of_string xInt)) else raise (IllegalVarNameException(x)) in (splitter varRegex, splitter tvarRegex);; @@ -81,7 +81,7 @@ let rec alpha (l1: lam) (l2: lam) : bool = (t1 = t2) && (* On trouve un nom libre dans les deux sous-termes *) let v' = findFreeName (LApp(l1', l2')) v1 in - alpha (replace l1 v1 (LVar(v'))) (replace l2 v2 (LVar(v'))) + alpha (replace l1' v1 (LVar(v'))) (replace l2' v2 (LVar(v'))) | (LApp(lf1,lx1),LApp(lf2,lx2)) -> (alpha lf1 lf2) && (alpha lx1 lx2) | (LVar(x1),LVar(x2)) -> x1 = x2 | (LExf(l1', t1),LExf(l2', t2)) -> t1=t2 && (alpha l1' l2') diff --git a/structs.ml b/structs.ml index d789846..ede5557 100644 --- a/structs.ml +++ b/structs.ml @@ -1,13 +1,13 @@ (* Variables des λ-termes *) type var_lambda = string;; type var = var_lambda;; (* TODEL *) -let varRegex = Str.regexp "^([a-z]+)([0-9]*)$";; +let varRegex = Str.regexp "^\\([a-z]+\\)\\([0-9]*\\)$";; (* Variable des types simples *) type var_type = string;; type tvar = var_type;; (* TODEL *) -let tvarRegex = Str.regexp "^([A-Z]+)([0-9]*)$";; +let tvarRegex = Str.regexp "^([A-Z]+)([0-9]*)?$";; (* Type complexe *) type ty =