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

Diff of /driver/cduce.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by abate, Tue Jul 10 16:58:37 2007 UTC revision 21 by abate, Tue Jul 10 16:58:44 2007 UTC
# Line 1  Line 1 
1  open Location  open Location
2    open Sys
3    exception Usage of unit
4    
5  let () =  let () =
6    List.iter    List.iter
7      (fun (n,t) -> Typer.register_global_types [n, mk noloc (Ast.Internal t)])      (fun (n,t) -> Typer.register_global_types [n, mk noloc (Ast.Internal t)])
8      Builtin.types      Builtin.types
9    
10  let input = Stream.of_channel stdin  
11    let input = if (Array.length argv > 2)  or
12                   not (file_exists (Array.get argv 1)) then raise(Usage () )
13                else if Array.length argv = 1 then (Stream.of_channel stdin)
14                else (Stream.of_channel (open_in (Array.get argv 1)))
15    
16  let ppf = Format.std_formatter  let ppf = Format.std_formatter
17  let prog () =  let prog () =
18    try Parser.prog input    try Parser.prog input
19    with    with
20      | Stdpp.Exc_located (loc, e) ->      | Stdpp.Exc_located (loc, e) -> raise (Location (loc, e))
         raise (Location (loc, e))  
21    
22  let rec print_exn ppf = function  let rec print_exn ppf = function
23    | Location ((i,j), exn) ->    | Location ((i,j), exn) ->
# Line 60  Line 66 
66      List.iter phrase p      List.iter phrase p
67    with (Failure _) as e -> raise e | exn -> print_exn ppf exn    with (Failure _) as e -> raise e | exn -> print_exn ppf exn
68    
69    
70    
71    
72    

Legend:
Removed from v.20  
changed lines
  Added in v.21

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