Project

General

Profile

Revision 89b9e25c src/main_lustre_compiler.ml

View differences:

src/main_lustre_compiler.ml
65 65

  
66 66
(* Loading Lusi file and filling type tables with parsed
67 67
   functions/nodes *)
68
let load_lusi filename =
68
let load_lusi own filename =
69 69
  Location.input_name := filename;
70 70
  let lexbuf = Lexing.from_channel (open_in filename) in
71 71
  Location.init lexbuf filename;
72 72
  (* Parsing *)
73 73
  report ~level:1 (fun fmt -> fprintf fmt "@[<v>.. parsing header file %s@,@?" filename);
74 74
  try
75
    Parse.prog Parser_lustre.header Lexer_lustre.token lexbuf
76
  with (Lexer_lustre.Error err) | (Parse.Syntax_err err) as exc -> 
75
    Parse.header own Parser_lustre.header Lexer_lustre.token lexbuf
76
  with
77
  | (Lexer_lustre.Error err) | (Parse.Syntax_err err) as exc -> 
77 78
    Parse.report_error err;
78 79
    raise exc
80
  | Corelang.Error (err, loc) as exc ->
81
     Format.eprintf "Parsing error at loc %a: %a@]@."
82
       Location.pp_loc loc
83
       Corelang.pp_error err;
84
     raise exc
79 85

  
80 86
let check_lusi header =
81 87
  let new_tenv = type_decls Basic_library.type_env header in   (* Typing *)
......
118 124
      try
119 125
	let basename = s ^ ".lusi" in 
120 126
	report ~level:1 (fun fmt -> fprintf fmt "@[<v 2>Library %s@ " s);
121
	let _, lusi_type_env, lusi_clock_env = check_lusi (load_lusi basename) in 
127
	let _, lusi_type_env, lusi_clock_env = check_lusi (load_lusi false basename) in 
122 128
	report ~level:1 (fun fmt -> fprintf fmt "@]@,@?");
123 129
	Env.overwrite type_env lusi_type_env,
124 130
	Env.overwrite clock_env lusi_clock_env      
......
182 188
  let _ = 
183 189
    try 
184 190
      let _ = open_in lusi_name in
185
      let header = load_lusi lusi_name in
191
      let header = load_lusi true lusi_name in
186 192
      let _, declared_types_env, declared_clocks_env = check_lusi header in
187 193
      (* checking type compatibility with computed types*)
188 194
      Typing.check_env_compat header declared_types_env computed_types_env;
189 195
      (* checking clocks compatibility with computed clocks*)
190 196
      Clock_calculus.check_env_compat header declared_clocks_env computed_clocks_env;
191
      Typing.uneval_prog_generics prog
197
      Typing.uneval_prog_generics prog;
198
      Clock_calculus.uneval_prog_generics prog
192 199
    with Sys_error _ -> ( 
193 200
      (* Printing lusi file is necessary *)
194 201
      report ~level:1 
......
219 226
  (* Normalization phase *)
220 227
  report ~level:1 (fun fmt -> fprintf fmt ".. normalization@,@?");
221 228
  let normalized_prog = Normalization.normalize_prog prog in
222
  (*Typing.uneval_prog_generics normalized_prog;*)
223 229
  report ~level:2 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@,@?" Printers.pp_prog normalized_prog);
224 230
  (* Checking array accesses *)
225 231
  if !Options.check then

Also available in: Unified diff