1 (* Copyright (C) 2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
31 type ast_statement = G.statement
33 let exc_located_wrapper f =
37 | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file
38 | Stdpp.Exc_located (floc, Stream.Error msg) ->
39 raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg))
40 | Stdpp.Exc_located (floc, HExtlib.Localized(_,exn)) ->
41 raise (HExtlib.Localized
42 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
43 | Stdpp.Exc_located (floc, exn) ->
44 raise (HExtlib.Localized
45 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
47 let parse_statement grafite_parser lexbuf =
49 (fun () -> (Grammar.Entry.parse (Obj.magic grafite_parser) (Obj.magic lexbuf)))
51 let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
53 let default_associativity = Gramext.NonA
55 let mk_rec_corec ind_kind defs loc =
58 | (params,(N.Ident (name, None), ty),_,_) :: _ ->
59 let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in
62 (fun var ty -> N.Binder (`Pi,var,ty)
68 let body = N.Ident (name,None) in
69 (loc, N.Theorem(`Definition, name, ty, Some (N.LetRec (ind_kind, defs, body)), `Regular))
71 let nmk_rec_corec ind_kind defs loc =
72 let loc,t = mk_rec_corec ind_kind defs loc in
76 let nnon_punct_of_punct = function
77 | G.Skip loc -> G.NSkip loc
78 | G.Unfocus loc -> G.NUnfocus loc
79 | G.Focus (loc,l) -> G.NFocus (loc,l)
82 type by_continuation =
84 | BYC_weproved of N.term * string option * N.term option
85 | BYC_letsuchthat of string * N.term * string * N.term
86 | BYC_wehaveand of string * N.term * string * N.term
88 let mk_parser statement lstatus =
89 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
90 let term = CicNotationParser.term lstatus in
91 let let_defs = CicNotationParser.let_defs lstatus in
92 let protected_binder_vars = CicNotationParser.protected_binder_vars lstatus in
93 (* {{{ parser initialization *)
95 GLOBAL: term statement;
96 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
97 tactic_term: [ [ t = term LEVEL "90" -> t ] ];
101 | id = IDENT -> Some id ]
104 ident_list1: [ [ LPAREN; idents = LIST1 IDENT; RPAREN -> idents ] ];
106 [ tactic_terms = LIST1 tactic_term SEP SYMBOL "," -> tactic_terms ]
109 [ IDENT "normalize" ; delta = OPT [ IDENT "nodelta" -> () ] ->
110 let delta = match delta with None -> true | _ -> false in
112 (*| IDENT "unfold"; t = OPT tactic_term -> `Unfold t*)
113 | IDENT "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
114 let delta = match delta with None -> true | _ -> false in
117 sequent_pattern_spec: [
121 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
122 (id,match path with Some p -> p | None -> N.UserInput) ];
123 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
125 match goal_path, hyp_paths with
126 None, [] -> Some N.UserInput
128 | Some goal_path, _ -> Some goal_path
137 [ "match" ; wanted = tactic_term ;
138 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
140 | sps = sequent_pattern_spec ->
143 let wanted,hyp_paths,goal_path =
144 match wanted_and_sps with
145 wanted,None -> wanted, [], Some N.UserInput
146 | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
148 wanted, hyp_paths, goal_path ] ->
150 None -> None,[],Some N.UserInput
153 inverter_param_list: [
154 [ params = tactic_term ->
155 let deannotate = function
156 | N.AttributedTerm (_,t) | t -> t
157 in match deannotate params with
158 | N.Implicit _ -> [false]
159 | N.UserInput -> [true]
161 List.map (fun x -> match deannotate x with
162 | N.Implicit _ -> false
163 | N.UserInput -> true
164 | _ -> raise (Invalid_argument "malformed target parameter list 1")) l
165 | _ -> raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term params)) ]
168 [ SYMBOL ">" -> `LeftToRight
169 | SYMBOL "<" -> `RightToLeft ]
171 int: [ [ num = NUMBER -> int_of_string num ] ];
174 [ OPT [ IDENT "names" ];
175 num = OPT [ num = int -> num ];
176 idents = intros_names ->
181 (* MATITA 1.0 using: [ [ using = OPT [ IDENT "using"; t = tactic_term -> t ] -> using ] ]; *)
183 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
184 | IDENT "apply"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
185 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
189 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
190 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
191 SYMBOL <:unicode<def>> ; bo = tactic_term ->
193 SYMBOL <:unicode<vdash>>;
194 concl = tactic_term -> (List.rev hyps,concl) ] ->
195 G.NTactic(loc,[G.NAssert (loc, seqs)])
196 (*| IDENT "auto"; params = auto_params ->
197 G.NTactic(loc,[G.NAuto (loc, params)])*)
198 | SYMBOL "/"; num = OPT NUMBER ;
199 just_and_params = auto_params; SYMBOL "/" ->
200 let just,params = just_and_params in
201 let depth = match num with Some n -> n | None -> "1" in
205 [G.NAuto(loc,(None,["depth",depth]@params))])
206 | Some (`Univ univ) ->
208 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
211 [G.NAuto(loc,(Some [],["depth",depth]@params))])
214 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
215 | IDENT "intros" -> G.NMacro (loc, G.NIntroGuess loc)
216 | IDENT "check"; t = term -> G.NMacro(loc,G.NCheck (loc,t))
217 | IDENT "screenshot"; fname = QSTRING ->
218 G.NMacro(loc,G.Screenshot (loc, fname))
219 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
220 G.NTactic(loc,[G.NCases (loc, what, where)])
221 | IDENT "change"; what = pattern_spec; "with"; with_what = tactic_term ->
222 G.NTactic(loc,[G.NChange (loc, what, with_what)])
223 | SYMBOL "@"; num = OPT NUMBER; l = LIST0 tactic_term ->
224 G.NTactic(loc,[G.NConstructor (loc, (match num with None -> None | Some x -> Some (int_of_string x)),l)])
225 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
226 (* | IDENT "discriminate"; t = tactic_term -> G.NDiscriminate (loc, t)
227 | IDENT "subst"; t = tactic_term -> G.NSubst (loc, t) *)
228 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
229 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
230 -> let exclude' = match exclude with None -> [] | Some l -> l in
231 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
232 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
233 G.NTactic(loc,[G.NElim (loc, what, where)])
234 | IDENT "generalize"; p=pattern_spec ->
235 G.NTactic(loc,[G.NGeneralize (loc, p)])
236 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
237 G.NTactic(loc,[G.NInversion (loc, what, where)])
238 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
239 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
240 where = pattern_spec ->
241 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
242 | kind = nreduction_kind; p = pattern_spec ->
243 G.NTactic(loc,[G.NReduce (loc, kind, p)])
244 | dir = direction; what = tactic_term ; where = pattern_spec ->
245 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
246 | IDENT "rewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
247 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
248 | IDENT "try"; tac = SELF ->
249 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
250 G.NTactic(loc,[ G.NTry (loc,tac)])
251 | IDENT "repeat"; tac = SELF ->
252 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
253 G.NTactic(loc,[ G.NRepeat (loc,tac)])
254 | LPAREN; l = LIST1 SELF; RPAREN ->
257 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
258 G.NTactic(loc,[G.NBlock (loc,l)])
259 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
260 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
261 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
262 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
263 | SYMBOL "*"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
268 | IDENT "fast_paramod"
282 i = auto_fixed_param -> i,""
283 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
284 string_of_int v | v = IDENT -> v ] -> i,v ];
285 just = OPT [ IDENT "by"; by =
286 [ univ = tactic_term_list1 -> `Univ univ
287 | SYMBOL "{"; SYMBOL "}" -> `EmptyUniv
288 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
294 [ WEPROVED; ty = tactic_term ; LPAREN ; id = IDENT ; RPAREN ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] -> BYC_weproved (ty,Some id,t1)
295 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
296 "done" -> BYC_weproved (ty,None,t1)
298 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
299 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
300 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
301 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
302 BYC_wehaveand (id1,t1,id2,t2)
307 rewriting_step_continuation : [
316 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
319 | G.Seq (_, l) -> l @ [ t2 ]
325 [ tac = SELF; SYMBOL ";";
326 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
327 (G.Then (loc, tac, tacs))
330 [ IDENT "do"; count = int; tac = SELF ->
331 G.Do (loc, count, tac)
332 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
336 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
338 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
340 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
342 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
343 | LPAREN; tac = SELF; RPAREN -> tac
344 | tac = tactic -> tac
348 npunctuation_tactical:
350 [ SYMBOL "[" -> G.NBranch loc
351 | SYMBOL "|" -> G.NShift loc
352 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
353 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
354 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
355 | SYMBOL "]" -> G.NMerge loc
356 | SYMBOL ";" -> G.NSemicolon loc
357 | SYMBOL "." -> G.NDot loc
360 nnon_punctuation_tactical:
362 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
363 | IDENT "unfocus" -> G.NUnfocus loc
364 | IDENT "skip" -> G.NSkip loc
368 [ [ IDENT "definition" ] -> `Definition
369 | [ IDENT "fact" ] -> `Fact
370 | [ IDENT "lemma" ] -> `Lemma
371 | [ IDENT "example" ] -> `Example
372 | [ IDENT "theorem" ] -> `Theorem
373 | [ IDENT "corollary" ] -> `Corollary
378 params = LIST0 protected_binder_vars;
379 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
380 fst_constructors = LIST0 constructor SEP SYMBOL "|";
383 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
384 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
385 (name, true, typ, constructors) ] SEP "with" -> types
389 (fun (names, typ) acc ->
390 (List.map (fun name -> (name, typ)) names) @ acc)
393 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
394 let tl_ind_types = match tl with None -> [] | Some types -> types in
395 let ind_types = fst_ind_type :: tl_ind_types in
401 params = LIST0 protected_binder_vars;
402 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
406 SYMBOL ":" -> false,0
407 | SYMBOL ":"; SYMBOL ">" -> true,0
408 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
411 let b,n = coercion in
413 ] SEP SYMBOL ";"; SYMBOL "}" ->
416 (fun (names, typ) acc ->
417 (List.map (fun name -> (name, typ)) names) @ acc)
420 (params,name,typ,fields)
424 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
425 let alpha = "[a-zA-Z]" in
426 let num = "[0-9]+" in
427 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
428 let decoration = "\\'" in
429 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
430 let rex = Str.regexp ("^"^ident^"$") in
431 if Str.string_match rex id 0 then
432 if (try ignore (NReference.reference_of_string uri); true
433 with NReference.IllFormedReference _ -> false)
435 G.Ident_alias (id, uri)
438 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
440 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
441 Printf.sprintf "Not a valid identifier: %s" id)))
442 | IDENT "symbol"; symbol = QSTRING;
443 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
444 SYMBOL "="; dsc = QSTRING ->
446 match instance with Some i -> i | None -> 0
448 G.Symbol_alias (symbol, instance, dsc)
450 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
451 SYMBOL "="; dsc = QSTRING ->
453 match instance with Some i -> i | None -> 0
455 G.Number_alias (instance, dsc)
459 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
461 N.IdentArg (List.length l, id)
465 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
466 | IDENT "right"; IDENT "associative" -> Gramext.RightA
467 | IDENT "non"; IDENT "associative" -> Gramext.NonA
471 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
474 [ dir = OPT direction; s = QSTRING;
475 assoc = OPT associativity; prec = precedence;
478 [ blob = UNPARSED_AST ->
479 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
480 (CicNotationParser.parse_level2_ast lstatus
481 (Ulexing.from_utf8_string blob))
482 | blob = UNPARSED_META ->
483 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
484 (CicNotationParser.parse_level2_meta lstatus
485 (Ulexing.from_utf8_string blob))
489 | None -> default_associativity
490 | Some assoc -> assoc
493 add_raw_attribute ~text:s
494 (CicNotationParser.parse_level1_pattern lstatus prec
495 (Ulexing.from_utf8_string s))
497 (dir, p1, assoc, prec, p2)
501 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
502 | IMPLICIT -> N.ImplicitPattern
503 | id = IDENT -> N.VarPattern id
504 | LPAREN; terms = LIST1 SELF; RPAREN ->
508 | terms -> N.ApplPattern terms)
512 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
518 IDENT "include" ; path = QSTRING ->
519 loc,path,G.WithPreferences
520 | IDENT "include'" ; path = QSTRING ->
521 loc,path,G.WithoutPreferences
524 grafite_ncommand: [ [
525 IDENT "qed" -> G.NQed loc
526 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
527 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
528 G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular))
529 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
531 G.NObj (loc, N.Theorem (nflavour, name, N.Implicit `JustOne, Some body,`Regular))
532 | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
533 G.NObj (loc, N.Theorem (`Axiom, name, typ, None, `Regular))
534 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
535 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
536 paramspec = OPT inverter_param_list ;
537 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
538 G.NInverter (loc,name,indty,paramspec,outsort)
539 | NLETCOREC ; defs = let_defs ->
540 nmk_rec_corec `CoInductive defs loc
541 | NLETREC ; defs = let_defs ->
542 nmk_rec_corec `Inductive defs loc
543 | IDENT "inductive"; spec = inductive_spec ->
544 let (params, ind_types) = spec in
545 G.NObj (loc, N.Inductive (params, ind_types))
546 | IDENT "coinductive"; spec = inductive_spec ->
547 let (params, ind_types) = spec in
548 let ind_types = (* set inductive flags to false (coinductive) *)
549 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
552 G.NObj (loc, N.Inductive (params, ind_types))
553 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
554 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
556 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
557 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
558 | _ -> raise (Failure "only a Type[…] sort can be constrained")
562 G.NUnivConstraint (loc,u1,u2)
563 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
564 G.UnificationHint (loc, t, n)
565 | IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term;
566 SYMBOL <:unicode<def>>; t = term; "on";
567 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
568 "to"; target = term ->
569 G.NCoercion(loc,name,t,ty,(id,source),target)
570 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
571 G.NObj (loc, N.Record (params,name,ty,fields))
572 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
573 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
574 G.NCopy (loc,s,NUri.uri_of_string u,
575 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
576 | lc = lexicon_command -> lc
580 IDENT "alias" ; spec = alias_spec ->
582 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
583 G.Notation (loc, dir, l1, assoc, prec, l2)
584 | IDENT "interpretation"; id = QSTRING;
585 (symbol, args, l3) = interpretation ->
586 G.Interpretation (loc, id, (symbol, args), l3)
589 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
590 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
591 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
592 G.NTactic (loc, [tac])
593 | tac = ntactic (*; punct = npunctuation_tactical*) ->
596 | tac = nnon_punctuation_tactical;
597 punct = npunctuation_tactical ->
598 G.NTactic (loc, [tac; punct])
603 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
610 [ ex = executable -> G.Executable (loc, ex)
611 | com = comment -> G.Comment (loc, com)
612 | (iloc,fname,mode) = include_command ; SYMBOL "." ->
613 G.Executable (loc,G.NCommand (loc,G.Include (iloc,mode,fname)))
614 | EOI -> raise End_of_file
622 type db = ast_statement Grammar.Entry.e ;;
624 class type g_status =
626 inherit CicNotationParser.g_status
632 inherit CicNotationParser.status ~keywords:[]
633 val mutable db = None
634 method parser_db = match db with None -> assert false | Some x -> x
635 method set_parser_db v = {< db = Some v >}
636 method set_parser_status
637 : 'status. #g_status as 'status -> 'self
638 = fun o -> {< db = Some o#parser_db >}#set_notation_parser_status o
640 let grammar = CicNotationParser.level2_ast_grammar self in
641 db <- Some (mk_parser (Grammar.Entry.create grammar "statement") self)
644 let extend status l1 action =
645 let status = CicNotationParser.extend status l1 action in
646 let grammar = CicNotationParser.level2_ast_grammar status in
648 (mk_parser (Grammar.Entry.create grammar "statement") status)
652 let parse_statement status =
653 parse_statement status#parser_db
655 (* vim:set foldmethod=marker: *)