1 (* Copyright (C) 2004, 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/
29 prerr_endline "<NEW_TEXTUAL_PARSER>";
31 prerr_endline "</NEW_TEXTUAL_PARSER>"
34 (** if set to true each number will have a different insance number and can
35 * thus be interpreted differently than others *)
36 let use_fresh_num_instances = false
38 (** does the lexer return COMMENT tokens? *)
39 let return_comments = false
43 open DisambiguateTypes
45 exception Parse_error of Token.flocation * string
47 let cic_lexer = CicTextualLexer2.cic_lexer ~comments:return_comments ()
49 let fresh_num_instance =
51 if use_fresh_num_instances then
52 (fun () -> incr n; !n)
56 let choice_of_uri uri =
57 let term = CicUtil.term_of_uri uri in
58 (uri, (fun _ _ _ -> term))
60 let grammar = Grammar.gcreate cic_lexer
62 let term = Grammar.Entry.create grammar "term"
63 let term0 = Grammar.Entry.create grammar "term0"
64 let tactic = Grammar.Entry.create grammar "tactic"
65 let tactical = Grammar.Entry.create grammar "tactical"
66 let tactical0 = Grammar.Entry.create grammar "tactical0"
67 let command = Grammar.Entry.create grammar "command"
68 let alias_spec = Grammar.Entry.create grammar "alias_spec"
69 let macro = Grammar.Entry.create grammar "macro"
70 let script = Grammar.Entry.create grammar "script"
71 let statement = Grammar.Entry.create grammar "statement"
72 let statements = Grammar.Entry.create grammar "statements"
74 let return_term loc term = CicAst.AttributedTerm (`Loc loc, term)
77 let (x, y) = CicAst.loc_of_floc floc in
78 failwith (Printf.sprintf "Error at characters %d - %d: %s" x y msg)
80 let name_of_string = function
81 | "_" -> Cic.Anonymous
84 let string_of_name = function
85 | Cic.Anonymous -> "_"
88 let int_opt = function
90 | Some lexeme -> Some (int_of_string lexeme)
94 Pervasives.int_of_string s
96 failwith (sprintf "Lexer failure: string_of_int \"%s\" failed" s)
98 (** the uri of an inductive type (a ".ind" uri) is not meaningful without an
99 * xpointer. Still, it's likely that an user who wrote "cic:/blabla/foo.ind"
100 * actually meant "cic:/blabla/foo.ind#xpointer(1/1)", i.e. the first inductive
101 * type in a block of mutual inductive types.
103 * This function performs the expansion foo.ind -> foo#xpointer..., if needed
105 let ind_expansion uri =
106 let len = String.length uri in
107 if len >= 4 && String.sub uri (len - 4) 4 = ".ind" then
108 uri ^ "#xpointer(1/1)"
112 let mk_binder_ast binder typ vars body =
115 let name = name_of_string var in
116 CicAst.Binder (binder, (name, typ), body))
120 GLOBAL: term term0 statement statements;
125 with Failure _ -> raise (Parse_error (loc, "integer literal expected"))
129 [ s = SYMBOL "_" -> None
130 | t = term -> Some t ]
133 [ SYMBOL <:unicode<Pi>> (* Π *) -> `Pi
134 | SYMBOL <:unicode<exists>> (* ∃ *) -> `Exists
135 | SYMBOL <:unicode<forall>> (* ∀ *) -> `Forall ]
137 binder_high: [ [ SYMBOL <:unicode<lambda>> (* λ *) -> `Lambda ] ];
142 | "CProp" -> `CProp ]
145 [ PAREN "("; i = IDENT; SYMBOL ":"; typ = term; PAREN ")" ->
146 (Cic.Name i, Some typ)
147 | i = IDENT -> (Cic.Name i, None)
151 [ SYMBOL "\\subst"; (* to avoid catching frequent "a [1]" cases *)
154 i = IDENT; SYMBOL <:unicode<Assign>> (* ≔ *); t = term -> (i, t)
160 substituted_name: [ (* a subs.name is an explicit substitution subject *)
161 [ s = IDENT; subst = OPT subst -> CicAst.Ident (s, subst)
162 | s = URI; subst = OPT subst -> CicAst.Uri (ind_expansion s, subst)
165 name: [ (* as substituted_name with no explicit substitution *)
166 [ s = [ IDENT | SYMBOL ] -> s ]
169 [ n = name -> (n, [])
170 | PAREN "("; head = name; vars = LIST1 typed_name; PAREN ")" ->
178 PAREN "(" ; names = LIST1 IDENT SEP SYMBOL ",";
179 ty = OPT [ SYMBOL ":"; ty = term -> ty ] ; PAREN ")" ->
182 index_name = OPT [ IDENT "on"; idx = IDENT -> idx ];
183 ty = OPT [ SYMBOL ":" ; t = term -> t ];
184 SYMBOL <:unicode<def>> (* ≝ *);
186 let rec list_of_binder binder ty final_term = function
189 CicAst.Binder (binder, (Cic.Name name, Some ty),
190 list_of_binder binder ty final_term tl)
192 let rec binder_of_arg_list binder final_term = function
195 list_of_binder binder ty
196 (binder_of_arg_list binder final_term tl) l
201 names,Some ty -> names,ty
202 | names,None -> names,CicAst.Implicit
204 let t1' = binder_of_arg_list `Lambda t1 args in
208 | Some ty -> Some (binder_of_arg_list `Pi ty args)
210 let rec get_position_of name n = function
216 (get_position_of name (n+1) tl)
218 let rec find_arg name n = function
219 | [] -> (fail loc (sprintf "Argument %s not found" name))
221 let (got,len) = get_position_of name 0 l in
223 | None -> (find_arg name (n+len) tl)
224 | Some where -> n + where)
227 (match index_name with
229 | (Some name) -> find_arg name 0 args)
231 ((Cic.Name name,ty'), t1', index)
234 constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
236 [ vars = LIST1 IDENT SEP SYMBOL ",";
237 typ = OPT [ SYMBOL ":"; t = term -> t ] -> (vars, typ)
238 | PAREN "("; vars = LIST1 IDENT SEP SYMBOL ",";
239 typ = OPT [ SYMBOL ":"; t = term -> t ]; PAREN ")" -> (vars, typ)
242 term0: [ [ t = term; EOI -> return_term loc t ] ];
245 [ "let"; var = typed_name;
246 SYMBOL <:unicode<def>> (* ≝ *);
247 t1 = term; "in"; t2 = term ->
248 return_term loc (CicAst.LetIn (var, t1, t2))
249 | "let"; ind_kind = [ "corec" -> `CoInductive | "rec"-> `Inductive ];
250 defs = let_defs; "in"; body = term ->
251 return_term loc (CicAst.LetRec (ind_kind, defs, body))
255 b = binder_low; (vars, typ) = binder_vars; SYMBOL "."; body = term ->
256 let binder = mk_binder_ast b typ vars body in
257 return_term loc binder
258 | b = binder_high; (vars, typ) = binder_vars; SYMBOL "."; body = term ->
259 let binder = mk_binder_ast b typ vars body in
260 return_term loc binder
261 | t1 = term; SYMBOL <:unicode<to>> (* → *); t2 = term ->
262 return_term loc (CicAst.Binder (`Pi, (Cic.Anonymous, Some t1), t2))
264 | "logic_add" LEFTA [ (* nothing here by default *) ]
265 | "logic_mult" LEFTA [ (* nothing here by default *) ]
266 | "logic_inv" NONA [ (* nothing here by default *) ]
268 [ t1 = term; SYMBOL "="; t2 = term ->
269 return_term loc (CicAst.Appl [CicAst.Symbol ("eq", 0); t1; t2])
271 | "add" LEFTA [ (* nothing here by default *) ]
272 | "mult" LEFTA [ (* nothing here by default *) ]
273 | "power" LEFTA [ (* nothing here by default *) ]
274 | "inv" NONA [ (* nothing here by default *) ]
276 [ t1 = term; t2 = term ->
277 let rec aux = function
278 | CicAst.Appl (hd :: tl) -> aux hd @ tl
281 CicAst.Appl (aux t1 @ [t2])
284 [ sort = sort -> CicAst.Sort sort
285 | n = substituted_name -> return_term loc n
286 | i = NUM -> return_term loc (CicAst.Num (i, (fresh_num_instance ())))
287 | IMPLICIT -> return_term loc CicAst.Implicit
288 | PLACEHOLDER -> return_term loc CicAst.UserInput
291 PAREN "["; substs = LIST0 meta_subst SEP SYMBOL ";" ; PAREN "]" ->
296 int_of_string (String.sub m 1 (String.length m - 1))
297 with Failure "int_of_string" ->
298 fail loc ("Invalid meta variable number: " ^ m)
300 return_term loc (CicAst.Meta (index, substs))
301 | outtyp = OPT [ PAREN "["; typ = term; PAREN "]" -> typ ];
303 indty_ident = OPT ["in" ; id = IDENT -> id ];
307 lhs = pattern; SYMBOL <:unicode<Rightarrow>> (* ⇒ *); rhs = term
309 ((lhs: CicAst.case_pattern), rhs)
313 (CicAst.Case (t, indty_ident, outtyp, patterns))
314 | PAREN "("; t1 = term; SYMBOL ":"; t2 = term; PAREN ")" ->
315 return_term loc (CicAst.Appl [CicAst.Symbol ("cast", 0); t1; t2])
316 | PAREN "("; t = term; PAREN ")" -> return_term loc t
320 [ where = OPT [ "in"; ident = IDENT -> ident ] -> where ]
322 tactic_term: [ [ t = term -> t ] ];
324 [ PAREN "["; idents = LIST0 IDENT SEP SYMBOL ";"; PAREN "]" -> idents ]
327 [ PAREN "["; idents = LIST1 IDENT SEP SYMBOL ";"; PAREN "]" -> idents ]
330 [ [ IDENT "reduce" ] -> `Reduce
331 | [ IDENT "simplify" ] -> `Simpl
332 | [ IDENT "whd" ] -> `Whd
333 | [ IDENT "normalize" ] -> `Normalize ]
336 [ [ IDENT "absurd" ]; t = tactic_term ->
337 TacticAst.Absurd (loc, t)
338 | [ IDENT "apply" ]; t = tactic_term ->
339 TacticAst.Apply (loc, t)
340 | [ IDENT "assumption" ] ->
341 TacticAst.Assumption loc
342 | [ IDENT "auto" ] ; num = OPT [ i = NUM -> int_of_string i ] ->
343 TacticAst.Auto (loc,num)
344 | [ IDENT "change" ];
345 t1 = tactic_term; "with"; t2 = tactic_term;
346 where = tactic_where ->
347 TacticAst.Change (loc, t1, t2, where)
348 (* TODO Change_pattern *)
349 | [ IDENT "contradiction" ] ->
350 TacticAst.Contradiction loc
353 TacticAst.Cut (loc, t)
354 | [ IDENT "decompose" ];
355 principles = ident_list1; where = IDENT ->
356 TacticAst.Decompose (loc, where, principles)
357 | [ IDENT "discriminate" ];
359 TacticAst.Discriminate (loc, hyp)
360 | [ IDENT "elimType" ]; t = tactic_term ->
361 TacticAst.ElimType (loc, t)
364 using = OPT [ "using"; using = tactic_term -> using ] ->
365 TacticAst.Elim (loc, t1, using)
366 | [ IDENT "exact" ]; t = tactic_term ->
367 TacticAst.Exact (loc, t)
368 | [ IDENT "exists" ] ->
371 kind = reduction_kind; t = tactic_term ->
372 TacticAst.Fold (loc, kind, t)
373 | [ IDENT "fourier" ] ->
374 TacticAst.Fourier loc
375 | IDENT "goal"; n = NUM -> TacticAst.Goal (loc, int_of_string n)
376 | [ IDENT "injection" ]; ident = IDENT ->
377 TacticAst.Injection (loc, ident)
378 | [ IDENT "intros" ];
379 num = OPT [ num = int -> num ];
380 idents = OPT ident_list0 ->
381 let idents = match idents with None -> [] | Some idents -> idents in
382 TacticAst.Intros (loc, num, idents)
383 | [ IDENT "intro" ] ->
384 TacticAst.Intros (loc, Some 1, [])
385 | [ IDENT "left" ] -> TacticAst.Left loc
387 where = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term ->
388 TacticAst.LetIn (loc, t, where)
389 | kind = reduction_kind;
391 "in"; pat = [ IDENT "goal" -> `Goal | IDENT "hyp" -> `Everywhere ] ->
394 terms = LIST0 term SEP SYMBOL "," ->
395 (match (pat, terms) with
396 | None, [] -> TacticAst.Reduce (loc, kind, None)
397 | None, terms -> TacticAst.Reduce (loc, kind, Some (terms, `Goal))
398 | Some pat, [] -> fail loc "Missing term [list]"
399 | Some pat, terms -> TacticAst.Reduce (loc, kind, Some (terms, pat)))
400 | kind = reduction_kind; where = IDENT ; IDENT "at" ; pat = term ->
401 TacticAst.ReduceAt (loc, kind, where, pat)
402 | [ IDENT "reflexivity" ] ->
403 TacticAst.Reflexivity loc
404 | [ IDENT "replace" ];
405 t1 = tactic_term; "with"; t2 = tactic_term ->
406 TacticAst.Replace (loc, t1, t2)
407 | [ IDENT "rewrite" ; IDENT "left" ] ; t = term ->
408 TacticAst.Rewrite (loc,`Left, t, None)
409 | [ IDENT "rewrite" ; IDENT "right" ] ; t = term ->
410 TacticAst.Rewrite (loc,`Right, t, None)
411 (* TODO Replace_pattern *)
412 | [ IDENT "right" ] -> TacticAst.Right loc
413 | [ IDENT "ring" ] -> TacticAst.Ring loc
414 | [ IDENT "split" ] -> TacticAst.Split loc
415 | [ IDENT "symmetry" ] ->
416 TacticAst.Symmetry loc
417 | [ IDENT "transitivity" ];
419 TacticAst.Transitivity (loc, t)
424 [ tacticals = LIST1 NEXT SEP SYMBOL ";" ->
425 TacticAst.Seq (loc, tacticals)
429 PAREN "["; tacs = LIST0 tactical SEP SYMBOL ";"; PAREN "]" ->
430 (TacticAst.Then (loc, tac, tacs))
433 [ [ IDENT "do" ]; count = int; tac = tactical ->
434 TacticAst.Do (loc, count, tac)
435 | [ IDENT "repeat" ]; tac = tactical ->
436 TacticAst.Repeat (loc, tac)
440 PAREN "["; tacs = LIST0 tactical SEP SYMBOL ";"; PAREN "]" ->
441 TacticAst.Tries (loc, tacs)
442 | IDENT "try"; tac = NEXT ->
443 TacticAst.Try (loc, tac)
444 | IDENT "fail" -> TacticAst.Fail loc
445 | IDENT "id" -> TacticAst.IdTac loc
446 | PAREN "("; tac = tactical; PAREN ")" -> tac
447 | tac = tactic -> TacticAst.Tactic (loc, tac)
451 [ [ IDENT "definition" ] -> `Definition
452 | [ IDENT "fact" ] -> `Fact
453 | [ IDENT "lemma" ] -> `Lemma
454 | [ IDENT "remark" ] -> `Remark
455 | [ IDENT "theorem" ] -> `Theorem
459 fst_name = IDENT; params = LIST0 [
460 PAREN "("; names = LIST1 IDENT SEP SYMBOL ","; SYMBOL ":";
461 typ = term; PAREN ")" -> (names, typ) ];
462 SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
463 fst_constructors = LIST0 constructor SEP SYMBOL "|";
466 name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
467 OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
468 (name, true, typ, constructors) ] SEP "with" -> types
472 (fun (names, typ) acc ->
473 (List.map (fun name -> (name, typ)) names) @ acc)
476 let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
477 let tl_ind_types = match tl with None -> [] | Some types -> types in
478 let ind_types = fst_ind_type :: tl_ind_types in
483 [ [ IDENT "quit" ] -> TacticAst.Quit loc
484 (* | [ IDENT "abort" ] -> TacticAst.Abort loc *)
485 | [ IDENT "print" ]; name = QSTRING -> TacticAst.Print (loc, name)
486 (* | [ IDENT "undo" ]; steps = OPT NUM ->
487 TacticAst.Undo (loc, int_opt steps)
488 | [ IDENT "redo" ]; steps = OPT NUM ->
489 TacticAst.Redo (loc, int_opt steps) *)
490 | [ IDENT "check" ]; t = term ->
491 TacticAst.Check (loc, t)
492 | [ IDENT "hint" ] -> TacticAst.Hint loc
493 | [ IDENT "whelp"; "match" ] ; t = term ->
494 TacticAst.WMatch (loc,t)
495 | [ IDENT "whelp"; IDENT "instance" ] ; t = term ->
496 TacticAst.WInstance (loc,t)
497 | [ IDENT "whelp"; IDENT "locate" ] ; id = IDENT ->
498 TacticAst.WLocate (loc,id)
499 | [ IDENT "whelp"; IDENT "elim" ] ; t = term ->
500 TacticAst.WElim (loc, t)
501 | [ IDENT "whelp"; IDENT "hint" ] ; t = term ->
502 TacticAst.WHint (loc,t)
503 | [ IDENT "print" ]; name = QSTRING -> TacticAst.Print (loc, name)
508 [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
509 let alpha = "[a-zA-Z]" in
510 let num = "[0-9]+" in
511 let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
512 let ident = "\\("^alpha^ident_cont^"*\\|_"^ident_cont^"+\\)" in
513 let rex = Str.regexp ("^"^ident^"$") in
514 if Str.string_match rex id 0 then
516 ("^\\(cic:/\\|theory:/\\)"^ident^
517 "\\(/"^ident^"+\\)*\\(\\."^ident^"\\)+"^
518 "\\(#xpointer("^ num^"\\(/"^num^"\\)+)\\)?$")
520 if Str.string_match rex uri 0 then
521 TacticAst.Ident_alias (id, uri)
523 raise (Parse_error (loc,sprintf "Not a valid uri: %s" uri))
525 raise (Parse_error (loc,sprintf "Not a valid identifier: %s" id))
526 | IDENT "symbol"; symbol = QSTRING;
527 instance = OPT [ PAREN "("; IDENT "instance"; n = NUM; PAREN ")" -> n ];
528 SYMBOL "="; dsc = QSTRING ->
530 match instance with Some i -> int_of_string i | None -> 0
532 TacticAst.Symbol_alias (symbol, instance, dsc)
534 instance = OPT [ PAREN "("; IDENT "instance"; n = NUM; PAREN ")" -> n ];
535 SYMBOL "="; dsc = QSTRING ->
537 match instance with Some i -> int_of_string i | None -> 0
539 TacticAst.Number_alias (instance, dsc)
544 [ IDENT "set" ]; n = QSTRING; v = QSTRING ->
545 TacticAst.Set (loc, n, v)
546 | [ IDENT "qed" ] -> TacticAst.Qed loc
547 | flavour = theorem_flavour; name = OPT IDENT; SYMBOL ":"; typ = term;
548 body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
549 TacticAst.Theorem (loc, flavour, name, typ, body)
550 | "let"; ind_kind = [ "corec" -> `CoInductive | "rec"-> `Inductive ];
554 | ((Cic.Name name,Some ty),_,_) :: _ -> name,ty
555 | ((Cic.Name name,None),_,_) :: _ ->
556 fail loc ("No type given for " ^ name)
559 let body = CicAst.Ident (name,None) in
560 TacticAst.Theorem(loc, `Definition, Some name, ty,
561 Some (CicAst.LetRec (ind_kind, defs, body)))
563 | [ IDENT "inductive" ]; spec = inductive_spec ->
564 let (params, ind_types) = spec in
565 TacticAst.Inductive (loc, params, ind_types)
566 | [ IDENT "coinductive" ]; spec = inductive_spec ->
567 let (params, ind_types) = spec in
568 let ind_types = (* set inductive flags to false (coinductive) *)
569 List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
572 TacticAst.Inductive (loc, params, ind_types)
573 | [ IDENT "coercion" ] ; name = IDENT ->
574 TacticAst.Coercion (loc, CicAst.Ident (name,Some []))
575 | [ IDENT "coercion" ] ; name = URI ->
576 TacticAst.Coercion (loc, CicAst.Uri (name,Some []))
577 | [ IDENT "alias" ]; spec = alias_spec ->
578 TacticAst.Alias (loc, spec)
582 [ cmd = command; SYMBOL "." -> TacticAst.Command (loc, cmd)
583 | tac = tactical; SYMBOL "." -> TacticAst.Tactical (loc, tac)
584 | mac = macro; SYMBOL "." -> TacticAst.Macro (loc, mac)
589 [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT ->
590 TacticAst.Code (loc, ex)
592 TacticAst.Note (loc, str)
597 [ ex = executable -> TacticAst.Executable (loc,ex)
598 | com = comment -> TacticAst.Comment (loc, com)
602 [ l = LIST0 [ statement ] -> l
607 let exc_located_wrapper f =
611 | Stdpp.Exc_located (floc, Stream.Error msg) ->
612 raise (Parse_error (floc, msg))
613 | Stdpp.Exc_located (floc, exn) ->
614 raise (Parse_error (floc, (Printexc.to_string exn)))
616 let parse_term stream =
617 exc_located_wrapper (fun () -> (Grammar.Entry.parse term0 stream))
618 let parse_statement stream =
619 exc_located_wrapper (fun () -> (Grammar.Entry.parse statement stream))
620 let parse_statements stream =
621 exc_located_wrapper (fun () -> (Grammar.Entry.parse statements stream))
626 (** {2 Interface for gTopLevel} *)
628 module EnvironmentP3 =
634 let aliases_grammar = Grammar.gcreate cic_lexer
635 let aliases = Grammar.Entry.create aliases_grammar "aliases"
640 (fun domain_item (dsc, _) acc ->
642 match domain_item with
644 TacticAstPp.pp_alias (TacticAst.Ident_alias (id, dsc)) ^ "."
645 | Symbol (symb, i) ->
646 TacticAstPp.pp_alias (TacticAst.Symbol_alias (symb, i, dsc))
649 TacticAstPp.pp_alias (TacticAst.Number_alias (i, dsc)) ^ "."
654 String.concat "\n" (List.sort compare aliases)
658 aliases: [ (* build an environment from an aliases list *)
659 [ aliases = LIST0 alias; EOI ->
661 (fun env (domain_item, codomain_item) ->
662 Environment.add domain_item codomain_item env)
663 Environment.empty aliases
666 alias: [ (* return a pair <domain_item, codomain_item> from an alias *)
669 [ IDENT "id"; id = IDENT; SYMBOL "="; uri = URI ->
670 (Id id, choice_of_uri uri)
671 | IDENT "symbol"; symbol = QSTRING;
672 PAREN "("; IDENT "instance"; instance = NUM; PAREN ")";
673 SYMBOL "="; dsc = QSTRING ->
674 (Symbol (symbol, int_of_string instance),
675 DisambiguateChoices.lookup_symbol_by_dsc symbol dsc)
677 PAREN "("; IDENT "instance"; instance = NUM; PAREN ")";
678 SYMBOL "="; dsc = QSTRING ->
679 (Num (int_of_string instance),
680 DisambiguateChoices.lookup_num_by_dsc dsc)
690 (fun () -> Grammar.Entry.parse aliases (Stream.of_string s))
693 (* vim:set encoding=utf8: *)