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 let exc_located_wrapper f =
35 | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file
36 | Stdpp.Exc_located (floc, Stream.Error msg) ->
37 raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg))
38 | Stdpp.Exc_located (floc, HExtlib.Localized(_,exn)) ->
39 raise (HExtlib.Localized
40 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
41 | Stdpp.Exc_located (floc, exn) ->
42 raise (HExtlib.Localized
43 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
45 type parsable = Grammar.parsable * Ulexing.lexbuf
47 let parsable_statement status buf =
48 let grammar = CicNotationParser.level2_ast_grammar status in
49 Grammar.parsable grammar (Obj.magic buf), buf
51 let parse_statement grafite_parser parsable =
53 (fun () -> (Grammar.Entry.parse_parsable (Obj.magic grafite_parser) (fst parsable)))
55 let strm_of_parsable (_,buf) = buf
57 let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
59 let default_associativity = Gramext.NonA
61 let mk_rec_corec ind_kind defs loc =
64 | (params,(N.Ident (name, None), ty),_,_) :: _ ->
65 let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in
68 (fun var ty -> N.Binder (`Pi,var,ty)
74 let body = N.Ident (name,None) in
75 (loc, N.Theorem(`Definition, name, ty, Some (N.LetRec (ind_kind, defs, body)), `Regular))
77 let nmk_rec_corec ind_kind defs loc =
78 let loc,t = mk_rec_corec ind_kind defs loc in
82 let nnon_punct_of_punct = function
83 | G.Skip loc -> G.NSkip loc
84 | G.Unfocus loc -> G.NUnfocus loc
85 | G.Focus (loc,l) -> G.NFocus (loc,l)
88 type by_continuation =
90 | BYC_weproved of N.term * string option * N.term option
91 | BYC_letsuchthat of string * N.term * string * N.term
92 | BYC_wehaveand of string * N.term * string * N.term
94 let mk_parser statement lstatus =
95 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
96 let term = CicNotationParser.term lstatus in
97 let let_defs = CicNotationParser.let_defs lstatus in
98 let protected_binder_vars = CicNotationParser.protected_binder_vars lstatus in
99 (* {{{ parser initialization *)
101 GLOBAL: term statement;
102 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
103 tactic_term: [ [ t = term LEVEL "90" -> t ] ];
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 "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
113 let delta = match delta with None -> true | _ -> false in
116 sequent_pattern_spec: [
120 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
121 (id,match path with Some p -> p | None -> N.UserInput) ];
122 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
124 match goal_path, hyp_paths with
125 None, [] -> Some N.UserInput
127 | Some goal_path, _ -> Some goal_path
136 [ "match" ; wanted = tactic_term ;
137 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
139 | 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
166 (*CSC: new NCicPp.status is the best I can do here without changing the
168 raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term (new NCicPp.status) params)) ]
171 [ SYMBOL ">" -> `LeftToRight
172 | SYMBOL "<" -> `RightToLeft ]
174 int: [ [ num = NUMBER -> int_of_string num ] ];
176 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
177 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
181 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
182 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
183 SYMBOL <:unicode<def>> ; bo = tactic_term ->
185 SYMBOL <:unicode<vdash>>;
186 concl = tactic_term -> (List.rev hyps,concl) ] ->
187 G.NTactic(loc,[G.NAssert (loc, seqs)])
188 | SYMBOL "/"; num = OPT NUMBER ;
189 just_and_params = auto_params; SYMBOL "/" ->
190 let just,params = just_and_params in
191 let depth = match num with Some n -> n | None -> "1" in
195 [G.NAuto(loc,(None,["depth",depth]@params))])
196 | Some (`Univ univ) ->
198 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
201 [G.NAuto(loc,(Some [],["depth",depth]@params))])
204 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
205 | SYMBOL "#"; SYMBOL "#" -> G.NMacro (loc, G.NIntroGuess loc)
206 | IDENT "check"; t = tactic_term -> G.NMacro(loc,G.NCheck (loc,t))
207 | IDENT "screenshot"; fname = QSTRING ->
208 G.NMacro(loc,G.Screenshot (loc, fname))
209 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
210 G.NTactic(loc,[G.NCases (loc, what, where)])
211 | IDENT "change"; what = pattern_spec; "with"; with_what = tactic_term ->
212 G.NTactic(loc,[G.NChange (loc, what, with_what)])
213 | SYMBOL "-"; id = IDENT ->
214 G.NTactic(loc,[G.NClear (loc, [id])])
215 | PLACEHOLDER; num = OPT NUMBER;
216 l = OPT [ SYMBOL "{"; l = LIST1 tactic_term; SYMBOL "}" -> l ] ->
217 G.NTactic(loc,[G.NConstructor (loc, (match num with None -> None | Some x -> Some (int_of_string x)),match l with None -> [] | Some l -> l)])
218 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
219 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
220 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
221 -> let exclude' = match exclude with None -> [] | Some l -> l in
222 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
223 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
224 G.NTactic(loc,[G.NElim (loc, what, where)])
225 | IDENT "generalize"; p=pattern_spec ->
226 G.NTactic(loc,[G.NGeneralize (loc, p)])
227 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
228 G.NTactic(loc,[G.NInversion (loc, what, where)])
229 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
230 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
231 where = pattern_spec ->
232 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
233 | kind = nreduction_kind; p = pattern_spec ->
234 G.NTactic(loc,[G.NReduce (loc, kind, p)])
235 | dir = direction; what = tactic_term ; where = pattern_spec ->
236 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
237 | IDENT "try"; tac = SELF ->
238 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
239 G.NTactic(loc,[ G.NTry (loc,tac)])
240 | IDENT "repeat"; tac = SELF ->
241 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
242 G.NTactic(loc,[ G.NRepeat (loc,tac)])
243 | LPAREN; l = LIST1 SELF; RPAREN ->
246 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
247 G.NTactic(loc,[G.NBlock (loc,l)])
248 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
249 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
250 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
251 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
252 | SYMBOL "*"; "as"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
257 | IDENT "fast_paramod"
271 i = auto_fixed_param -> i,""
272 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
273 string_of_int v | v = IDENT -> v ] -> i,v ];
274 just = OPT [ IDENT "by"; by =
275 [ univ = tactic_term_list1 -> `Univ univ
276 | SYMBOL "{"; SYMBOL "}" -> `EmptyUniv
277 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
283 [ 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)
284 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
285 "done" -> BYC_weproved (ty,None,t1)
287 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
288 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
289 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
290 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
291 BYC_wehaveand (id1,t1,id2,t2)
296 rewriting_step_continuation : [
305 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
308 | G.Seq (_, l) -> l @ [ t2 ]
314 [ tac = SELF; SYMBOL ";";
315 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
316 (G.Then (loc, tac, tacs))
319 [ IDENT "do"; count = int; tac = SELF ->
320 G.Do (loc, count, tac)
321 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
325 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
327 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
329 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
331 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
332 | LPAREN; tac = SELF; RPAREN -> tac
333 | tac = tactic -> tac
337 npunctuation_tactical:
339 [ SYMBOL "[" -> G.NBranch loc
340 | SYMBOL "|" -> G.NShift loc
341 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
342 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
343 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
344 | SYMBOL "]" -> G.NMerge loc
345 | SYMBOL ";" -> G.NSemicolon loc
346 | SYMBOL "." -> G.NDot loc
349 nnon_punctuation_tactical:
351 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
352 | IDENT "unfocus" -> G.NUnfocus loc
353 | IDENT "skip" -> G.NSkip loc
357 [ [ IDENT "definition" ] -> `Definition
358 | [ IDENT "fact" ] -> `Fact
359 | [ IDENT "lemma" ] -> `Lemma
360 | [ IDENT "example" ] -> `Example
361 | [ IDENT "theorem" ] -> `Theorem
362 | [ IDENT "corollary" ] -> `Corollary
367 params = LIST0 protected_binder_vars;
368 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
369 fst_constructors = LIST0 constructor SEP SYMBOL "|";
372 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
373 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
374 (name, true, typ, constructors) ] SEP "with" -> types
378 (fun (names, typ) acc ->
379 (List.map (fun name -> (name, typ)) names) @ acc)
382 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
383 let tl_ind_types = match tl with None -> [] | Some types -> types in
384 let ind_types = fst_ind_type :: tl_ind_types in
390 params = LIST0 protected_binder_vars;
391 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
395 SYMBOL ":" -> false,0
396 | SYMBOL ":"; SYMBOL ">" -> true,0
397 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
400 let b,n = coercion in
402 ] SEP SYMBOL ";"; SYMBOL "}" ->
405 (fun (names, typ) acc ->
406 (List.map (fun name -> (name, typ)) names) @ acc)
409 (params,name,typ,fields)
413 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
414 let alpha = "[a-zA-Z]" in
415 let num = "[0-9]+" in
416 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
417 let decoration = "\\'" in
418 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
419 let rex = Str.regexp ("^"^ident^"$") in
420 if Str.string_match rex id 0 then
421 if (try ignore (NReference.reference_of_string uri); true
422 with NReference.IllFormedReference _ -> false)
424 G.Ident_alias (id, uri)
427 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
429 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
430 Printf.sprintf "Not a valid identifier: %s" id)))
431 | IDENT "symbol"; symbol = QSTRING;
432 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
433 SYMBOL "="; dsc = QSTRING ->
435 match instance with Some i -> i | None -> 0
437 G.Symbol_alias (symbol, instance, dsc)
439 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
440 SYMBOL "="; dsc = QSTRING ->
442 match instance with Some i -> i | None -> 0
444 G.Number_alias (instance, dsc)
448 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
450 N.IdentArg (List.length l, id)
454 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
455 | IDENT "right"; IDENT "associative" -> Gramext.RightA
456 | IDENT "non"; IDENT "associative" -> Gramext.NonA
460 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
463 [ dir = OPT direction; s = QSTRING;
464 assoc = OPT associativity; prec = precedence;
467 [ blob = UNPARSED_AST ->
468 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
469 (CicNotationParser.parse_level2_ast lstatus
470 (Ulexing.from_utf8_string blob))
471 | blob = UNPARSED_META ->
472 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
473 (CicNotationParser.parse_level2_meta lstatus
474 (Ulexing.from_utf8_string blob))
478 | None -> default_associativity
479 | Some assoc -> assoc
482 add_raw_attribute ~text:s
483 (CicNotationParser.parse_level1_pattern lstatus prec
484 (Ulexing.from_utf8_string s))
486 (dir, p1, assoc, prec, p2)
490 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
491 | IMPLICIT -> N.ImplicitPattern
492 | id = IDENT -> N.VarPattern id
493 | LPAREN; terms = LIST1 SELF; RPAREN ->
497 | terms -> N.ApplPattern terms)
501 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
507 IDENT "include" ; path = QSTRING ->
508 loc,path,G.WithPreferences
509 | IDENT "include" ; IDENT "alias"; path = QSTRING ->
510 loc,path,G.OnlyPreferences
511 | IDENT "include'" ; path = QSTRING ->
512 loc,path,G.WithoutPreferences
515 grafite_ncommand: [ [
516 IDENT "qed" ; b = OPT SYMBOL "-" ->
517 let b = match b with None -> true | Some _ -> false in
519 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
520 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
521 G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular))
522 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
524 G.NObj (loc, N.Theorem (nflavour, name, N.Implicit `JustOne, Some body,`Regular))
525 | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
526 G.NObj (loc, N.Theorem (`Axiom, name, typ, None, `Regular))
527 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
528 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
529 paramspec = OPT inverter_param_list ;
530 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
531 G.NInverter (loc,name,indty,paramspec,outsort)
532 | LETCOREC ; defs = let_defs ->
533 nmk_rec_corec `CoInductive defs loc
534 | LETREC ; defs = let_defs ->
535 nmk_rec_corec `Inductive defs loc
536 | IDENT "inductive"; spec = inductive_spec ->
537 let (params, ind_types) = spec in
538 G.NObj (loc, N.Inductive (params, ind_types))
539 | IDENT "coinductive"; spec = inductive_spec ->
540 let (params, ind_types) = spec in
541 let ind_types = (* set inductive flags to false (coinductive) *)
542 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
545 G.NObj (loc, N.Inductive (params, ind_types))
546 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
547 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
549 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
550 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
551 | _ -> raise (Failure "only a Type[…] sort can be constrained")
555 G.NUnivConstraint (loc,u1,u2)
556 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
557 G.UnificationHint (loc, t, n)
558 | IDENT "coercion"; name = IDENT;
559 compose = OPT [ IDENT "nocomposites" -> () ];
560 SYMBOL ":"; ty = term;
561 SYMBOL <:unicode<def>>; t = term; "on";
562 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
563 "to"; target = term ->
564 let compose = compose = None in
565 G.NCoercion(loc,name,compose,t,ty,(id,source),target)
566 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
567 G.NObj (loc, N.Record (params,name,ty,fields))
568 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
569 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
570 G.NCopy (loc,s,NUri.uri_of_string u,
571 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
572 | lc = lexicon_command -> lc
576 IDENT "alias" ; spec = alias_spec ->
578 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
579 G.Notation (loc, dir, l1, assoc, prec, l2)
580 | IDENT "interpretation"; id = QSTRING;
581 (symbol, args, l3) = interpretation ->
582 G.Interpretation (loc, id, (symbol, args), l3)
585 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
586 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
587 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
588 G.NTactic (loc, [tac])
589 | tac = ntactic (*; punct = npunctuation_tactical*) ->
592 | tac = nnon_punctuation_tactical;
593 punct = npunctuation_tactical ->
594 G.NTactic (loc, [tac; punct])
599 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
606 [ ex = executable -> G.Executable (loc, ex)
607 | com = comment -> G.Comment (loc, com)
608 | (iloc,fname,mode) = include_command ; SYMBOL "." ->
609 G.Executable (loc,G.NCommand (loc,G.Include (iloc,mode,fname)))
610 | EOI -> raise End_of_file
618 type db = GrafiteAst.statement Grammar.Entry.e ;;
620 class type g_status =
622 inherit CicNotationParser.g_status
626 class virtual status =
628 inherit CicNotationParser.status ~keywords:[]
629 val mutable db = None (* mutable only to initialize it :-( *)
630 method parser_db = match db with None -> assert false | Some x -> x
631 method set_parser_db v = {< db = Some v >}
632 method set_parser_status
633 : 'status. #g_status as 'status -> 'self
634 = fun o -> {< db = Some o#parser_db >}#set_notation_parser_status o
636 let grammar = CicNotationParser.level2_ast_grammar self in
637 db <- Some (mk_parser (Grammar.Entry.create grammar "statement") self)
640 let extend status l1 action =
641 let status = CicNotationParser.extend status l1 action in
642 let grammar = CicNotationParser.level2_ast_grammar status in
644 (mk_parser (Grammar.Entry.create grammar "statement") status)
648 let parse_statement status =
649 parse_statement status#parser_db
651 (* vim:set foldmethod=marker: *)