From: Claudio Sacerdoti Coen Date: Fri, 13 Oct 2006 16:57:10 +0000 (+0000) Subject: Content level representation of LetRec changed. X-Git-Tag: 0.4.95@7852~891 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=f084490a318c45b1a4090a85119f54c463aec063;p=helm.git Content level representation of LetRec changed. --- diff --git a/components/content_pres/cicNotationParser.ml b/components/content_pres/cicNotationParser.ml index 7aa4efe17..088d1b69d 100644 --- a/components/content_pres/cicNotationParser.ml +++ b/components/content_pres/cicNotationParser.ml @@ -46,6 +46,7 @@ let level1_pattern = let level2_ast = Grammar.Entry.create level2_ast_grammar "level2_ast" let term = Grammar.Entry.create level2_ast_grammar "term" let let_defs = Grammar.Entry.create level2_ast_grammar "let_defs" +let protected_binder_vars = Grammar.Entry.create level2_ast_grammar "protected_binder_vars" let level2_meta = Grammar.Entry.create level2_meta_grammar "level2_meta" let int_of_string s = @@ -420,7 +421,7 @@ END (* {{{ Grammar for ast patterns, notation level 2 *) EXTEND - GLOBAL: level2_ast term let_defs; + GLOBAL: level2_ast term let_defs protected_binder_vars; level2_ast: [ [ p = term -> p ] ]; sort: [ [ "Prop" -> `Prop @@ -502,12 +503,6 @@ EXTEND index_name = OPT [ "on"; id = single_arg -> id ]; ty = OPT [ SYMBOL ":" ; p = term -> p ]; SYMBOL <:unicode> (* ≝ *); body = term -> - let body = fold_binder `Lambda args body in - let ty = - match ty with - | None -> None - | Some ty -> Some (fold_binder `Pi args ty) - in let rec position_of name p = function | [] -> None, p | n :: _ when n = name -> Some p, p @@ -527,7 +522,13 @@ EXTEND | None -> 0 | Some index_name -> find_arg index_name 0 args in - (name, ty), body, index + let args = + List.concat + (List.map + (function (names,ty) -> List.map (function x -> x,ty) names + ) args) + in + args, (name, ty), body, index ] SEP "and" -> defs ] @@ -537,12 +538,15 @@ EXTEND l = LIST1 single_arg SEP SYMBOL "," -> l | SYMBOL "_" -> [Ast.Ident ("_", None)] ]; typ = OPT [ SYMBOL ":"; t = term -> t ] -> (vars, typ) - | LPAREN; - vars = [ - l = LIST1 single_arg SEP SYMBOL "," -> l - | SYMBOL "_" -> [Ast.Ident ("_", None)] ]; - typ = OPT [ SYMBOL ":"; t = term -> t ]; - RPAREN -> (vars, typ) + ] + ]; + protected_binder_vars: [ + [ LPAREN; vars = binder_vars; RPAREN -> vars + ] + ]; + maybe_protected_binder_vars: [ + [ vars = binder_vars -> vars + | vars = protected_binder_vars -> vars ] ]; term: LEVEL "10N" [ (* let in *) @@ -556,10 +560,10 @@ EXTEND ]; term: LEVEL "20R" (* binder *) [ - [ b = binder; (vars, typ) = binder_vars; SYMBOL "."; body = term -> + [ b = binder; (vars, typ) = maybe_protected_binder_vars; SYMBOL "."; body = term -> return_term loc (fold_cluster b vars typ body) | SYMBOL <:unicode> (* ∃ *); - (vars, typ) = binder_vars; SYMBOL "."; body = term -> + (vars, typ) = maybe_protected_binder_vars; SYMBOL "."; body = term -> return_term loc (fold_exists vars typ body) ] ]; diff --git a/components/content_pres/cicNotationParser.mli b/components/content_pres/cicNotationParser.mli index 978daf9ff..53182dc31 100644 --- a/components/content_pres/cicNotationParser.mli +++ b/components/content_pres/cicNotationParser.mli @@ -56,9 +56,12 @@ val level2_ast_grammar: Grammar.g val term : CicNotationPt.term Grammar.Entry.e val let_defs : - (CicNotationPt.capture_variable * CicNotationPt.term * int) list + (CicNotationPt.capture_variable list * CicNotationPt.capture_variable * CicNotationPt.term * int) list Grammar.Entry.e +val protected_binder_vars : + (CicNotationPt.term list * CicNotationPt.term option) Grammar.Entry.e + val parse_term: Ulexing.lexbuf -> CicNotationPt.term (** {2 Debugging} *)