Revision b5896083
Added by PierreLoïc Garoche almost 9 years ago
src/parser_lustre.mly  

43  43 
let pop_node () = try node_stack := List.tl !node_stack with _ > assert false 
44  44 
let get_current_node () = try List.hd !node_stack with _ > assert false 
45  45  
46 
let rec fby expr n init = 

47 
if n<=1 then 

48 
mkexpr (Expr_arrow (init, mkexpr (Expr_pre expr))) 

49 
else 

50 
mkexpr (Expr_arrow (init, mkexpr (Expr_pre (fby expr (n1) init)))) 

51 


46  52 
%} 
47  53  
48  54 
%token <int> INT 
...  ...  
403  409 
 node_ident LPAR expr RPAR EVERY expr 
404  410 
{mkexpr (Expr_appl ($1, $3, Some $6))} 
405  411 
 node_ident LPAR tuple_expr RPAR 
406 
{mkexpr (Expr_appl ($1, mkexpr (Expr_tuple (List.rev $3)), None))} 

412 
{ 

413 
let id=$1 in 

414 
let args=List.rev $3 in 

415 
match id, args with 

416 
 "fbyn", [expr;n;init] > 

417 
let n = match n.expr_desc with 

418 
 Expr_const (Const_int n) > n 

419 
 _ > assert false 

420 
in 

421 
fby expr n init 

422 
 _ > mkexpr (Expr_appl ($1, mkexpr (Expr_tuple args), None)) 

423 
} 

407  424 
 node_ident LPAR tuple_expr RPAR EVERY expr 
408 
{mkexpr (Expr_appl ($1, mkexpr (Expr_tuple (List.rev $3)), Some $6)) } 

425 
{ 

426 
let id=$1 in 

427 
let args=List.rev $3 in 

428 
let clock=$6 in 

429 
if id="fby" then 

430 
assert false (* TODO Ca veut dire quoi fby (e,n,init) every c *) 

431 
else 

432 
mkexpr (Expr_appl (id, mkexpr (Expr_tuple args), Some clock)) 

433 
} 

409  434  
410  435 
/* Boolean expr */ 
411  436 
 expr AND expr 
Also available in: Unified diff
Ca marche mieux avec le fichier
gitsvnid: https://cavale.enseeiht.fr/svn/lustrec/lustre_compiler/trunk@463 041b043f8d7c46b2b46eef0dd855326e