/[svn]/driver/cduce.ml
ViewVC logotype

Contents of /driver/cduce.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Tue Jul 10 16:57:27 2007 UTC (5 years, 10 months ago) by abate
File size: 1008 byte(s)
[r2002-10-15 21:01:00 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-15 21:01:35+00:00
1 open Location
2
3 let input = Stream.of_channel stdin
4 let ppf = Format.std_formatter
5 let prog () =
6 try Parser.prog input
7 with
8 | Stdpp.Exc_located (loc, e) ->
9 raise (Location (loc, e))
10
11 let rec print_exn ppf = function
12 | Location ((i,j), exn) ->
13 Format.fprintf ppf "Error at chars %i-%i@\n" i j;
14 print_exn ppf exn
15 | Typer.Constraint (s,t,msg) ->
16 Format.fprintf ppf "%s@\n" msg;
17 Format.fprintf ppf "%a is not a subtype of %a@\n"
18 Types.Print.print_descr s
19 Types.Print.print_descr t;
20 Format.fprintf ppf "as shown by %a@\n"
21 Types.Print.print_sample (Types.Sample.get (Types.diff s t))
22 | exn ->
23 Format.fprintf ppf "%s@\n" (Printexc.to_string exn)
24
25 let phrase ph =
26 match ph.descr with
27 | Ast.EvalStatement e ->
28 let (fv,e) = Typer.expr e in
29 let t = Typer.compute_type Typer.Env.empty e in
30 Format.fprintf ppf "%a@\n" Types.Print.print_descr t;
31 | _ -> assert false
32
33 let () =
34 try List.iter phrase (prog ())
35 with exn -> print_exn ppf exn
36

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5