]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/cic_notation/grafiteParser.ml
use uniform naming for referencing cicNotation* modules
[helm.git] / helm / ocaml / cic_notation / grafiteParser.ml
1 (* Copyright (C) 2005, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://helm.cs.unibo.it/
24  *)
25
26 open Printf
27
28 module Ast = CicNotationPt
29
30 let grammar = CicNotationParser.level2_ast_grammar
31
32 let term = CicNotationParser.term
33 let statement = Grammar.Entry.create grammar "statement"
34
35 let add_raw_attribute ~text t = Ast.AttributedTerm (`Raw text, t)
36
37 let default_precedence = 50
38 let default_associativity = Gramext.NonA
39
40 EXTEND
41   GLOBAL: term statement;
42   arg: [
43    [ LPAREN; names = LIST1 IDENT SEP SYMBOL ",";
44       SYMBOL ":"; ty = term; RPAREN -> names,ty
45    | name = IDENT -> [name],Ast.Implicit
46    ]
47   ];
48   constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ];
49   tactic_term: [ [ t = term -> t ] ];
50   ident_list0: [
51     [ SYMBOL "["; idents = LIST0 IDENT SEP SYMBOL ";"; SYMBOL "]" -> idents ]
52   ];
53   tactic_term_list1: [
54     [ tactic_terms = LIST1 tactic_term SEP SYMBOL "," -> tactic_terms ]
55   ];
56   reduction_kind: [
57     [ IDENT "normalize" -> `Normalize
58     | IDENT "reduce" -> `Reduce
59     | IDENT "simplify" -> `Simpl
60     | IDENT "unfold"; t = OPT term -> `Unfold t
61     | IDENT "whd" -> `Whd ]
62   ];
63   sequent_pattern_spec: [
64    [ hyp_paths =
65       LIST0
66        [ id = IDENT ;
67          path = OPT [SYMBOL ":" ; path = term -> path ] ->
68          (id,match path with Some p -> p | None -> Ast.UserInput) ]
69        SEP SYMBOL ";";
70      goal_path = OPT [ SYMBOL <:unicode<vdash>>; term = term -> term ] ->
71       let goal_path =
72        match goal_path with
73           None -> Ast.UserInput
74         | Some goal_path -> goal_path
75       in
76        hyp_paths,goal_path
77    ]
78   ];
79   pattern_spec: [
80     [ res = OPT [
81        "in";
82        wanted_and_sps =
83         [ "match" ; wanted = term ;
84           sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] ->
85            Some wanted,sps
86         | sps = sequent_pattern_spec ->
87            None,Some sps
88         ] ->
89          let wanted,hyp_paths,goal_path =
90           match wanted_and_sps with
91              wanted,None -> wanted, [], Ast.UserInput
92            | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path
93          in
94           wanted, hyp_paths, goal_path ] ->
95       match res with
96          None -> None,[],Ast.UserInput
97        | Some ps -> ps]
98   ];
99   direction: [
100     [ SYMBOL ">" -> `LeftToRight
101     | SYMBOL "<" -> `RightToLeft ]
102   ];
103   int: [ [ num = NUMBER -> int_of_string num ] ];
104   tactic: [
105     [ IDENT "absurd"; t = tactic_term ->
106         GrafiteAst.Absurd (loc, t)
107     | IDENT "apply"; t = tactic_term ->
108         GrafiteAst.Apply (loc, t)
109     | IDENT "assumption" ->
110         GrafiteAst.Assumption loc
111     | IDENT "auto";
112       depth = OPT [ IDENT "depth"; SYMBOL "="; i = int -> i ];
113       width = OPT [ IDENT "width"; SYMBOL "="; i = int -> i ];
114       paramodulation = OPT [ IDENT "paramodulation" ] ->  (* ALB *)
115           GrafiteAst.Auto (loc,depth,width,paramodulation)
116     | IDENT "clear"; id = IDENT ->
117         GrafiteAst.Clear (loc,id)
118     | IDENT "clearbody"; id = IDENT ->
119         GrafiteAst.ClearBody (loc,id)
120     | IDENT "change"; what = pattern_spec; "with"; t = tactic_term ->
121         GrafiteAst.Change (loc, what, t)
122     | IDENT "compare"; t = tactic_term ->
123         GrafiteAst.Compare (loc,t)
124     | IDENT "constructor"; n = int ->
125         GrafiteAst.Constructor (loc, n)
126     | IDENT "contradiction" ->
127         GrafiteAst.Contradiction loc
128     | IDENT "cut"; t = tactic_term; ident = OPT [ "as"; id = IDENT -> id] ->
129         GrafiteAst.Cut (loc, ident, t)
130     | IDENT "decide"; IDENT "equality" ->
131         GrafiteAst.DecideEquality loc
132     | IDENT "decompose"; types = OPT ident_list0; what = IDENT;
133       OPT "names"; num = OPT [num = int -> num];
134       idents = OPT ident_list0 ->
135         let idents = match idents with None -> [] | Some idents -> idents in   
136         let types = match types with None -> [] | Some types -> types in
137         let to_spec id = GrafiteAst.Ident id in
138         GrafiteAst.Decompose (loc, List.rev_map to_spec types, what, idents)
139     | IDENT "discriminate"; t = tactic_term ->
140         GrafiteAst.Discriminate (loc, t)
141     | IDENT "elim"; what = tactic_term;
142       using = OPT [ "using"; using = tactic_term -> using ];  
143       OPT "names"; num = OPT [num = int -> num];
144       idents = OPT ident_list0 ->
145         let idents = match idents with None -> [] | Some idents -> idents in
146         GrafiteAst.Elim (loc, what, using, num, idents)
147     | IDENT "elimType"; what = tactic_term;
148       using = OPT [ "using"; using = tactic_term -> using ];  
149       OPT "names"; num = OPT [num = int -> num]; idents = OPT ident_list0 ->
150         let idents = match idents with None -> [] | Some idents -> idents in
151         GrafiteAst.ElimType (loc, what, using, num, idents)
152     | IDENT "exact"; t = tactic_term ->
153         GrafiteAst.Exact (loc, t)
154     | IDENT "exists" ->
155         GrafiteAst.Exists loc
156     | IDENT "fail" -> GrafiteAst.Fail loc
157     | IDENT "fold"; kind = reduction_kind; t = tactic_term; p = pattern_spec ->
158         let (pt,_,_) = p in
159           if pt <> None then
160             raise (CicNotationParser.Parse_error
161               (loc, "the pattern cannot specify the term to replace, only its"
162               ^ " paths in the hypotheses and in the conclusion"))
163         else
164          GrafiteAst.Fold (loc, kind, t, p)
165     | IDENT "fourier" ->
166         GrafiteAst.Fourier loc
167     | IDENT "fwd"; hyp = IDENT; idents = OPT ident_list0 ->
168         let idents = match idents with None -> [] | Some idents -> idents in
169         GrafiteAst.FwdSimpl (loc, hyp, idents)
170     | IDENT "generalize"; p=pattern_spec; id = OPT ["as" ; id = IDENT -> id] ->
171        GrafiteAst.Generalize (loc,p,id)
172     | IDENT "goal"; n = int ->
173         GrafiteAst.Goal (loc, n)
174     | IDENT "id" -> GrafiteAst.IdTac loc
175     | IDENT "injection"; t = tactic_term ->
176         GrafiteAst.Injection (loc, t)
177     | IDENT "intro"; ident = OPT IDENT ->
178         let idents = match ident with None -> [] | Some id -> [id] in
179         GrafiteAst.Intros (loc, Some 1, idents)
180     | IDENT "intros"; num = OPT [num = int -> num]; idents = OPT ident_list0 ->
181         let idents = match idents with None -> [] | Some idents -> idents in
182         GrafiteAst.Intros (loc, num, idents)
183     | IDENT "lapply"; 
184       depth = OPT [ IDENT "depth"; SYMBOL "="; i = int -> i ];
185       what = tactic_term; 
186       to_what = OPT [ "to" ; t = tactic_term_list1 -> t ];
187       ident = OPT [ "using" ; ident = IDENT -> ident ] ->
188         let to_what = match to_what with None -> [] | Some to_what -> to_what in
189         GrafiteAst.LApply (loc, depth, to_what, what, ident)
190     | IDENT "left" -> GrafiteAst.Left loc
191     | IDENT "letin"; where = IDENT ; SYMBOL <:unicode<def>> ; t = tactic_term ->
192         GrafiteAst.LetIn (loc, t, where)
193     | kind = reduction_kind; p = pattern_spec ->
194         GrafiteAst.Reduce (loc, kind, p)
195     | IDENT "reflexivity" ->
196         GrafiteAst.Reflexivity loc
197     | IDENT "replace"; p = pattern_spec; "with"; t = tactic_term ->
198         GrafiteAst.Replace (loc, p, t)
199     | IDENT "rewrite" ; d = direction; t = tactic_term ; p = pattern_spec ->
200        let (pt,_,_) = p in
201         if pt <> None then
202          raise
203           (CicNotationParser.Parse_error
204             (loc,"the pattern cannot specify the term to rewrite, only its paths in the hypotheses and in the conclusion"))
205         else
206          GrafiteAst.Rewrite (loc, d, t, p)
207     | IDENT "right" ->
208         GrafiteAst.Right loc
209     | IDENT "ring" ->
210         GrafiteAst.Ring loc
211     | IDENT "split" ->
212         GrafiteAst.Split loc
213     | IDENT "symmetry" ->
214         GrafiteAst.Symmetry loc
215     | IDENT "transitivity"; t = tactic_term ->
216         GrafiteAst.Transitivity (loc, t)
217     ]
218   ];
219   tactical:
220     [ "sequence" LEFTA
221       [ tacticals = LIST1 NEXT SEP SYMBOL ";" ->
222          match tacticals with
223             [] -> assert false
224           | [tac] -> tac
225           | l -> GrafiteAst.Seq (loc, l)
226       ]
227     | "then" NONA
228       [ tac = tactical; SYMBOL ";";
229         SYMBOL "["; tacs = LIST0 tactical SEP SYMBOL "|"; SYMBOL "]" ->
230           (GrafiteAst.Then (loc, tac, tacs))
231       ]
232     | "loops" RIGHTA
233       [ IDENT "do"; count = int; tac = tactical ->
234           GrafiteAst.Do (loc, count, tac)
235       | IDENT "repeat"; tac = tactical ->
236           GrafiteAst.Repeat (loc, tac)
237       ]
238     | "simple" NONA
239       [ IDENT "first";
240         SYMBOL "["; tacs = LIST0 tactical SEP SYMBOL "|"; SYMBOL "]" ->
241           GrafiteAst.First (loc, tacs)
242       | IDENT "try"; tac = NEXT ->
243           GrafiteAst.Try (loc, tac)
244       | IDENT "solve";
245         SYMBOL "["; tacs = LIST0 tactical SEP SYMBOL "|"; SYMBOL "]" ->
246           GrafiteAst.Solve (loc, tacs)
247       | LPAREN; tac = tactical; RPAREN -> tac
248       | tac = tactic -> GrafiteAst.Tactic (loc, tac)
249       ]
250     ];
251   theorem_flavour: [
252     [ [ IDENT "definition"  ] -> `Definition
253     | [ IDENT "fact"        ] -> `Fact
254     | [ IDENT "lemma"       ] -> `Lemma
255     | [ IDENT "remark"      ] -> `Remark
256     | [ IDENT "theorem"     ] -> `Theorem
257     ]
258   ];
259   inductive_spec: [ [
260     fst_name = IDENT; params = LIST0 [ arg=arg -> arg ];
261     SYMBOL ":"; fst_typ = term; SYMBOL <:unicode<def>>; OPT SYMBOL "|";
262     fst_constructors = LIST0 constructor SEP SYMBOL "|";
263     tl = OPT [ "with";
264       types = LIST1 [
265         name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
266        OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" ->
267           (name, true, typ, constructors) ] SEP "with" -> types
268     ] ->
269       let params =
270         List.fold_right
271           (fun (names, typ) acc ->
272             (List.map (fun name -> (name, typ)) names) @ acc)
273           params []
274       in
275       let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in
276       let tl_ind_types = match tl with None -> [] | Some types -> types in
277       let ind_types = fst_ind_type :: tl_ind_types in
278       (params, ind_types)
279   ] ];
280   
281   record_spec: [ [
282     name = IDENT; params = LIST0 [ arg = arg -> arg ] ;
283      SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>; SYMBOL "{" ; 
284      fields = LIST0 [ 
285        name = IDENT ; SYMBOL ":" ; ty = term -> (name,ty) 
286      ] SEP SYMBOL ";"; SYMBOL "}" -> 
287       let params =
288         List.fold_right
289           (fun (names, typ) acc ->
290             (List.map (fun name -> (name, typ)) names) @ acc)
291           params []
292       in
293       (params,name,typ,fields)
294   ] ];
295   
296   macro: [
297     [ [ IDENT "quit"  ] -> GrafiteAst.Quit loc
298 (*     | [ IDENT "abort" ] -> GrafiteAst.Abort loc *)
299     | [ IDENT "print" ]; name = QSTRING -> GrafiteAst.Print (loc, name)
300 (*     | [ IDENT "undo"   ]; steps = OPT NUMBER ->
301         GrafiteAst.Undo (loc, int_opt steps)
302     | [ IDENT "redo"   ]; steps = OPT NUMBER ->
303         GrafiteAst.Redo (loc, int_opt steps) *)
304     | [ IDENT "check"   ]; t = term ->
305         GrafiteAst.Check (loc, t)
306     | [ IDENT "hint" ] -> GrafiteAst.Hint loc
307     | [ IDENT "whelp"; "match" ] ; t = term -> 
308         GrafiteAst.WMatch (loc,t)
309     | [ IDENT "whelp"; IDENT "instance" ] ; t = term -> 
310         GrafiteAst.WInstance (loc,t)
311     | [ IDENT "whelp"; IDENT "locate" ] ; id = IDENT -> 
312         GrafiteAst.WLocate (loc,id)
313     | [ IDENT "whelp"; IDENT "elim" ] ; t = term ->
314         GrafiteAst.WElim (loc, t)
315     | [ IDENT "whelp"; IDENT "hint" ] ; t = term -> 
316         GrafiteAst.WHint (loc,t)
317     | [ IDENT "print" ]; name = QSTRING -> GrafiteAst.Print (loc, name)
318     ]
319   ];
320   alias_spec: [
321     [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING ->
322       let alpha = "[a-zA-Z]" in
323       let num = "[0-9]+" in
324       let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in
325       let ident = "\\("^alpha^ident_cont^"*\\|_"^ident_cont^"+\\)" in
326       let rex = Str.regexp ("^"^ident^"$") in
327       if Str.string_match rex id 0 then
328         if (try ignore (UriManager.uri_of_string uri); true
329             with UriManager.IllFormedUri _ -> false)
330         then
331           GrafiteAst.Ident_alias (id, uri)
332         else 
333           raise (CicNotationParser.Parse_error (loc,sprintf "Not a valid uri: %s" uri))
334       else
335         raise (CicNotationParser.Parse_error (loc,
336           sprintf "Not a valid identifier: %s" id))
337     | IDENT "symbol"; symbol = QSTRING;
338       instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
339       SYMBOL "="; dsc = QSTRING ->
340         let instance =
341           match instance with Some i -> i | None -> 0
342         in
343         GrafiteAst.Symbol_alias (symbol, instance, dsc)
344     | IDENT "num";
345       instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ];
346       SYMBOL "="; dsc = QSTRING ->
347         let instance =
348           match instance with Some i -> i | None -> 0
349         in
350         GrafiteAst.Number_alias (instance, dsc)
351     ]
352   ];
353   argument: [
354     [ id = IDENT -> Ast.IdentArg (0, id)
355     | l = LIST1 [ SYMBOL <:unicode<eta>> (* η *) -> () ] SEP SYMBOL ".";
356       SYMBOL "."; id = IDENT ->
357         Ast.IdentArg (List.length l, id)
358     ]
359   ];
360   associativity: [
361     [ IDENT "left";  IDENT "associative" -> Gramext.LeftA
362     | IDENT "right"; IDENT "associative" -> Gramext.RightA
363     | IDENT "non"; IDENT "associative" -> Gramext.NonA
364     ]
365   ];
366   precedence: [
367     [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ]
368   ];
369   notation: [
370     [ dir = OPT direction; s = QSTRING;
371       assoc = OPT associativity; prec = OPT precedence;
372       IDENT "for";
373       p2 = 
374         [ blob = UNPARSED_AST ->
375             add_raw_attribute ~text:(sprintf "@{%s}" blob)
376               (CicNotationParser.parse_level2_ast (Stream.of_string blob))
377         | blob = UNPARSED_META ->
378             add_raw_attribute ~text:(sprintf "${%s}" blob)
379               (CicNotationParser.parse_level2_meta (Stream.of_string blob))
380         ] ->
381           let assoc =
382             match assoc with
383             | None -> default_associativity
384             | Some assoc -> assoc
385           in
386           let prec =
387             match prec with
388             | None -> default_precedence
389             | Some prec -> prec
390           in
391           let p1 =
392             add_raw_attribute ~text:s
393               (CicNotationParser.parse_level1_pattern (Stream.of_string s))
394           in
395           (dir, p1, assoc, prec, p2)
396     ]
397   ];
398   level3_term: [
399     [ u = URI -> Ast.UriPattern (UriManager.uri_of_string u)
400     | id = IDENT -> Ast.VarPattern id
401     | SYMBOL "_" -> Ast.ImplicitPattern
402     | LPAREN; terms = LIST1 SELF; RPAREN ->
403         (match terms with
404         | [] -> assert false
405         | [term] -> term
406         | terms -> Ast.ApplPattern terms)
407     ]
408   ];
409   interpretation: [
410     [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term ->
411         (s, args, t)
412     ]
413   ];
414   command: [ [
415       IDENT "set"; n = QSTRING; v = QSTRING ->
416         GrafiteAst.Set (loc, n, v)
417     | IDENT "drop" -> GrafiteAst.Drop loc
418     | IDENT "qed" -> GrafiteAst.Qed loc
419     | IDENT "variant" ; name = IDENT; SYMBOL ":"; 
420       typ = term; SYMBOL <:unicode<def>> ; newname = IDENT ->
421         GrafiteAst.Obj (loc, 
422           GrafiteAst.Theorem 
423             (`Variant,name,typ,Some (Ast.Ident (newname, None))))
424     | flavour = theorem_flavour; name = IDENT; SYMBOL ":"; typ = term;
425       body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
426         GrafiteAst.Obj (loc,GrafiteAst.Theorem (flavour, name, typ, body))
427     | flavour = theorem_flavour; name = IDENT;
428       body = OPT [ SYMBOL <:unicode<def>> (* ≝ *); body = term -> body ] ->
429         GrafiteAst.Obj (loc,
430           GrafiteAst.Theorem (flavour, name, Ast.Implicit, body))
431     | "let"; ind_kind = [ "corec" -> `CoInductive | "rec"-> `Inductive ];
432         defs = CicNotationParser.let_defs -> 
433           let name,ty = 
434             match defs with
435             | ((Ast.Ident (name, None), Some ty),_,_) :: _ -> name,ty
436             | ((Ast.Ident (name, None), None),_,_) :: _ ->
437                 name, Ast.Implicit
438             | _ -> assert false 
439           in
440           let body = Ast.Ident (name,None) in
441           GrafiteAst.Obj (loc,GrafiteAst.Theorem(`Definition, name, ty,
442             Some (Ast.LetRec (ind_kind, defs, body))))
443     | [ IDENT "inductive" ]; spec = inductive_spec ->
444         let (params, ind_types) = spec in
445         GrafiteAst.Obj (loc,GrafiteAst.Inductive (params, ind_types))
446     | [ IDENT "coinductive" ]; spec = inductive_spec ->
447         let (params, ind_types) = spec in
448         let ind_types = (* set inductive flags to false (coinductive) *)
449           List.map (fun (name, _, term, ctors) -> (name, false, term, ctors))
450             ind_types
451         in
452         GrafiteAst.Obj (loc,GrafiteAst.Inductive (params, ind_types))
453     | IDENT "coercion" ; name = IDENT -> 
454         GrafiteAst.Coercion (loc, Ast.Ident (name,Some []))
455     | IDENT "coercion" ; name = URI -> 
456         GrafiteAst.Coercion (loc, Ast.Uri (name,Some []))
457     | IDENT "alias" ; spec = alias_spec ->
458         GrafiteAst.Alias (loc, spec)
459     | IDENT "record" ; (params,name,ty,fields) = record_spec ->
460         GrafiteAst.Obj (loc,GrafiteAst.Record (params,name,ty,fields))
461     | IDENT "include" ; path = QSTRING ->
462         GrafiteAst.Include (loc,path)
463     | IDENT "default" ; what = QSTRING ; uris = LIST1 URI ->
464        let uris = List.map UriManager.uri_of_string uris in
465         GrafiteAst.Default (loc,what,uris)
466     | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation ->
467         GrafiteAst.Notation (loc, dir, l1, assoc, prec, l2)
468     | IDENT "interpretation"; id = QSTRING;
469       (symbol, args, l3) = interpretation ->
470         GrafiteAst.Interpretation (loc, id, (symbol, args), l3)
471
472     | IDENT "dump" -> GrafiteAst.Dump loc
473     | IDENT "render"; u = URI ->
474         GrafiteAst.Render (loc, UriManager.uri_of_string u)
475   ]];
476   executable: [
477     [ cmd = command; SYMBOL "." -> GrafiteAst.Command (loc, cmd)
478     | tac = tactical; SYMBOL "." -> GrafiteAst.Tactical (loc, tac)
479     | mac = macro; SYMBOL "." -> GrafiteAst.Macro (loc, mac)
480     ]
481   ];
482   comment: [
483     [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT -> 
484        GrafiteAst.Code (loc, ex)
485     | str = NOTE -> 
486        GrafiteAst.Note (loc, str)
487     ]
488   ];
489   statement: [
490     [ ex = executable -> GrafiteAst.Executable (loc,ex)
491     | com = comment -> GrafiteAst.Comment (loc, com)
492     | EOI -> raise End_of_file
493     ]
494   ];
495 END
496
497 let exc_located_wrapper f =
498   try
499     f ()
500   with
501   | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file
502   | Stdpp.Exc_located (floc, Stream.Error msg) ->
503       raise (CicNotationParser.Parse_error (floc, msg))
504   | Stdpp.Exc_located (floc, exn) ->
505       raise (CicNotationParser.Parse_error (floc, (Printexc.to_string exn)))
506
507 let parse_statement stream =
508   exc_located_wrapper (fun () -> (Grammar.Entry.parse statement stream))
509