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 'a localized_option =
35 type ast_statement = G.statement
37 let exc_located_wrapper f =
41 | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file
42 | Stdpp.Exc_located (floc, Stream.Error msg) ->
43 raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg))
44 | Stdpp.Exc_located (floc, HExtlib.Localized(_,exn)) ->
45 raise (HExtlib.Localized
46 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
47 | Stdpp.Exc_located (floc, exn) ->
48 raise (HExtlib.Localized
49 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
51 let parse_statement grafite_parser lexbuf =
53 (fun () -> (Grammar.Entry.parse (Obj.magic grafite_parser) (Obj.magic lexbuf)))
55 let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
57 let default_associativity = Gramext.NonA
59 let mk_rec_corec ind_kind defs loc =
62 | (params,(N.Ident (name, None), ty),_,_) :: _ ->
63 let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in
66 (fun var ty -> N.Binder (`Pi,var,ty)
72 let body = N.Ident (name,None) in
73 (loc, N.Theorem(`Definition, name, ty, Some (N.LetRec (ind_kind, defs, body)), `Regular))
75 let nmk_rec_corec ind_kind defs loc =
76 let loc,t = mk_rec_corec ind_kind defs loc in
80 let nnon_punct_of_punct = function
81 | G.Skip loc -> G.NSkip loc
82 | G.Unfocus loc -> G.NUnfocus loc
83 | G.Focus (loc,l) -> G.NFocus (loc,l)
86 type by_continuation =
88 | BYC_weproved of N.term * string option * N.term option
89 | BYC_letsuchthat of string * N.term * string * N.term
90 | BYC_wehaveand of string * N.term * string * N.term
92 let mk_parser statement lstatus =
93 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
94 let term = CicNotationParser.term lstatus in
95 let let_defs = CicNotationParser.let_defs lstatus in
96 let protected_binder_vars = CicNotationParser.protected_binder_vars lstatus in
97 (* {{{ parser initialization *)
99 GLOBAL: term statement;
100 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
101 tactic_term: [ [ t = term LEVEL "90" -> t ] ];
105 | id = IDENT -> Some id ]
108 ident_list1: [ [ LPAREN; idents = LIST1 IDENT; RPAREN -> idents ] ];
110 [ tactic_terms = LIST1 tactic_term SEP SYMBOL "," -> tactic_terms ]
113 [ IDENT "normalize" ; delta = OPT [ IDENT "nodelta" -> () ] ->
114 let delta = match delta with None -> true | _ -> false in
116 (*| IDENT "unfold"; t = OPT tactic_term -> `Unfold t*)
117 | IDENT "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
118 let delta = match delta with None -> true | _ -> false in
121 sequent_pattern_spec: [
125 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
126 (id,match path with Some p -> p | None -> N.UserInput) ];
127 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
129 match goal_path, hyp_paths with
130 None, [] -> Some N.UserInput
132 | Some goal_path, _ -> Some goal_path
141 [ "match" ; wanted = tactic_term ;
142 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
144 | sps = sequent_pattern_spec ->
147 let wanted,hyp_paths,goal_path =
148 match wanted_and_sps with
149 wanted,None -> wanted, [], Some N.UserInput
150 | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
152 wanted, hyp_paths, goal_path ] ->
154 None -> None,[],Some N.UserInput
157 inverter_param_list: [
158 [ params = tactic_term ->
159 let deannotate = function
160 | N.AttributedTerm (_,t) | t -> t
161 in match deannotate params with
162 | N.Implicit _ -> [false]
163 | N.UserInput -> [true]
165 List.map (fun x -> match deannotate x with
166 | N.Implicit _ -> false
167 | N.UserInput -> true
168 | _ -> raise (Invalid_argument "malformed target parameter list 1")) l
169 | _ -> raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term params)) ]
172 [ SYMBOL ">" -> `LeftToRight
173 | SYMBOL "<" -> `RightToLeft ]
175 int: [ [ num = NUMBER -> int_of_string num ] ];
178 [ OPT [ IDENT "names" ];
179 num = OPT [ num = int -> num ];
180 idents = intros_names ->
185 (* MATITA 1.0 using: [ [ using = OPT [ IDENT "using"; t = tactic_term -> t ] -> using ] ]; *)
187 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
188 | IDENT "apply"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
189 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
193 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
194 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
195 SYMBOL <:unicode<def>> ; bo = tactic_term ->
197 SYMBOL <:unicode<vdash>>;
198 concl = tactic_term -> (List.rev hyps,concl) ] ->
199 G.NTactic(loc,[G.NAssert (loc, seqs)])
200 (*| IDENT "auto"; params = auto_params ->
201 G.NTactic(loc,[G.NAuto (loc, params)])*)
202 | SYMBOL "/"; num = OPT NUMBER ;
203 just_and_params = auto_params; SYMBOL "/" ->
204 let just,params = just_and_params in
205 let depth = match num with Some n -> n | None -> "1" in
209 [G.NAuto(loc,(None,["depth",depth]@params))])
210 | Some (`Univ univ) ->
212 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
215 [G.NAuto(loc,(Some [],["depth",depth]@params))])
218 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
219 | IDENT "intros" -> G.NMacro (loc, G.NIntroGuess loc)
220 | IDENT "check"; t = term -> G.NMacro(loc,G.NCheck (loc,t))
221 | IDENT "screenshot"; fname = QSTRING ->
222 G.NMacro(loc,G.Screenshot (loc, fname))
223 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
224 G.NTactic(loc,[G.NCases (loc, what, where)])
225 | IDENT "change"; what = pattern_spec; "with"; with_what = tactic_term ->
226 G.NTactic(loc,[G.NChange (loc, what, with_what)])
227 | SYMBOL "@"; num = OPT NUMBER; l = LIST0 tactic_term ->
228 G.NTactic(loc,[G.NConstructor (loc, (match num with None -> None | Some x -> Some (int_of_string x)),l)])
229 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
230 (* | IDENT "discriminate"; t = tactic_term -> G.NDiscriminate (loc, t)
231 | IDENT "subst"; t = tactic_term -> G.NSubst (loc, t) *)
232 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
233 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
234 -> let exclude' = match exclude with None -> [] | Some l -> l in
235 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
236 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
237 G.NTactic(loc,[G.NElim (loc, what, where)])
238 | IDENT "generalize"; p=pattern_spec ->
239 G.NTactic(loc,[G.NGeneralize (loc, p)])
240 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
241 G.NTactic(loc,[G.NInversion (loc, what, where)])
242 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
243 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
244 where = pattern_spec ->
245 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
246 | kind = nreduction_kind; p = pattern_spec ->
247 G.NTactic(loc,[G.NReduce (loc, kind, p)])
248 | dir = direction; what = tactic_term ; where = pattern_spec ->
249 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
250 | IDENT "rewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
251 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
252 | IDENT "try"; tac = SELF ->
253 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
254 G.NTactic(loc,[ G.NTry (loc,tac)])
255 | IDENT "repeat"; tac = SELF ->
256 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
257 G.NTactic(loc,[ G.NRepeat (loc,tac)])
258 | LPAREN; l = LIST1 SELF; RPAREN ->
261 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
262 G.NTactic(loc,[G.NBlock (loc,l)])
263 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
264 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
265 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
266 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
267 | SYMBOL "*"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
272 | IDENT "fast_paramod"
286 i = auto_fixed_param -> i,""
287 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
288 string_of_int v | v = IDENT -> v ] -> i,v ];
289 just = OPT [ IDENT "by"; by =
290 [ univ = tactic_term_list1 -> `Univ univ
291 | SYMBOL "{"; SYMBOL "}" -> `EmptyUniv
292 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
298 [ 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)
299 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
300 "done" -> BYC_weproved (ty,None,t1)
302 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
303 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
304 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
305 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
306 BYC_wehaveand (id1,t1,id2,t2)
311 rewriting_step_continuation : [
320 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
323 | G.Seq (_, l) -> l @ [ t2 ]
329 [ tac = SELF; SYMBOL ";";
330 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
331 (G.Then (loc, tac, tacs))
334 [ IDENT "do"; count = int; tac = SELF ->
335 G.Do (loc, count, tac)
336 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
340 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
342 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
344 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
346 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
347 | LPAREN; tac = SELF; RPAREN -> tac
348 | tac = tactic -> tac
352 npunctuation_tactical:
354 [ SYMBOL "[" -> G.NBranch loc
355 | SYMBOL "|" -> G.NShift loc
356 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
357 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
358 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
359 | SYMBOL "]" -> G.NMerge loc
360 | SYMBOL ";" -> G.NSemicolon loc
361 | SYMBOL "." -> G.NDot loc
364 nnon_punctuation_tactical:
366 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
367 | IDENT "unfocus" -> G.NUnfocus loc
368 | IDENT "skip" -> G.NSkip loc
372 [ [ IDENT "definition" ] -> `Definition
373 | [ IDENT "fact" ] -> `Fact
374 | [ IDENT "lemma" ] -> `Lemma
375 | [ IDENT "example" ] -> `Example
376 | [ IDENT "theorem" ] -> `Theorem
377 | [ IDENT "corollary" ] -> `Corollary
382 params = LIST0 protected_binder_vars;
383 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
384 fst_constructors = LIST0 constructor SEP SYMBOL "|";
387 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
388 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
389 (name, true, typ, constructors) ] SEP "with" -> types
393 (fun (names, typ) acc ->
394 (List.map (fun name -> (name, typ)) names) @ acc)
397 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
398 let tl_ind_types = match tl with None -> [] | Some types -> types in
399 let ind_types = fst_ind_type :: tl_ind_types in
405 params = LIST0 protected_binder_vars;
406 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
410 SYMBOL ":" -> false,0
411 | SYMBOL ":"; SYMBOL ">" -> true,0
412 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
415 let b,n = coercion in
417 ] SEP SYMBOL ";"; SYMBOL "}" ->
420 (fun (names, typ) acc ->
421 (List.map (fun name -> (name, typ)) names) @ acc)
424 (params,name,typ,fields)
428 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
429 let alpha = "[a-zA-Z]" in
430 let num = "[0-9]+" in
431 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
432 let decoration = "\\'" in
433 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
434 let rex = Str.regexp ("^"^ident^"$") in
435 if Str.string_match rex id 0 then
436 if (try ignore (NReference.reference_of_string uri); true
437 with NReference.IllFormedReference _ -> false)
439 G.Ident_alias (id, uri)
442 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
444 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
445 Printf.sprintf "Not a valid identifier: %s" id)))
446 | IDENT "symbol"; symbol = QSTRING;
447 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
448 SYMBOL "="; dsc = QSTRING ->
450 match instance with Some i -> i | None -> 0
452 G.Symbol_alias (symbol, instance, dsc)
454 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
455 SYMBOL "="; dsc = QSTRING ->
457 match instance with Some i -> i | None -> 0
459 G.Number_alias (instance, dsc)
463 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
465 N.IdentArg (List.length l, id)
469 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
470 | IDENT "right"; IDENT "associative" -> Gramext.RightA
471 | IDENT "non"; IDENT "associative" -> Gramext.NonA
475 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
478 [ dir = OPT direction; s = QSTRING;
479 assoc = OPT associativity; prec = precedence;
482 [ blob = UNPARSED_AST ->
483 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
484 (CicNotationParser.parse_level2_ast lstatus
485 (Ulexing.from_utf8_string blob))
486 | blob = UNPARSED_META ->
487 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
488 (CicNotationParser.parse_level2_meta lstatus
489 (Ulexing.from_utf8_string blob))
493 | None -> default_associativity
494 | Some assoc -> assoc
497 add_raw_attribute ~text:s
498 (CicNotationParser.parse_level1_pattern lstatus prec
499 (Ulexing.from_utf8_string s))
501 (dir, p1, assoc, prec, p2)
505 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
506 | IMPLICIT -> N.ImplicitPattern
507 | id = IDENT -> N.VarPattern id
508 | LPAREN; terms = LIST1 SELF; RPAREN ->
512 | terms -> N.ApplPattern terms)
516 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
522 IDENT "include" ; path = QSTRING ->
523 loc,path,G.WithPreferences
524 | IDENT "include'" ; path = QSTRING ->
525 loc,path,G.WithoutPreferences
528 grafite_ncommand: [ [
529 IDENT "qed" -> G.NQed loc
530 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
531 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
532 G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular))
533 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
535 G.NObj (loc, N.Theorem (nflavour, name, N.Implicit `JustOne, Some body,`Regular))
536 | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
537 G.NObj (loc, N.Theorem (`Axiom, name, typ, None, `Regular))
538 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
539 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
540 paramspec = OPT inverter_param_list ;
541 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
542 G.NInverter (loc,name,indty,paramspec,outsort)
543 | NLETCOREC ; defs = let_defs ->
544 nmk_rec_corec `CoInductive defs loc
545 | NLETREC ; defs = let_defs ->
546 nmk_rec_corec `Inductive defs loc
547 | IDENT "inductive"; spec = inductive_spec ->
548 let (params, ind_types) = spec in
549 G.NObj (loc, N.Inductive (params, ind_types))
550 | IDENT "coinductive"; spec = inductive_spec ->
551 let (params, ind_types) = spec in
552 let ind_types = (* set inductive flags to false (coinductive) *)
553 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
556 G.NObj (loc, N.Inductive (params, ind_types))
557 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
558 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
560 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
561 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
562 | _ -> raise (Failure "only a Type[…] sort can be constrained")
566 G.NUnivConstraint (loc,u1,u2)
567 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
568 G.UnificationHint (loc, t, n)
569 | IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term;
570 SYMBOL <:unicode<def>>; t = term; "on";
571 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
572 "to"; target = term ->
573 G.NCoercion(loc,name,t,ty,(id,source),target)
574 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
575 G.NObj (loc, N.Record (params,name,ty,fields))
576 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
577 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
578 G.NCopy (loc,s,NUri.uri_of_string u,
579 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
580 | lc = lexicon_command -> lc
584 IDENT "alias" ; spec = alias_spec ->
586 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
587 G.Notation (loc, dir, l1, assoc, prec, l2)
588 | IDENT "interpretation"; id = QSTRING;
589 (symbol, args, l3) = interpretation ->
590 G.Interpretation (loc, id, (symbol, args), l3)
593 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
594 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
595 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
596 G.NTactic (loc, [tac])
597 | tac = ntactic (*; punct = npunctuation_tactical*) ->
600 | tac = nnon_punctuation_tactical;
601 punct = npunctuation_tactical ->
602 G.NTactic (loc, [tac; punct])
607 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
615 LSome (G.Executable (loc, ex))
617 LSome (G.Comment (loc, com))
618 | (iloc,fname,mode) = include_command ; SYMBOL "." ->
619 LSome (G.Executable (loc,G.NCommand (loc,G.Include (iloc,mode,fname))))
620 | EOI -> raise End_of_file
628 type db = ast_statement localized_option Grammar.Entry.e ;;
630 class type g_status =
632 inherit CicNotationParser.g_status
638 inherit CicNotationParser.status ~keywords:[]
639 val mutable db = None
640 method parser_db = match db with None -> assert false | Some x -> x
641 method set_parser_db v = {< db = Some v >}
642 method set_parser_status
643 : 'status. #g_status as 'status -> 'self
644 = fun o -> {< db = Some o#parser_db >}#set_notation_parser_status o
646 let grammar = CicNotationParser.level2_ast_grammar self in
647 db <- Some (mk_parser (Grammar.Entry.create grammar "statement") self)
650 let extend status l1 action =
651 let status = CicNotationParser.extend status l1 action in
652 let grammar = CicNotationParser.level2_ast_grammar status in
654 (mk_parser (Grammar.Entry.create grammar "statement") status)
658 let parse_statement status =
659 parse_statement status#parser_db
661 (* vim:set foldmethod=marker: *)