]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_disambiguation/cicTextualParser2.ml
- added a configuration variable for selecting between fresh instances
[helm.git] / helm / ocaml / cic_disambiguation / cicTextualParser2.ml
index 7c8261faebc372e2c92772bd1e50f3da3fc1af7f..f0de0b521b888593faaedf5468c12f0f9d9f715b 100644 (file)
@@ -31,6 +31,10 @@ let debug_print s =
     prerr_endline "</NEW_TEXTUAL_PARSER>"
   end
 
+  (** if set to true each number will have a different insance number and can
+  * thus be interpreted differently than others *)
+let use_fresh_num_instances = false
+
 open Printf
 
 exception Parse_error of string
@@ -40,6 +44,13 @@ type tactical = (CicAst.term, string) TacticAst.tactic TacticAst.tactical
 type command = CicAst.term CommandAst.command
 type script = CicAst.term CommandAst.Script.script
 
+let fresh_num_instance =
+  let n = ref 0 in
+  if use_fresh_num_instances then
+    (fun () -> incr n; !n)
+  else
+    (fun () -> 0)
+
 let choice_of_uri (uri: string) =
   let cic = HelmLibraryObjects.term_of_uri (UriManager.uri_of_string uri) in
   (uri, (fun _ _ _ -> cic))
@@ -112,9 +123,7 @@ EXTEND
         PAREN "]" ->
           substs
       ] ->
-        (match subst with
-        | Some l -> CicAst.Ident (s, l)
-        | None -> CicAst.Ident (s, []))
+        CicAst.Ident (s, subst)
     ]
   ];
   name: [ (* as substituted_name with no explicit substitution *)
@@ -171,19 +180,23 @@ EXTEND
             return_term loc
               (CicAst.Binder (`Pi, (Cic.Anonymous, Some t1), t2))
       ]
+    | "logic_add" LEFTA   [ (* nothing here by default *) ]
+    | "logic_mult" LEFTA  [ (* nothing here by default *) ]
+    | "logic_inv" NONA    [ (* nothing here by default *) ]
     | "relop" LEFTA
       [ t1 = term; SYMBOL "="; t2 = term ->
         return_term loc (CicAst.Appl [CicAst.Symbol ("eq", 0); t1; t2])
       ]
     | "add" LEFTA     [ (* nothing here by default *) ]
     | "mult" LEFTA    [ (* nothing here by default *) ]
+    | "power" LEFTA   [ (* nothing here by default *) ]
     | "inv" NONA      [ (* nothing here by default *) ]
     | "simple" NONA
       [ sort = sort -> CicAst.Sort sort
       | n = substituted_name -> return_term loc n
       | PAREN "("; head = term; args = LIST1 term; PAREN ")" ->
           return_term loc (CicAst.Appl (head :: args))
-      | i = NUM -> return_term loc (CicAst.Num (i, 0))
+      | i = NUM -> return_term loc (CicAst.Num (i, (fresh_num_instance ())))
       | IMPLICIT -> return_term loc CicAst.Implicit
       | m = META;
         substs = [