Project

General

Profile

Revision 3b2bd83d src/compiler_common.ml

View differences:

src/compiler_common.ml
14 14
open LustreSpec
15 15
open Corelang
16 16

  
17
let check_main () =
18
  if !Options.main_node = "" then
19
    begin
20
      eprintf "Code generation error: %a@." pp_error No_main_specified;
21
      raise (Error (Location.dummy_loc, No_main_specified))
22
    end
23

  
17 24
let create_dest_dir () =
18 25
  begin
19 26
    if not (Sys.file_exists !Options.dest_dir) then
......
43 50
      close_in h_in;
44 51
      header
45 52
    with
46
    | (Lexer_lustre.Error err) | (Parse.Syntax_err err) as exc -> 
53
    | (Parse.Error err) as exc -> 
47 54
      Parse.report_error err;
48 55
      raise exc
49 56
    | Corelang.Error (loc, err) as exc -> (
......
69 76
    close_in s_in;
70 77
    prog
71 78
  with
72
  | (Lexer_lustre.Error err) | (Parse.Syntax_err err) as exc -> 
79
  | (Parse.Error err) as exc -> 
73 80
    Parse.report_error err;
74 81
    raise exc
75 82
  | Corelang.Error (loc, err) as exc ->
......
78 85
      Location.pp_loc loc;
79 86
    raise exc
80 87

  
88
let expand_automata decls =
89
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. expanding automata@ ");
90
  try
91
    Automata.expand_decls decls
92
  with (Corelang.Error (loc, err)) as exc ->
93
    eprintf "Automata error: %a%a@."
94
      Corelang.pp_error err
95
      Location.pp_loc loc;
96
    raise exc
97

  
81 98
let check_stateless_decls decls =
82 99
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. checking stateless/stateful status@ ");
83 100
  try
......
88 105
      Location.pp_loc loc;
89 106
    raise exc
90 107

  
108
let force_stateful_decls decls =
109
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. forcing stateful status@ ");
110
  try
111
    Stateless.force_prog decls
112
  with (Stateless.Error (loc, err)) as exc ->
113
    eprintf "Stateless status error: %a%a@."
114
      Stateless.pp_error err
115
      Location.pp_loc loc;
116
    raise exc
117

  
91 118
let type_decls env decls =  
92 119
  Log.report ~level:1 (fun fmt -> fprintf fmt ".. typing@ ");
93 120
  let new_env = 

Also available in: Unified diff