X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_disambiguation%2FcicTextualParser2.ml;h=1b67821c1ec8630a3d24dd71c7ae4c3e3e2042da;hb=180f30d039f1d2894c6a118ecee5549835127c72;hp=d3d6e28aebcbb4377d9ad343774b89b16b4ba601;hpb=aa0c24992572f26d8e78ae34b60c7e151167cf49;p=helm.git diff --git a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml index d3d6e28ae..1b67821c1 100644 --- a/helm/ocaml/cic_disambiguation/cicTextualParser2.ml +++ b/helm/ocaml/cic_disambiguation/cicTextualParser2.ml @@ -229,10 +229,12 @@ EXTEND ]]; constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ]; binder_vars: [ - [ vars = LIST1 IDENT SEP SYMBOL ","; + [ vars = [ l = LIST1 IDENT SEP SYMBOL "," -> l | SYMBOL "_" -> ["_"]]; typ = OPT [ SYMBOL ":"; t = term -> t ] -> (vars, typ) - | PAREN "("; vars = LIST1 IDENT SEP SYMBOL ","; - typ = OPT [ SYMBOL ":"; t = term -> t ]; PAREN ")" -> (vars, typ) + | PAREN "("; + vars = [ l = LIST1 IDENT SEP SYMBOL "," -> l | SYMBOL "_" -> ["_"]]; + typ = OPT [ SYMBOL ":"; t = term -> t ]; + PAREN ")" -> (vars, typ) ] ]; term0: [ [ t = term; EOI -> return_term loc t ] ]; @@ -340,86 +342,87 @@ EXTEND | SYMBOL "<" -> `Right ] ]; tactic: [ - [ [ IDENT "absurd" ]; t = tactic_term -> + [ IDENT "absurd"; t = tactic_term -> TacticAst.Absurd (loc, t) - | [ IDENT "apply" ]; t = tactic_term -> + | IDENT "apply"; t = tactic_term -> TacticAst.Apply (loc, t) - | [ IDENT "assumption" ] -> + | IDENT "assumption" -> TacticAst.Assumption loc - | [ IDENT "auto" ] ; num = OPT [ i = NUM -> int_of_string i ] -> - TacticAst.Auto (loc,num) - | [ IDENT "change" ]; - t1 = tactic_term; "with"; t2 = tactic_term; where = pattern_spec -> + | IDENT "auto"; + depth = OPT [ IDENT "depth"; SYMBOL "="; i = NUM -> int_of_string i ]; + width = OPT [ IDENT "depth"; SYMBOL "="; i = NUM -> int_of_string i ] -> + TacticAst.Auto (loc,depth,width) + | IDENT "change"; t1 = tactic_term; "with"; t2 = tactic_term; "in"; + where = pattern_spec -> TacticAst.Change (loc, t1, t2, where) - (* TODO Change_pattern *) - | [ IDENT "contradiction" ] -> + | IDENT "compare"; t = tactic_term -> + TacticAst.Compare (loc,t) + | IDENT "constructor"; n = NUM -> + TacticAst.Constructor (loc,int_of_string n) + | IDENT "contradiction" -> TacticAst.Contradiction loc - | [ IDENT "cut" ]; - t = tactic_term -> + | IDENT "cut"; t = tactic_term -> TacticAst.Cut (loc, t) - | [ IDENT "decompose" ]; where = term -> + | IDENT "decide"; IDENT "equality" -> + TacticAst.DecideEquality loc + | IDENT "decompose"; where = term -> TacticAst.Decompose (loc, where) - | [ IDENT "discriminate" ]; - t = tactic_term -> + | IDENT "discriminate"; t = tactic_term -> TacticAst.Discriminate (loc, t) - | [ IDENT "elimType" ]; t = tactic_term -> - TacticAst.ElimType (loc, t) - | [ IDENT "elim" ]; - t1 = tactic_term; + | IDENT "elim"; t1 = tactic_term; using = OPT [ "using"; using = tactic_term -> using ] -> TacticAst.Elim (loc, t1, using) - | [ IDENT "exact" ]; t = tactic_term -> + | IDENT "elimType"; t = tactic_term -> + TacticAst.ElimType (loc, t) + | IDENT "exact"; t = tactic_term -> TacticAst.Exact (loc, t) - | [ IDENT "exists" ] -> + | IDENT "exists" -> TacticAst.Exists loc - | [ IDENT "fold" ]; - kind = reduction_kind; t = tactic_term -> + | IDENT "fold"; kind = reduction_kind; t = tactic_term -> TacticAst.Fold (loc, kind, t) - | [ IDENT "fourier" ] -> + | IDENT "fourier" -> TacticAst.Fourier loc - | IDENT "goal"; n = NUM -> TacticAst.Goal (loc, int_of_string n) - | [ IDENT "injection" ]; t = term -> + | IDENT "fwd"; t = term -> + TacticAst.FwdSimpl (loc, t) + | IDENT "generalize"; t = tactic_term; p = OPT [ pattern_spec ] -> + let p = match p with None -> [], None | Some p -> p in + TacticAst.Generalize (loc,t,p) + | IDENT "goal"; n = NUM -> + TacticAst.Goal (loc, int_of_string n) + | IDENT "injection"; t = term -> TacticAst.Injection (loc, t) - | [ IDENT "intros" ]; - num = OPT [ num = int -> num ]; - idents = OPT ident_list0 -> + | IDENT "intros"; num = OPT [num = int -> num]; idents = OPT ident_list0 -> let idents = match idents with None -> [] | Some idents -> idents in TacticAst.Intros (loc, num, idents) - | [ IDENT "intro" ] -> - TacticAst.Intros (loc, Some 1, []) - | [ IDENT "left" ] -> TacticAst.Left loc - | [ IDENT "letin" ]; - where = IDENT ; SYMBOL <:unicode> ; t = tactic_term -> + | IDENT "intro"; ident = OPT IDENT -> + let idents = match ident with None -> [] | Some id -> [id] in + TacticAst.Intros (loc, Some 1, idents) + | IDENT "lapply"; what = tactic_term; + to_what = OPT [ "to" ; t = tactic_term -> t ] -> + TacticAst.LApply (loc, to_what, what) + | IDENT "left" -> TacticAst.Left loc + | IDENT "letin"; where = IDENT ; SYMBOL <:unicode> ; t = tactic_term -> TacticAst.LetIn (loc, t, where) - | kind = reduction_kind; - p = OPT [ pattern_spec ] -> + | kind = reduction_kind; p = OPT [ pattern_spec ] -> let p = match p with None -> [], None | Some p -> p in TacticAst.Reduce (loc, kind, p) - | IDENT "generalize"; t = tactic_term; p = OPT [ pattern_spec ] -> - let p = match p with None -> [], None | Some p -> p in - TacticAst.Generalize (loc,t,p) - | [ IDENT "reflexivity" ] -> + | IDENT "reflexivity" -> TacticAst.Reflexivity loc - | [ IDENT "replace" ]; - t1 = tactic_term; "with"; t2 = tactic_term -> + | IDENT "replace"; t1 = tactic_term; "with"; t2 = tactic_term -> TacticAst.Replace (loc, t1, t2) - | IDENT "rewrite" ; d = direction; t = term ; - p = OPT [ pattern_spec ] -> + | IDENT "rewrite" ; d = direction; t = term ; p = OPT [ pattern_spec ] -> let p = match p with None -> [], None | Some p -> p in TacticAst.Rewrite (loc, d, t, p) - | [ IDENT "right" ] -> TacticAst.Right loc - | [ IDENT "ring" ] -> TacticAst.Ring loc - | [ IDENT "split" ] -> TacticAst.Split loc - | [ IDENT "symmetry" ] -> + | IDENT "right" -> + TacticAst.Right loc + | IDENT "ring" -> + TacticAst.Ring loc + | IDENT "split" -> + TacticAst.Split loc + | IDENT "symmetry" -> TacticAst.Symmetry loc - | [ IDENT "transitivity" ]; - t = tactic_term -> + | IDENT "transitivity"; t = tactic_term -> TacticAst.Transitivity (loc, t) - | [ IDENT "fwd" ]; t = term -> - TacticAst.FwdSimpl (loc, t) - | [ IDENT "lapply" ]; what = tactic_term; - to_what = OPT [ "to" ; t = tactic_term -> t ] -> - TacticAst.LApply (loc, to_what, what) ] ]; tactical: