1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
(***********************************************************************)
(* *)
(* Objective Caml *)
(* *)
(* Pierre Weis, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 2001 Institut National de Recherche en Informatique et *)
(* en Automatique. All rights reserved. This file is distributed *)
(* only by permission. *)
(* *)
(***********************************************************************)
open Syntaxe;;
let compile_fichier nom =
try
let canal = open_in nom in
try
let prog = lire_programme (Stream.of_channel canal) in
close_in canal;
Typage.type_programme prog;
Compil.compile_programme prog
with
| Stream.Error s ->
prerr_string
("Erreur de syntaxe : " ^ s ^ " aux alentours du caractre numro ");
prerr_int (pos_in canal);
prerr_endline "";
exit 2
| Typage.Erreur_typage err ->
Typage.affiche_erreur err;
exit 2
with
| Sys_error message ->
prerr_string "Erreur du systme: ";
prerr_endline message;
exit 2
| Stream.Failure -> ();;
if not !Sys.interactive then begin compile_fichier Sys.argv.(1); exit 0 end;;
|