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/
30 module LE = LexiconEngine
32 type 'a localized_option =
36 type ast_statement = G.statement
38 let exc_located_wrapper f =
42 | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file
43 | Stdpp.Exc_located (floc, Stream.Error msg) ->
44 raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg))
45 | Stdpp.Exc_located (floc, HExtlib.Localized(_,exn)) ->
46 raise (HExtlib.Localized
47 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
48 | Stdpp.Exc_located (floc, exn) ->
49 raise (HExtlib.Localized
50 (floc,CicNotationParser.Parse_error (Printexc.to_string exn)))
52 let parse_statement grafite_parser lexbuf =
54 (fun () -> (Grammar.Entry.parse (Obj.magic grafite_parser) (Obj.magic lexbuf)))
56 let add_raw_attribute ~text t = N.AttributedTerm (`Raw text, t)
58 let default_associativity = Gramext.NonA
60 let mk_rec_corec ind_kind defs loc =
63 | (params,(N.Ident (name, None), ty),_,_) :: _ ->
64 let ty = match ty with Some ty -> ty | None -> N.Implicit `JustOne in
67 (fun var ty -> N.Binder (`Pi,var,ty)
73 let body = N.Ident (name,None) in
74 (loc, N.Theorem(`Definition, name, ty, Some (N.LetRec (ind_kind, defs, body)), `Regular))
76 let nmk_rec_corec ind_kind defs loc =
77 let loc,t = mk_rec_corec ind_kind defs loc in
81 let nnon_punct_of_punct = function
82 | G.Skip loc -> G.NSkip loc
83 | G.Unfocus loc -> G.NUnfocus loc
84 | G.Focus (loc,l) -> G.NFocus (loc,l)
87 type by_continuation =
89 | BYC_weproved of N.term * string option * N.term option
90 | BYC_letsuchthat of string * N.term * string * N.term
91 | BYC_wehaveand of string * N.term * string * N.term
93 let mk_parser statement lstatus =
94 (* let grammar = CicNotationParser.level2_ast_grammar lstatus in *)
95 let term = CicNotationParser.term lstatus in
96 let let_defs = CicNotationParser.let_defs lstatus in
97 let protected_binder_vars = CicNotationParser.protected_binder_vars lstatus in
98 (* {{{ parser initialization *)
100 GLOBAL: term statement;
101 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
102 tactic_term: [ [ t = term LEVEL "90" -> t ] ];
106 | id = IDENT -> Some id ]
109 ident_list1: [ [ LPAREN; idents = LIST1 IDENT; RPAREN -> idents ] ];
111 [ tactic_terms = LIST1 tactic_term SEP SYMBOL "," -> tactic_terms ]
114 [ IDENT "normalize" ; delta = OPT [ IDENT "nodelta" -> () ] ->
115 let delta = match delta with None -> true | _ -> false in
117 (*| IDENT "unfold"; t = OPT tactic_term -> `Unfold t*)
118 | IDENT "whd" ; delta = OPT [ IDENT "nodelta" -> () ] ->
119 let delta = match delta with None -> true | _ -> false in
122 sequent_pattern_spec: [
126 path = OPT [SYMBOL ":" ; path = tactic_term -> path ] ->
127 (id,match path with Some p -> p | None -> N.UserInput) ];
128 goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = tactic_term -> term ] ->
130 match goal_path, hyp_paths with
131 None, [] -> Some N.UserInput
133 | Some goal_path, _ -> Some goal_path
142 [ "match" ; wanted = tactic_term ;
143 sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
145 | sps = sequent_pattern_spec ->
148 let wanted,hyp_paths,goal_path =
149 match wanted_and_sps with
150 wanted,None -> wanted, [], Some N.UserInput
151 | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
153 wanted, hyp_paths, goal_path ] ->
155 None -> None,[],Some N.UserInput
158 inverter_param_list: [
159 [ params = tactic_term ->
160 let deannotate = function
161 | N.AttributedTerm (_,t) | t -> t
162 in match deannotate params with
163 | N.Implicit _ -> [false]
164 | N.UserInput -> [true]
166 List.map (fun x -> match deannotate x with
167 | N.Implicit _ -> false
168 | N.UserInput -> true
169 | _ -> raise (Invalid_argument "malformed target parameter list 1")) l
170 | _ -> raise (Invalid_argument ("malformed target parameter list 2\n" ^ NotationPp.pp_term params)) ]
173 [ SYMBOL ">" -> `LeftToRight
174 | SYMBOL "<" -> `RightToLeft ]
176 int: [ [ num = NUMBER -> int_of_string num ] ];
179 [ OPT [ IDENT "names" ];
180 num = OPT [ num = int -> num ];
181 idents = intros_names ->
186 (* MATITA 1.0 using: [ [ using = OPT [ IDENT "using"; t = tactic_term -> t ] -> using ] ]; *)
188 [ SYMBOL "@"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
189 | IDENT "apply"; t = tactic_term -> G.NTactic(loc,[G.NApply (loc, t)])
190 | IDENT "applyS"; t = tactic_term -> G.NTactic(loc,[G.NSmartApply(loc, t)])
194 [ id = IDENT ; SYMBOL ":" ; ty = tactic_term -> id,`Decl ty
195 | id = IDENT ; SYMBOL ":" ; ty = tactic_term ;
196 SYMBOL <:unicode<def>> ; bo = tactic_term ->
198 SYMBOL <:unicode<vdash>>;
199 concl = tactic_term -> (List.rev hyps,concl) ] ->
200 G.NTactic(loc,[G.NAssert (loc, seqs)])
201 (*| IDENT "auto"; params = auto_params ->
202 G.NTactic(loc,[G.NAuto (loc, params)])*)
203 | SYMBOL "/"; num = OPT NUMBER ;
204 just_and_params = auto_params; SYMBOL "/" ->
205 let just,params = just_and_params in
206 let depth = match num with Some n -> n | None -> "1" in
210 [G.NAuto(loc,(None,["depth",depth]@params))])
211 | Some (`Univ univ) ->
213 [G.NAuto(loc,(Some univ,["depth",depth]@params))])
216 [G.NAuto(loc,(Some [],["depth",depth]@params))])
219 G.NAutoInteractive (loc, (None,["depth",depth]@params))))
220 | IDENT "intros" -> G.NMacro (loc, G.NIntroGuess loc)
221 | IDENT "check"; t = term -> G.NMacro(loc,G.NCheck (loc,t))
222 | IDENT "screenshot"; fname = QSTRING ->
223 G.NMacro(loc,G.Screenshot (loc, fname))
224 | IDENT "cases"; what = tactic_term ; where = pattern_spec ->
225 G.NTactic(loc,[G.NCases (loc, what, where)])
226 | IDENT "change"; what = pattern_spec; "with"; with_what = tactic_term ->
227 G.NTactic(loc,[G.NChange (loc, what, with_what)])
228 | SYMBOL "@"; num = OPT NUMBER; l = LIST0 tactic_term ->
229 G.NTactic(loc,[G.NConstructor (loc, (match num with None -> None | Some x -> Some (int_of_string x)),l)])
230 | IDENT "cut"; t = tactic_term -> G.NTactic(loc,[G.NCut (loc, t)])
231 (* | IDENT "discriminate"; t = tactic_term -> G.NDiscriminate (loc, t)
232 | IDENT "subst"; t = tactic_term -> G.NSubst (loc, t) *)
233 | IDENT "destruct"; just = OPT [ dom = ident_list1 -> dom ];
234 exclude = OPT [ IDENT "skip"; skip = ident_list1 -> skip ]
235 -> let exclude' = match exclude with None -> [] | Some l -> l in
236 G.NTactic(loc,[G.NDestruct (loc,just,exclude')])
237 | IDENT "elim"; what = tactic_term ; where = pattern_spec ->
238 G.NTactic(loc,[G.NElim (loc, what, where)])
239 | IDENT "generalize"; p=pattern_spec ->
240 G.NTactic(loc,[G.NGeneralize (loc, p)])
241 | IDENT "inversion"; what = tactic_term ; where = pattern_spec ->
242 G.NTactic(loc,[G.NInversion (loc, what, where)])
243 | IDENT "lapply"; t = tactic_term -> G.NTactic(loc,[G.NLApply (loc, t)])
244 | IDENT "letin"; name = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term;
245 where = pattern_spec ->
246 G.NTactic(loc,[G.NLetIn (loc,where,t,name)])
247 | kind = nreduction_kind; p = pattern_spec ->
248 G.NTactic(loc,[G.NReduce (loc, kind, p)])
249 | dir = direction; what = tactic_term ; where = pattern_spec ->
250 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
251 | IDENT "rewrite"; dir = direction; what = tactic_term ; where = pattern_spec ->
252 G.NTactic(loc,[G.NRewrite (loc, dir, what, where)])
253 | IDENT "try"; tac = SELF ->
254 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
255 G.NTactic(loc,[ G.NTry (loc,tac)])
256 | IDENT "repeat"; tac = SELF ->
257 let tac = match tac with G.NTactic(_,[t]) -> t | _ -> assert false in
258 G.NTactic(loc,[ G.NRepeat (loc,tac)])
259 | LPAREN; l = LIST1 SELF; RPAREN ->
262 (List.map (function G.NTactic(_,t) -> t | _ -> assert false) l) in
263 G.NTactic(loc,[G.NBlock (loc,l)])
264 | IDENT "assumption" -> G.NTactic(loc,[ G.NAssumption loc])
265 | SYMBOL "#"; ns=IDENT -> G.NTactic(loc,[ G.NIntros (loc,[ns])])
266 | SYMBOL "#"; SYMBOL "_" -> G.NTactic(loc,[ G.NIntro (loc,"_")])
267 | SYMBOL "*" -> G.NTactic(loc,[ G.NCase1 (loc,"_")])
268 | SYMBOL "*"; n=IDENT -> G.NTactic(loc,[ G.NCase1 (loc,n)])
273 | IDENT "fast_paramod"
287 i = auto_fixed_param -> i,""
288 | i = auto_fixed_param ; SYMBOL "="; v = [ v = int ->
289 string_of_int v | v = IDENT -> v ] -> i,v ];
290 just = OPT [ IDENT "by"; by =
291 [ univ = tactic_term_list1 -> `Univ univ
292 | SYMBOL "{"; SYMBOL "}" -> `EmptyUniv
293 | SYMBOL "_" -> `Trace ] -> by ] -> just,params
299 [ 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)
300 | WEPROVED; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ;
301 "done" -> BYC_weproved (ty,None,t1)
303 | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ;
304 IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ;
305 id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2)
306 | WEHAVE; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN ->
307 BYC_wehaveand (id1,t1,id2,t2)
312 rewriting_step_continuation : [
321 [ t1 = SELF; SYMBOL ";"; t2 = SELF ->
324 | G.Seq (_, l) -> l @ [ t2 ]
330 [ tac = SELF; SYMBOL ";";
331 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
332 (G.Then (loc, tac, tacs))
335 [ IDENT "do"; count = int; tac = SELF ->
336 G.Do (loc, count, tac)
337 | IDENT "repeat"; tac = SELF -> G.Repeat (loc, tac)
341 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
343 | IDENT "try"; tac = SELF -> G.Try (loc, tac)
345 SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"->
347 | IDENT "progress"; tac = SELF -> G.Progress (loc, tac)
348 | LPAREN; tac = SELF; RPAREN -> tac
349 | tac = tactic -> tac
353 npunctuation_tactical:
355 [ SYMBOL "[" -> G.NBranch loc
356 | SYMBOL "|" -> G.NShift loc
357 | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> G.NPos (loc, i)
358 | SYMBOL "*"; SYMBOL ":" -> G.NWildcard loc
359 | name = IDENT; SYMBOL ":" -> G.NPosbyname (loc, name)
360 | SYMBOL "]" -> G.NMerge loc
361 | SYMBOL ";" -> G.NSemicolon loc
362 | SYMBOL "." -> G.NDot loc
365 nnon_punctuation_tactical:
367 [ IDENT "focus"; goals = LIST1 int -> G.NFocus (loc, goals)
368 | IDENT "unfocus" -> G.NUnfocus loc
369 | IDENT "skip" -> G.NSkip loc
373 [ [ IDENT "definition" ] -> `Definition
374 | [ IDENT "fact" ] -> `Fact
375 | [ IDENT "lemma" ] -> `Lemma
376 | [ IDENT "example" ] -> `Example
377 | [ IDENT "theorem" ] -> `Theorem
378 | [ IDENT "corollary" ] -> `Corollary
383 params = LIST0 protected_binder_vars;
384 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
385 fst_constructors = LIST0 constructor SEP SYMBOL "|";
388 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
389 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
390 (name, true, typ, constructors) ] SEP "with" -> types
394 (fun (names, typ) acc ->
395 (List.map (fun name -> (name, typ)) names) @ acc)
398 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
399 let tl_ind_types = match tl with None -> [] | Some types -> types in
400 let ind_types = fst_ind_type :: tl_ind_types in
406 params = LIST0 protected_binder_vars;
407 SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ;
411 SYMBOL ":" -> false,0
412 | SYMBOL ":"; SYMBOL ">" -> true,0
413 | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity
416 let b,n = coercion in
418 ] SEP SYMBOL ";"; SYMBOL "}" ->
421 (fun (names, typ) acc ->
422 (List.map (fun name -> (name, typ)) names) @ acc)
425 (params,name,typ,fields)
429 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
430 let alpha = "[a-zA-Z]" in
431 let num = "[0-9]+" in
432 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
433 let decoration = "\\'" in
434 let ident = "\\("^alpha^ident_cont^"*"^decoration^"*\\|_"^ident_cont^"+"^decoration^"*\\)" in
435 let rex = Str.regexp ("^"^ident^"$") in
436 if Str.string_match rex id 0 then
437 if (try ignore (NReference.reference_of_string uri); true
438 with NReference.IllFormedReference _ -> false)
440 G.Ident_alias (id, uri)
443 (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri)))
445 raise (HExtlib.Localized (loc, CicNotationParser.Parse_error (
446 Printf.sprintf "Not a valid identifier: %s" id)))
447 | IDENT "symbol"; symbol = QSTRING;
448 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
449 SYMBOL "="; dsc = QSTRING ->
451 match instance with Some i -> i | None -> 0
453 G.Symbol_alias (symbol, instance, dsc)
455 instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
456 SYMBOL "="; dsc = QSTRING ->
458 match instance with Some i -> i | None -> 0
460 G.Number_alias (instance, dsc)
464 [ l = LIST0 [ SYMBOL <:unicode<eta>> (* η *); SYMBOL "." -> () ];
466 N.IdentArg (List.length l, id)
470 [ IDENT "left"; IDENT "associative" -> Gramext.LeftA
471 | IDENT "right"; IDENT "associative" -> Gramext.RightA
472 | IDENT "non"; IDENT "associative" -> Gramext.NonA
476 [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
479 [ dir = OPT direction; s = QSTRING;
480 assoc = OPT associativity; prec = precedence;
483 [ blob = UNPARSED_AST ->
484 add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob)
485 (CicNotationParser.parse_level2_ast lstatus
486 (Ulexing.from_utf8_string blob))
487 | blob = UNPARSED_META ->
488 add_raw_attribute ~text:(Printf.sprintf "${%s}" blob)
489 (CicNotationParser.parse_level2_meta lstatus
490 (Ulexing.from_utf8_string blob))
494 | None -> default_associativity
495 | Some assoc -> assoc
498 add_raw_attribute ~text:s
499 (CicNotationParser.parse_level1_pattern lstatus prec
500 (Ulexing.from_utf8_string s))
502 (dir, p1, assoc, prec, p2)
506 [ r = NREF -> N.NRefPattern (NReference.reference_of_string r)
507 | IMPLICIT -> N.ImplicitPattern
508 | id = IDENT -> N.VarPattern id
509 | LPAREN; terms = LIST1 SELF; RPAREN ->
513 | terms -> N.ApplPattern terms)
517 [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
523 IDENT "include" ; path = QSTRING ->
524 loc,path,G.WithPreferences
525 | IDENT "include'" ; path = QSTRING ->
526 loc,path,G.WithoutPreferences
529 grafite_ncommand: [ [
530 IDENT "qed" -> G.NQed loc
531 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
532 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
533 G.NObj (loc, N.Theorem (nflavour, name, typ, body,`Regular))
534 | nflavour = ntheorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
536 G.NObj (loc, N.Theorem (nflavour, name, N.Implicit `JustOne, Some body,`Regular))
537 | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term ->
538 G.NObj (loc, N.Theorem (`Axiom, name, typ, None, `Regular))
539 | IDENT "discriminator" ; indty = tactic_term -> G.NDiscriminator (loc,indty)
540 | IDENT "inverter"; name = IDENT; IDENT "for" ; indty = tactic_term ;
541 paramspec = OPT inverter_param_list ;
542 outsort = OPT [ SYMBOL ":" ; outsort = term -> outsort ] ->
543 G.NInverter (loc,name,indty,paramspec,outsort)
544 | NLETCOREC ; defs = let_defs ->
545 nmk_rec_corec `CoInductive defs loc
546 | NLETREC ; defs = let_defs ->
547 nmk_rec_corec `Inductive defs loc
548 | IDENT "inductive"; spec = inductive_spec ->
549 let (params, ind_types) = spec in
550 G.NObj (loc, N.Inductive (params, ind_types))
551 | IDENT "coinductive"; spec = inductive_spec ->
552 let (params, ind_types) = spec in
553 let ind_types = (* set inductive flags to false (coinductive) *)
554 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
557 G.NObj (loc, N.Inductive (params, ind_types))
558 | IDENT "universe"; IDENT "constraint"; u1 = tactic_term;
559 SYMBOL <:unicode<lt>> ; u2 = tactic_term ->
561 | NotationPt.AttributedTerm (_, NotationPt.Sort (`NType i)) ->
562 NUri.uri_of_string ("cic:/matita/pts/Type"^i^".univ")
563 | _ -> raise (Failure "only a Type[…] sort can be constrained")
567 G.NUnivConstraint (loc,u1,u2)
568 | IDENT "unification"; IDENT "hint"; n = int; t = tactic_term ->
569 G.UnificationHint (loc, t, n)
570 | IDENT "coercion"; name = IDENT; SYMBOL ":"; ty = term;
571 SYMBOL <:unicode<def>>; t = term; "on";
572 id = [ IDENT | PIDENT ]; SYMBOL ":"; source = term;
573 "to"; target = term ->
574 G.NCoercion(loc,name,t,ty,(id,source),target)
575 | IDENT "record" ; (params,name,ty,fields) = record_spec ->
576 G.NObj (loc, N.Record (params,name,ty,fields))
577 | IDENT "copy" ; s = IDENT; IDENT "from"; u = URI; "with";
578 m = LIST0 [ u1 = URI; SYMBOL <:unicode<mapsto>>; u2 = URI -> u1,u2 ] ->
579 G.NCopy (loc,s,NUri.uri_of_string u,
580 List.map (fun a,b -> NUri.uri_of_string a, NUri.uri_of_string b) m)
581 | lc = lexicon_command -> lc
585 IDENT "alias" ; spec = alias_spec ->
587 | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
588 G.Notation (loc, dir, l1, assoc, prec, l2)
589 | IDENT "interpretation"; id = QSTRING;
590 (symbol, args, l3) = interpretation ->
591 G.Interpretation (loc, id, (symbol, args), l3)
594 [ ncmd = grafite_ncommand; SYMBOL "." -> G.NCommand (loc, ncmd)
595 | punct = npunctuation_tactical -> G.NTactic (loc, [punct])
596 | tac = nnon_punctuation_tactical(*; punct = npunctuation_tactical*) ->
597 G.NTactic (loc, [tac])
598 | tac = ntactic (*; punct = npunctuation_tactical*) ->
601 | tac = nnon_punctuation_tactical;
602 punct = npunctuation_tactical ->
603 G.NTactic (loc, [tac; punct])
608 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
616 LSome (G.Executable (loc, ex))
618 LSome (G.Comment (loc, com))
619 | (iloc,fname,mode) = include_command ; SYMBOL "." ->
620 LSome (G.Executable (loc,G.NCommand (loc,G.Include (iloc,mode,fname))))
621 | EOI -> raise End_of_file
629 type db = ast_statement localized_option Grammar.Entry.e ;;
631 class type g_status =
633 inherit LexiconTypes.g_status
639 inherit LexiconTypes.status as super
640 val mutable db = None
641 method parser_db = match db with None -> assert false | Some x -> x
642 method set_parser_db v = {< db = Some v >}
643 method set_parser_status
644 : 'status. #g_status as 'status -> 'self
645 = fun o -> {< db = Some o#parser_db >}#set_lexicon_engine_status o
647 let grammar = CicNotationParser.level2_ast_grammar self in
648 db <- Some (mk_parser (Grammar.Entry.create grammar "statement") self)
651 let extend status l1 action =
652 let status = CicNotationParser.extend status l1 action in
653 let grammar = CicNotationParser.level2_ast_grammar status in
655 (mk_parser (Grammar.Entry.create grammar "statement") status)
659 let parse_statement status =
660 parse_statement status#parser_db
662 (* vim:set foldmethod=marker: *)