Project

General

Profile

Revision 684d39e7

View differences:

src/compiler_stages.ml
143 143

  
144 144
  (* Creating destination directory if needed *)
145 145
  create_dest_dir ();
146

  
147
  (* Compatibility with Lusi *)
148
  (* If compiling a lusi, generate the lusic. If this is a lus file, Check the existence of a lusi (Lustre Interface file) *)
149
  compile_source_to_header
150
    prog !Global.type_env !Global.clock_env dirname basename extension;
151
 
152
    
146
     
153 147
  Typing.uneval_prog_generics prog;
154 148
  Clock_calculus.uneval_prog_generics prog;
155 149

  
......
195 189
  let prog = Normalization.normalize_prog params prog in
196 190
  Log.report ~level:2 (fun fmt -> fprintf fmt "@[<v 2>@ %a@]@," Printers.pp_prog prog);
197 191

  
192
  (* Compatibility with Lusi *)
193
  (* If compiling a lusi, generate the lusic. If this is a lus file, Check the existence of a lusi (Lustre Interface file) *)
194
  compile_source_to_header
195
    prog !Global.type_env !Global.clock_env dirname basename extension;
196

  
198 197
  let prog =
199 198
    if !Options.mpfr
200 199
    then
src/parsers/parser_lustre.mly
167 167
  IDENT { $1 }
168 168

  
169 169
prog:
170
 open_list typ_def_prog top_decl_list EOF { $1 @ $2 @ (List.rev $3) }
170
 prefix_prog top_decl_list EOF { $1 @ (List.rev $2) }
171 171

  
172
typ_def_prog:
173
 typ_def_list { $1 false }
172
prefix_prog:
173
    { [] }
174
  | open_lusi prefix_prog { $1 :: $2 }
175
  | typ_def prefix_prog   { ($1 false (* not a header *)) :: $2 }
174 176

  
175
header:
176
 open_list typ_def_header top_decl_header_list EOF { $1 @ $2 @ (List.rev $3) }
177
prefix_header:
178
    { [] }
179
  | open_lusi prefix_header { $1 :: $2 }
180
  | typ_def prefix_header   { ($1 true (* is a header *)) :: $2 }
177 181

  
178
typ_def_header:
179
 typ_def_list { $1 true }
182
header:
183
 prefix_header top_decl_header_list EOF { $1 @ (List.rev $2) }
180 184

  
181
open_list:
182
  { [] }
183
| open_lusi open_list { $1 :: $2 }
184 185

  
185 186
open_lusi:
186 187
  | OPEN QUOTE path_ident QUOTE { mktop_decl false (Open (true, $3)) }
......
268 269
     pop_node ();
269 270
     (*add_node $3 nd;*) [nd] }
270 271

  
272
| state_annot IMPORTED node_ident_decl LPAR vdecl_list SCOL_opt RPAR RETURNS LPAR vdecl_list SCOL_opt RPAR SCOL_opt LET contract TEL
273
    {let nd = mktop_decl true (ImportedNode
274
				 {nodei_id = $3;
275
				  nodei_type = Types.new_var ();
276
				  nodei_clock = Clocks.new_var true;
277
				  nodei_inputs = List.rev $5;
278
				  nodei_outputs = List.rev $10;
279
				  nodei_stateless = $1;
280
				  nodei_spec = Some $15;
281
				  nodei_prototype = None;
282
				  nodei_in_lib = [];})
283
     in
284
     pop_node ();
285
     (*add_imported_node $3 nd;*) [nd] } 
286
| state_annot IMPORTED node_ident_decl LPAR vdecl_list SCOL_opt RPAR RETURNS LPAR vdecl_list SCOL_opt RPAR SCOL
287
    {let nd = mktop_decl true (ImportedNode
288
				 {nodei_id = $3;
289
				  nodei_type = Types.new_var ();
290
				  nodei_clock = Clocks.new_var true;
291
				  nodei_inputs = List.rev $5;
292
				  nodei_outputs = List.rev $10;
293
				  nodei_stateless = $1;
294
				  nodei_spec = None;
295
				  nodei_prototype = None;
296
				  nodei_in_lib = [];})
297
     in
298
     pop_node ();
299
     (*add_imported_node $3 nd;*) [nd] } 
300

  
271 301
nodespec_list:
272 302
 { None }
273 303
| NODESPEC nodespec_list { 
......
277 307

  
278 308
typ_def_list:
279 309
    /* empty */             { (fun itf -> []) }
280
| typ_def SCOL typ_def_list { (fun itf -> let ty1 = ($1 itf) in ty1 :: ($3 itf)) }
310
| typ_def typ_def_list { (fun itf -> let ty1 = ($1 itf) in ty1 :: ($2 itf)) }
281 311

  
282 312
typ_def:
283
  TYPE type_ident EQ typ_def_rhs { (fun itf ->
313
  TYPE type_ident EQ typ_def_rhs SCOL { (fun itf ->
284 314
			       let typ = mktop_decl itf (TypeDef { tydef_id = $2;
285 315
								   tydef_desc = $4
286 316
							})

Also available in: Unified diff