From 1a14b11128a12fe7aa82d464aa4f14ab8dba1e45 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Wed, 6 Feb 2008 11:43:45 +0100
Subject: [PATCH] src/syntaxTree.ml src/syntaxTreeCore.ml (new file) 	Split 
     syntaxTree.ml      into     syntaxTree.ml      and 
 syntaxTreeCore.ml. The idea is that lic2loc should be able to 	use
 syntaxTreeCore.ml verbatim.

src/lxm.ml
src/lxm.mli
	remove pack_name from  this module, so that it  can be shared
	with  lic2loc too  (this is  mandatory  since it  is used  by
	SyntaxTreeCore)

src/compile.ml
src/compiledData.ml
src/evalConst.ml
src/evalConst.mli
src/evalType.ml
src/evalType.mli
src/expandPack.ml
src/lazyCompiler.ml
src/main.ml
src/parser.mly
src/symbolTab.ml
src/symbolTab.mli
src/syntaxTab.ml
src/syntaxTreeDump.ml
src/syntaxTreeDump.mli
src/test/Makefile
src/test/packs.lus
src/test/test.res.exp
	opening SyntaxTreeCore  module, and inline  the definition of
	Lxm.pack_name.

	Also,  begin  to  replace  oper  by node  or  predef_node  in
	identifiers, in order to get a more consistant naming scheme.
---
 src/Makefile           |   1 +
 src/TODO               |  37 +++++-
 src/compile.ml         |   3 +-
 src/compiledData.ml    |  11 +-
 src/evalConst.ml       |  20 +--
 src/evalConst.mli      |  11 +-
 src/evalType.ml        |   3 +-
 src/evalType.mli       |   4 +-
 src/expandPack.ml      |   5 +-
 src/lazyCompiler.ml    |  30 ++---
 src/lxm.ml             |   9 +-
 src/lxm.mli            |  57 ++++----
 src/main.ml            |   7 +-
 src/parser.mly         |  31 ++---
 src/symbolTab.ml       |   3 +-
 src/symbolTab.mli      |  24 ++--
 src/syntaxTab.ml       |  23 ++--
 src/syntaxTree.ml      | 292 +----------------------------------------
 src/syntaxTreeCore.ml  | 270 +++++++++++++++++++++++++++++++++++++
 src/syntaxTreeDump.ml  | 128 ++++++++++--------
 src/syntaxTreeDump.mli |   4 +-
 src/test/Makefile      |  35 ++---
 src/test/packs.lus     |   2 +-
 src/test/test.res.exp  |  17 +++
 24 files changed, 536 insertions(+), 491 deletions(-)
 create mode 100644 src/syntaxTreeCore.ml

diff --git a/src/Makefile b/src/Makefile
index 53715590..3996b721 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -14,6 +14,7 @@ SOURCES =  \
 	./lxm.mli \
 	./lxm.ml \
 	./errors.ml \
+	./syntaxTreeCore.ml \
 	./syntaxTree.ml \
 	./parser.mly \
 	./lexer.mll \
diff --git a/src/TODO b/src/TODO
index 007d467f..c1fba1ca 100644
--- a/src/TODO
+++ b/src/TODO
@@ -1,4 +1,8 @@
 
+Question : dans syntaxTree.ml, comment marchent les by_name_op ?
+ 
+
+
 
 * autoriser le fait le pouvoir donner une valeur par defaut à une constante
  exportée. («provides const : n = 4; »)
@@ -6,7 +10,8 @@
 * LazyCompiler.do_node
 
 * lazyCompiler.ml: 
-	mettre les x_check, x_check_interface, etc, dans un module à part (?)
+	- mettre les x_check, x_check_interface, etc, dans un module à part (?)
+	- mettre node_check dans un module à part (?)
 
 * Dans les messages d'erreurs, le numero de colonne est faux à cause des tabulations
 
@@ -25,4 +30,32 @@ parce que dans lazyCompile.ml, ca s'appele "do_node" ...
 
 * implementer une option --old-style-syntax pour faire quelque chose des trucs
  du genre "[int,int]" voire meme "[int,real]" qui ne sont plus autorisé, mais à
- qui on pourrait donner du sens via des tableaux et des structures factices
\ No newline at end of file
+ qui on pourrait donner du sens via des tableaux et des structures factices
+
+* "extern", "unsafe", and "memoryless" annotations
+   
+Rajouter ces 3 mots clefs dans la syntaxe.
+   
+L'idée, c'est que par defaut, un noeud lustre est 
+	- interne (i.e., pas extern, cad défini en Lustre)
+	- safe (i.e., pas d'effet de bord)
+	- memoryfull (i.e., ils utilisent de la mémoire)
+
+
+on pourra rajouter l'alias 
+	function == extern memoryless node
+pour la compatibilité ascendente
+
+nb :  pour les noeuds «internes», on peut se passer des annotations "memoryless",
+et "unsafe" dans la mesure où on sait toujours les inferer. Mais laisser les gens 
+le mettre s'ils le veulent, ca ne mange pas de pain. 
+
+nb2 : rejeter les noeuds sans memoire (resp faisant sans l'annotation "memoryless",
+ca ne serait pas backward compatible. Mais on pourrait alors rajouter l'option 
+--infer-memoryless-annotation.
+
+
+
+
+
+	
\ No newline at end of file
diff --git a/src/compile.ml b/src/compile.ml
index 8aa14b8f..70162d01 100644
--- a/src/compile.ml
+++ b/src/compile.ml
@@ -1,9 +1,10 @@
-(** Time-stamp: <modified the 30/01/2008 (at 11:27) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:20) by Erwan Jahier> *)
 
 
 open Lxm
 open Errors
 open SyntaxTree
+open SyntaxTreeCore
 
 (* get the first package in the package/model list *)
 let rec first_pack_in =
diff --git a/src/compiledData.ml b/src/compiledData.ml
index b87f29f9..035aaa3d 100644
--- a/src/compiledData.ml
+++ b/src/compiledData.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/01/2008 (at 14:23) by Erwan Jahier> *)
+(** Time-stamp: <modified the 06/02/2008 (at 11:33) by Erwan Jahier> *)
 
 (** 
 
@@ -65,7 +65,7 @@
 	- oper_eff :
 	dénotation d'opération,
 	peut être fonction, predef ou template,
-	construit à partir de oper_exp.
+	construit à partir de node_exp.
 
 	- node_eff :
 	noeud/template + arguments statiques effectifs,
@@ -101,6 +101,7 @@
 open Printf 
 open Lxm
 open SyntaxTree
+open SyntaxTreeCore
 
 
 (*---------------------------------------------------------------------
@@ -249,7 +250,7 @@ Type : node_half_eff
 	correspond à un noeud half-checked : on conserve simplement
 	la node_info (on pourra sophistiquer plus tard)
 ----------------------------------------------------------------------*)
-and node_half_eff = SyntaxTree.node_info srcflaged
+and node_half_eff = SyntaxTreeCore.node_info srcflaged
 (*---------------------------------------------------------------------
 Type : node_eff
 -----------------------------------------------------------------------
@@ -293,13 +294,13 @@ and static_arg_eff =
 (*---------------------------------------------------------------------
 Type : oper_eff
 -----------------------------------------------------------------------
-	Version chéckée des oper_exp (expression dénotant une opération).
+	Version chéckée des node_exp (expression dénotant une opération).
 	Utilisée dans les expressions call, mais aussi comme argument statique
 	ou comme définition de noeud (alias). 
 	Union entre opérateur prédéfini, user_func_eff et node_eff
 ----------------------------------------------------------------------*)
 and oper_eff =
-    PredefOper of by_pos_op 
+    PredefOper of predef_node 
   | FuncOper of func_eff
   | NodeOper of node_eff
 (*---------------------------------------------------------------------
diff --git a/src/evalConst.ml b/src/evalConst.ml
index 02297c7d..de4a2fc6 100644
--- a/src/evalConst.ml
+++ b/src/evalConst.ml
@@ -1,10 +1,11 @@
-(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *)
+(** Time-stamp: <modified the 06/02/2008 (at 11:36) by Erwan Jahier> *)
 
 
 open Printf 
 open Lxm
 open Errors
 open SyntaxTree
+open SyntaxTreeCore
 open CompiledData
 
 (*----------------------------------------------------
@@ -45,7 +46,7 @@ op_computer :
   ou Erreur
 ----------------------------------------------------*)
 
-let op_computer (posop : by_pos_op) (src: Lxm.t)
+let op_computer (posop : predef_node) (src: Lxm.t)
     = (* retour : (const_eff list -> const_eff_list) option *)
   (
     (*----------------------------
@@ -514,7 +515,7 @@ let rec eval_const
 	-----------------------------------*)
       let rec rec_eval_const (vexp : val_exp) = (
 	match vexp with
-	    CallByPos  ({it=posop; src=lxm}, args) -> (
+	    CallByPos  ({it=posop; src=lxm}, Oper args) -> (
 	      try eval_by_pos_const posop lxm args
 	      with EvalConst_error msg ->
 		raise (Compile_error(lxm, "can't eval constant: "^msg))
@@ -535,7 +536,7 @@ let rec eval_const
 	  toutes les opérations non classiques. 
 	  -----------------------------------*)
       and eval_by_pos_const
-	  (posop : by_pos_op)   (* l'operateur *)
+	  (posop : predef_node)   (* l'operateur *)
 	  (lxm : Lxm.t)      (* source de l'opérateur *)
 	  (args : val_exp list) (* arguments *)
 	  = (
@@ -554,13 +555,13 @@ let rec eval_const
 		  (* opérateur lazzy *)
 	      | WITH_n -> (
 		  match args with
-		      [a0;a1;a2] -> (
+		       [a0;a1;a2] -> (
 			match (rec_eval_const a0) with
 			    [ Bool_const_eff true] -> rec_eval_const a1
 			  | [ Bool_const_eff false] -> rec_eval_const a2
 			  | x -> type_error x "bool"
-		      )  |
-			  _ -> raise (EvalConst_error( 
+		      )  
+		    | _ -> raise (EvalConst_error( 
 					sprintf
 					  "arity error: 3 extected instead of %d" 
 					  (List.length args)))
@@ -574,12 +575,11 @@ let rec eval_const
 			try (
 			  let sz = eval_array_size env szexp in
 			    match rec_eval_const cexp with
-				[cst] -> (
+				 [cst] -> (
 				  let atab = Array.make sz cst in	
 				    [ Array_const_eff (atab, type_of_const_eff cst) ]
 				) 
-			      |
-				x -> 
+			      | x -> 
 				 raise (EvalConst_error(
 					       "array of tuple not allowed"))
 			) with 
diff --git a/src/evalConst.mli b/src/evalConst.mli
index bde4ca41..45dcc345 100644
--- a/src/evalConst.mli
+++ b/src/evalConst.mli
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 18/12/2007 (at 14:57) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:24) by Erwan Jahier> *)
 
 (*
 
@@ -62,7 +62,8 @@ FONCTIONS DERIVEES : (permet de pr
 
 exception EvalArray_error of string
 
-val eval_const : CompiledData.id_solver -> SyntaxTree.val_exp -> CompiledData.const_eff list
+val eval_const : CompiledData.id_solver -> SyntaxTreeCore.val_exp -> 
+  CompiledData.const_eff list
 
 (**
    Rôle : calcule une taille de tableau 
@@ -76,7 +77,7 @@ val eval_const : CompiledData.id_solver -> SyntaxTree.val_exp -> CompiledData.co
 	EvalArray_error "bad array size, type int expected but get <t>" si t pas int
 	EvalArray_error "bad array size <n>" si n <= 0
 *)
-val eval_array_size : CompiledData.id_solver -> SyntaxTree.val_exp -> int
+val eval_array_size : CompiledData.id_solver -> SyntaxTreeCore.val_exp -> int
 
 (**
    Rôle :
@@ -90,7 +91,7 @@ val eval_array_size : CompiledData.id_solver -> SyntaxTree.val_exp -> int
    Effets de bord :
 	EvalArray_error msg si pas bon
 *)
-val eval_array_index : CompiledData.id_solver -> SyntaxTree.val_exp -> int -> int
+val eval_array_index : CompiledData.id_solver -> SyntaxTreeCore.val_exp -> int -> int
 
 (**
    Rôle :
@@ -108,5 +109,5 @@ val eval_array_index : CompiledData.id_solver -> SyntaxTree.val_exp -> int -> in
 	EvalArray_error msg si pas bon
 *)
 val eval_array_slice : 
-  CompiledData.id_solver -> SyntaxTree.slice_info -> int -> Lxm.t -> 
+  CompiledData.id_solver -> SyntaxTreeCore.slice_info -> int -> Lxm.t -> 
   CompiledData.slice_eff 
diff --git a/src/evalType.ml b/src/evalType.ml
index d3e76053..5dc3c29a 100644
--- a/src/evalType.ml
+++ b/src/evalType.ml
@@ -1,8 +1,9 @@
-(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:21) by Erwan Jahier> *)
 
 open Lxm
 open Errors
 open SyntaxTree
+open SyntaxTreeCore
 open CompiledData
 open EvalConst 
 
diff --git a/src/evalType.mli b/src/evalType.mli
index 78934a47..69258966 100644
--- a/src/evalType.mli
+++ b/src/evalType.mli
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 18/12/2007 (at 14:55) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:24) by Erwan Jahier> *)
 
 (*----------------------------------------------------------------------
 	module : EvalType
@@ -45,4 +45,4 @@ Effets de bord :
 ----------------------------------------------------------------------*)
 
 
-val f : CompiledData.id_solver -> SyntaxTree.type_exp -> CompiledData.type_eff
+val f : CompiledData.id_solver -> SyntaxTreeCore.type_exp -> CompiledData.type_eff
diff --git a/src/expandPack.ml b/src/expandPack.ml
index c9588af8..c249f8ca 100644
--- a/src/expandPack.ml
+++ b/src/expandPack.ml
@@ -1,7 +1,8 @@
-(** Time-stamp: <modified the 18/12/2007 (at 11:06) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:23) by Erwan Jahier> *)
 
 open Lxm
 open SyntaxTree
+open SyntaxTreeCore
 open Errors
 open SyntaxTabUtils
 
@@ -67,7 +68,7 @@ let (doit:
 		| StaticParamConst (s,te) -> (
 		    let ce = match (a.it) with
 			StaticArgIdent idr -> (
-			  SyntaxTree.leafexp a.src (IDENT_n idr) 
+			  SyntaxTreeCore.leafexp a.src (IDENT_n idr) 
 			) 
 		      |
 			  StaticArgConst x -> x
diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml
index 45c20394..85297665 100644
--- a/src/lazyCompiler.ml
+++ b/src/lazyCompiler.ml
@@ -1,9 +1,10 @@
-(** Time-stamp: <modified the 04/02/2008 (at 15:31) by Erwan Jahier> *)
+(** Time-stamp: <modified the 06/02/2008 (at 10:44) by Erwan Jahier> *)
 
 
 open Lxm
 open Errors
 open SyntaxTree
+open SyntaxTreeCore
 open CompiledData
 
 
@@ -225,14 +226,14 @@ and (solve_const_idref : t -> SymbolTab.t -> Ident.pack_name -> Ident.idref -> L
 
 
 (* now the real work! *)
-and (type_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> 
-      Ident.pack_name -> SyntaxTree.type_info srcflaged -> CompiledData.type_eff) =
+and (type_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t ->
+      Ident.pack_name -> SyntaxTreeCore.type_info srcflaged -> CompiledData.type_eff) =
   fun this type_name lxm prov_symbols pack_name type_def ->
     (* We type check the interface and the body. 
        For non-abstract types, we also check that both effective types are
        the same.  *)
     let body_type_eff = type_check this type_name lxm in
-    let prov_type_eff = 
+    let prov_type_eff =
       type_check_do this type_name lxm prov_symbols pack_name type_def
     in
       match prov_type_eff with
@@ -250,16 +251,6 @@ and (type_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t ->
 	    let prov_type_eff_body = (* rm? *)
 	      type_check_do this type_name lxm body_symbols pack_name type_def
 	    in
-	      assert (prov_type_eff_body = body_type_eff);
-	      (* R1-31/01/2008-09:49 
-		 par quelle miracle [prov_type_eff_body] pourrait être different
-		 de [body_type_eff] ???
-
-		  -> j'ai bien envie d'y virer  (cf rm plus haut)
-
-		 surtout qu'en passant par type_check_do, le calcul sera vraiment
-		 fait une deuxieme fois...
-	      *)
 	      if prov_type_eff_body = body_type_eff then
 		prov_type_eff
 	      else
@@ -272,7 +263,7 @@ and (type_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t ->
 
 
 and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> 
-      Ident.pack_name -> SyntaxTree.const_info srcflaged -> CompiledData.const_eff) =
+      Ident.pack_name -> SyntaxTreeCore.const_info srcflaged -> CompiledData.const_eff) =
   fun this cn lxm prov_symbols p const_def -> 
     let prov_const_eff = const_check_do this cn lxm prov_symbols p const_def in
     let body_const_eff = const_check this cn lxm in
@@ -302,7 +293,7 @@ and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t ->
 	      (* ougth to be catched by the syntax checking *) 
 
 and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name ->
-      SyntaxTree.type_info srcflaged -> CompiledData.type_eff) =
+      SyntaxTreeCore.type_info srcflaged -> CompiledData.type_eff) =
   fun this type_name lxm symbols pack_name type_def -> 
     try (
       (* Solveur d'idref pour les  les appels à eval_type/eval_const *)
@@ -312,6 +303,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -
       }
       in 
 	match type_def.it with
+	  | ArrayType _ -> assert false (* todo *)
 	  | ExternalType s        -> External_type_eff (Ident.make_long pack_name s)
 	  | AliasedType (s, texp) -> EvalType.f eval_env texp
 	  | EnumType (s, clst) -> (
@@ -364,7 +356,7 @@ and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -
 	)
 
 and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> 
-      SyntaxTree.const_info srcflaged -> CompiledData.const_eff) =
+      SyntaxTreeCore.const_info srcflaged -> CompiledData.const_eff) =
   fun this cn lxm symbols currpack const_def ->
     (* [cn] and [lxm] are used for recursion errors. 
        [symbols] is the current symbol table.
@@ -423,12 +415,12 @@ and (const_check_do : t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name
 (******************************************************************************)
 
 let (node_check_interface_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t -> 
-      Ident.pack_name -> SyntaxTree.oper_info srcflaged -> CompiledData.node_eff) =
+      Ident.pack_name -> SyntaxTreeCore.oper_info srcflaged -> CompiledData.node_eff) =
   fun this nk lxm symbols pack_name node_def ->
     assert false
 
 let (node_check_do: t -> CompiledData.node_key -> Lxm.t -> SymbolTab.t -> 
-      Ident.pack_name -> SyntaxTree.oper_info srcflaged -> CompiledData.node_eff) =
+      Ident.pack_name -> SyntaxTreeCore.oper_info srcflaged -> CompiledData.node_eff) =
   fun this nk lxm symbols pack_name node_def ->
     (* 
        checker un noeud = 
diff --git a/src/lxm.ml b/src/lxm.ml
index 4c1908cd..0e70da71 100644
--- a/src/lxm.ml
+++ b/src/lxm.ml
@@ -1,7 +1,7 @@
-(*
-Un module au dessus de lexer et parser
-pour éviter les dépendances bouclées
-*)
+(** Time-stamp: <modified the 05/02/2008 (at 11:44) by Erwan Jahier> *)
+
+(** Common to lus2lic and lic2loc  *)
+
 
 (* pour calculer line/col *)
 let line_num = ref 1
@@ -24,7 +24,6 @@ type t = {
 
 let str x = (x._str)
 let id x = (Ident.of_string x._str)
-let pack_name x = (Ident.pack_name_of_string x._str)
 let line x = (x._line)
 let cstart x = (x._cstart)
 let cend x = (x._cend)
diff --git a/src/lxm.mli b/src/lxm.mli
index dfe1545c..5247041f 100644
--- a/src/lxm.mli
+++ b/src/lxm.mli
@@ -1,54 +1,49 @@
-(** Time-stamp: <modified the 30/01/2008 (at 16:18) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 12:01) by Erwan Jahier> *)
 
-(*
-Un module au dessus de lexer et parser
-pour éviter les dépendances bouclées
-*)
+(** Common to lus2lic and lic2loc  *)
 
+(** Lexeme  *)
 
 type t
 
+val dummy : t
+
+val str    : t -> string
+val id     : t -> Ident.t
+val line   : t -> int 
 
-val str : t -> string
-val id : t -> Ident.t
-val pack_name : t -> Ident.pack_name
-val line : t -> int 
+(** column numbers *)
 val cstart : t -> int
-val cend : t -> int
+val cend   : t -> int
 
 
-(**-----------------------------*)
-(** Interface avec lexer/parser *)
-(**-----------------------------*)
+(** lexer/parser interface
+    
+    In order to able to compute line and colums numbers, 
+    the lexer is supposed to:
+    - use Lxm.make to return a lexeme to the parser
+    - use newline to add a new line 
+*)
+val make     : Lexing.lexbuf -> t
+val new_line : Lexing.lexbuf -> unit
 
-(** Le lexer doit impérativement : *)
-(** - utiliser make pour rendre un lexeme au parser *)
-val make : Lexing.lexbuf -> t
 
-(** - appeler new_line sur chaque \n pour permettre
-      la numérotation ligne/colonnes *)
-val new_line : Lexing.lexbuf -> unit
 
-(**-------------------------------*)
-(** Interface avec le compilateur *)
-(**-------------------------------*)
+(** compiler interface *)
 
-(** Atache une info source à n'importe quoi *)
+(** used to attach a source information to a lexeme *)
 type 'a srcflaged = { src : t ; it  : 'a }
-val flagit : 'a -> t -> 'a srcflaged
 
-(** Un lexeme bibon au cas où ... *)
-val dummy : t
+val flagit : 'a -> t -> 'a srcflaged
 
-(** Renvoie le dernier lexème créé (et traité),
-    Utile pour situer les erreurs de syntaxe *)
+(** Returns the last created lexem. Useful to locate syntax errors. *)
 val last_made : unit -> t
 
-(** Affichage standard pour erreur/warning *)
+(** Erreur/Warning printing *)
 
-(** style : 'machin' (line:10, col:3 to 7) *)
 val details : t -> string
+(** prints something like: 'machin' (line:10, col:3 to 7) *)
 
-(** style : line:10, col:3 to 7 *)
 val position : t -> string
+(** prints something like: line:10, col:3 to 7 *)
 
diff --git a/src/main.ml b/src/main.ml
index 0ca65e2c..e9f92efd 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/01/2008 (at 16:20) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:21) by Erwan Jahier> *)
 
 (** Here follows a description of the different modules used by this lus2lic compiler.
 
@@ -43,6 +43,7 @@ Some misc (eponymous) modules are used along the way.
 
 open Verbose
 open SyntaxTree
+open SyntaxTreeCore
 open Lxm
 open Errors
 open Parsing
@@ -177,8 +178,8 @@ let main = (
 	|  _ -> (
 	     (* Compile.compile (pkg_load lexbuf) _lus2lic_ARGS.main_node  *)
 	     let nsl = get_source_list _lus2lic_ARGS.infile lexbuf in
-	     let nodidf = Ident.idref_of_string _lus2lic_ARGS.main_node in
-	       Compile.doit nsl nodidf 
+	     let main_node = Ident.idref_of_string _lus2lic_ARGS.main_node in
+	       Compile.doit nsl main_node 
 	   )
   ) with
       Sys_error(s) ->
diff --git a/src/parser.mly b/src/parser.mly
index afad10c4..1a65bb7b 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -1,6 +1,7 @@
 %{
 open Lxm
 open SyntaxTree
+open SyntaxTreeCore
 
 (* les var locales pour ranger les resultat intermédaire *)
 let const_table = Hashtbl.create 50 
@@ -31,7 +32,7 @@ let (lexeme_to_ident_flagged:Lxm.t -> Ident.t Lxm.srcflaged) =
   fun x -> {it = (Lxm.id x); src = x }
 
 let (lexeme_to_pack_name_flagged:Lxm.t -> Ident.pack_name  Lxm.srcflaged) = 
-  fun x -> {it = (Lxm.pack_name x); src = x }
+  fun x -> {it = (Ident.pack_name_of_string (Lxm.str x)); src = x }
 
 
 (* Listes d'idents typés et (éventuellement) valués *)
@@ -267,7 +268,7 @@ let treat_node_alias
 	(nlxm:   Lxm.t)          (* le lexeme du nom du noeud *)
 	(statics: static_param srcflaged list) (* les params statiques formel *)
 	(dyn: node_profile option) (* l'eventuel profil dyn *)
-	(value: oper_exp srcflaged)   (* la valeur *)
+	(value: node_exp srcflaged)   (* la valeur *)
 =
 (
 	let nstr = Lxm.id nlxm in
@@ -554,7 +555,7 @@ sxModelDecl:
 	TK_END
 	{
 		let mdecl = {
-			mo_name = (Lxm.pack_name $2);
+			mo_name = (Ident.pack_name_of_string (Lxm.str $2));
 			mo_uses = $3 ;
 			mo_needs = (List.rev $5) ;
 			mo_provides = $7 ;
@@ -579,7 +580,7 @@ sxPackDecl:
 			pg_body = $6;
 		} in	
 		let pdecl = {
-			pa_name = (Lxm.pack_name $2);
+			pa_name = (Ident.pack_name_of_string (Lxm.str $2));
 			pa_def = pdef;
 		} in
 		{it = pdecl; src = $2 }
@@ -618,7 +619,7 @@ sxPackEq:
 			pi_args = (List.rev $6);
 		} in
 		let pa = {
-			pa_name = (Lxm.pack_name $2);
+			pa_name = (Ident.pack_name_of_string (Lxm.str $2));
 			pa_def = pdef;
 		} in
 		{it = pa; src = $2 }
@@ -1052,7 +1053,7 @@ sxExpression:
 			{ naryexp $1 DIESE_n (List.rev $3) }
 	|  TK_NOR TK_OPEN_PAR sxExpressionList TK_CLOSE_PAR
 			{ naryexp $1 NOR_n (List.rev $3) }
-	|	sxCallByPosExpression 
+	| sxCallByPosExpression 
 			{ $1 }
 	|  TK_OPEN_PAR sxExpList2 TK_CLOSE_PAR
 			{ naryexp $1 TUPLE_n (List.rev $2) }
@@ -1150,25 +1151,21 @@ sxStaticArgList:
 	  */
 	    sxStaticArg:
 	  /* nature explicite */
-	    TK_TYPE sxType 
+	| TK_TYPE sxType 
 	    { {src=$1 ; it=StaticArgType $2 } }
-	|	TK_CONST sxExpression
+	| TK_CONST sxExpression
 	    { {src=$1 ; it=StaticArgConst $2 } }
-	|	TK_NODE sxEffectiveNode
+	| TK_NODE sxEffectiveNode
 	    { {src=$1 ; it=StaticArgNode $2.it } }
 	  /* un ident OU une expression simple (à résoudre) */
 	  /* c'est au retour qu'on choisit */
-	|	sxSimpleExp
+	| sxSimpleExp
 	    {
 	      match $1 with 
-		  CallByPos (op, x) -> (
+		| CallByPos (op, x) -> (
 		    match op.it with
-			IDENT_n idref -> (
-			  {src=op.src ; it = StaticArgIdent idref }
-			)|
-			    _ -> (
-			      {src=op.src ; it=StaticArgConst $1}
-			    )
+		      | IDENT_n idref -> {src=op.src ; it = StaticArgIdent idref }
+		      | _ ->  {src=op.src ; it=StaticArgConst $1}
 		  ) 
 		| _ -> 
 		    print_string "*** unexpected static argument\n";
diff --git a/src/symbolTab.ml b/src/symbolTab.ml
index e70bca2a..6e5809d0 100644
--- a/src/symbolTab.ml
+++ b/src/symbolTab.ml
@@ -1,10 +1,11 @@
-(** Time-stamp: <modified the 30/01/2008 (at 09:44) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:21) by Erwan Jahier> *)
 
 (*
 Sous-module pour SyntaxTab 
 *)
 open Lxm
 open SyntaxTree
+open SyntaxTreeCore
 open Errors
 
 type 'a hereflaged =
diff --git a/src/symbolTab.mli b/src/symbolTab.mli
index b3dfd390..00b13b59 100644
--- a/src/symbolTab.mli
+++ b/src/symbolTab.mli
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/01/2008 (at 09:53) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 11:23) by Erwan Jahier> *)
 
 (**********************************************************
 Sous-module pour SyntaxTab 
@@ -24,28 +24,28 @@ val create : unit -> t
 (* Manip de SymbolTab.t *)
 
 (* Recherche d'items *)
-val find_type : t -> Ident.t -> (SyntaxTree.type_info Lxm.srcflaged) hereflaged
-val find_const : t -> Ident.t -> (SyntaxTree.const_info Lxm.srcflaged) hereflaged
-val find_oper : t -> Ident.t -> (SyntaxTree.oper_info Lxm.srcflaged) hereflaged
+val find_type :  t -> Ident.t -> (SyntaxTreeCore.type_info  Lxm.srcflaged) hereflaged
+val find_const : t -> Ident.t -> (SyntaxTreeCore.const_info Lxm.srcflaged) hereflaged
+val find_oper :  t -> Ident.t -> (SyntaxTreeCore.oper_info  Lxm.srcflaged) hereflaged
 
 (* Ajout de nom d'item importés (via uses) *)
 val add_import_const : t -> Ident.t -> Ident.long -> unit
-val add_import_type : t -> Ident.t -> Ident.long -> unit
-val add_import_oper : t -> Ident.t -> Ident.long -> unit
+val add_import_type  : t -> Ident.t -> Ident.long -> unit
+val add_import_oper  : t -> Ident.t -> Ident.long -> unit
 
 (** Add local items declaration *)
-val add_type : t -> Ident.t -> SyntaxTree.type_info  Lxm.srcflaged -> unit
-val add_const : t -> Ident.t -> SyntaxTree.const_info  Lxm.srcflaged -> unit
-val add_oper : t -> Ident.t -> SyntaxTree.oper_info  Lxm.srcflaged -> unit
+val add_type : t -> Ident.t -> SyntaxTreeCore.type_info  Lxm.srcflaged -> unit
+val add_const : t -> Ident.t -> SyntaxTreeCore.const_info  Lxm.srcflaged -> unit
+val add_oper : t -> Ident.t -> SyntaxTreeCore.oper_info  Lxm.srcflaged -> unit
 
 (* Itérer sur les items *)
 
 val iter_types : 
-  t -> (Ident.t -> (SyntaxTree.type_info Lxm.srcflaged) hereflaged -> unit) -> unit
+  t -> (Ident.t -> (SyntaxTreeCore.type_info Lxm.srcflaged) hereflaged -> unit) -> unit
 val iter_consts : 
-  t -> (Ident.t -> (SyntaxTree.const_info Lxm.srcflaged) hereflaged -> unit) -> unit
+  t -> (Ident.t -> (SyntaxTreeCore.const_info Lxm.srcflaged) hereflaged -> unit) -> unit
 val iter_opers : 
-  t -> (Ident.t -> (SyntaxTree.oper_info Lxm.srcflaged) hereflaged -> unit) -> unit
+  t -> (Ident.t -> (SyntaxTreeCore.oper_info Lxm.srcflaged) hereflaged -> unit) -> unit
 
 val dump : t -> unit
 
diff --git a/src/syntaxTab.ml b/src/syntaxTab.ml
index 7bd1df14..2f7d3313 100644
--- a/src/syntaxTab.ml
+++ b/src/syntaxTab.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/01/2008 (at 10:44) by Erwan Jahier> *)
+(** Time-stamp: <modified the 05/02/2008 (at 15:16) by Erwan Jahier> *)
 
 (** 
     Table des infos sources : une couche au dessus de SyntaxTree pour mieux
@@ -22,6 +22,7 @@
 
 open Lxm
 open SyntaxTree
+open SyntaxTreeCore
 open Errors
 open SyntaxTabUtils
 
@@ -55,7 +56,7 @@ type pack_mng = {
   pm_actual_src : SyntaxTree.pack_given;
   (* table "brute" des items provided *)
   (* pour les "user" du pack *)
-  pm_user_items : (SyntaxTree.item_ident, Ident.long Lxm.srcflaged) Hashtbl.t;
+  pm_user_items : (SyntaxTreeCore.item_ident, Ident.long Lxm.srcflaged) Hashtbl.t;
   (* les tables de symboles pour compil ultérieure *)
   pm_body_stab : SymbolTab.t;
   (* la table pour provide n'est créée que si besoin ... *)
@@ -108,11 +109,11 @@ let (pack_prov_env: t -> Ident.pack_name -> SymbolTab.t option) =
 init de la table des items provided (pour les users)
 ****************************************************************************)
 let init_user_items (this: pack_mng) = (
-  let pname = Lxm.pack_name this.pm_lxm in
+  let pname = Ident.pack_name_of_string (Lxm.str this.pm_lxm) in
     (* EXPORTATION D'UNE const_info *)
   let export_const
       (s:Ident.t)
-      (xci: SyntaxTree.const_info srcflaged)
+      (xci: SyntaxTreeCore.const_info srcflaged)
       = (
 	Verbose.printf "       export const %s\n" (Ident.to_string s);
 	put_in_tab "const" this.pm_user_items
@@ -123,7 +124,7 @@ let init_user_items (this: pack_mng) = (
     (* EXPORTATION D'UN type_info *)
   let export_type
       (s: Ident.t)
-      (xti: SyntaxTree.type_info srcflaged)
+      (xti: SyntaxTreeCore.type_info srcflaged)
       = 
     ( match (xti.it) with
 	  EnumType (_, ecl) -> (
@@ -141,7 +142,9 @@ let init_user_items (this: pack_mng) = (
 	  )
 	| ExternalType _
 	| AliasedType _ 
-	| StructType _ -> ()
+	| StructType _ 
+	| ArrayType _ 
+	  -> ()
     );
     
     Verbose.printf "       export type %s\n" (Ident.to_string s);
@@ -152,7 +155,7 @@ let init_user_items (this: pack_mng) = (
     (* EXPORTATION D'UN oper_info *)
   let export_oper
       (s: Ident.t)
-      (xoi: SyntaxTree.oper_info srcflaged)
+      (xoi: SyntaxTreeCore.oper_info srcflaged)
       = (
 	Verbose.printf "       export oper %s\n" (Ident.to_string s);
 	put_in_tab "oper" this.pm_user_items
@@ -264,7 +267,7 @@ init_raw_tabs (this : t) (sl : SyntaxTree.pack_or_model list) =
 	  (* cas d'un package *)
 	| SyntaxTree.NSPack  pi ->
 	    let lxm = pi.Lxm.src in
-	    let nme = (Lxm.pack_name lxm) in
+	    let nme = (Ident.pack_name_of_string (Lxm.str lxm)) in
 	      put_in_tab "package" this.st_raw_pack_tab nme pi
 	   	
 	| SyntaxTree.NSModel mi -> (* cas d'un modele *)
@@ -308,7 +311,7 @@ init_pack_mng_stabs (this: t) (pname: Ident.pack_name) (pm: pack_mng) = (
 	raise(Compile_error(lxm, "unknown package"))
       ) in
       let fill_used_item
-	  (ii: SyntaxTree.item_ident)
+	  (ii: SyntaxTreeCore.item_ident)
 	  (iks: Ident.long Lxm.srcflaged) =
 	(
 	  match ii with
@@ -368,7 +371,7 @@ init_pack_mng_stabs (this: t) (pname: Ident.pack_name) (pm: pack_mng) = (
 (****************************************************************************
 Associations :
 --------------
-- Ident.t -> Ident.long * SyntaxTree.xxxx_info
+- Ident.t -> Ident.long * SyntaxTreeCore.xxxx_info
 
 ****************************************************************************)
 
diff --git a/src/syntaxTree.ml b/src/syntaxTree.ml
index 38176514..6b23d0c0 100644
--- a/src/syntaxTree.ml
+++ b/src/syntaxTree.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 30/01/2008 (at 09:58) by Erwan Jahier> *)
+(** Time-stamp: <modified the 06/02/2008 (at 10:59) by Erwan Jahier> *)
 
 
 (** (Raw) Abstract syntax tree of source programs. 
@@ -9,7 +9,7 @@
 open Printf
 open Lxm  (* pour la remontée au source *)
 open Errors
-
+open SyntaxTreeCore
 
 (**********************************************)
 (** Constructeur de type "avec erreur info"   *)
@@ -20,9 +20,8 @@ type 'a error  =
   | Error of string
 
 
-(*****************************************)
-(* résultat brut de l'analyse syntaxique *)
-(*****************************************)
+
+(**********************************************************************************)
 type t = 
     PRPackBody of packbody
   | PRPack_or_models of pack_or_model list
@@ -71,251 +70,6 @@ and
     pk_oper_table  : (Ident.t, oper_info  srcflaged ) Hashtbl.t ;
     pk_def_list    : item_ident list ; 
   }
-and
-  item_ident
-  =
-    (** La liste des items permet (uniquement ?)  de retrouver
-	l'ordre de définitions *)
-    ConstItem of Ident.t
-  | TypeItem  of Ident.t
-  | OperItem  of Ident.t
-and
-  item_info =
-    ConstInfo of const_info
-  | TypeInfo  of type_info
-  | OperInfo  of oper_info
-and
-  (**************************************************)
-  (** Info associée à un identificateur de constante *)
-  (**************************************************)
-  const_info = 
-    ExternalConst  of (Ident.t * type_exp)
-  | EnumConst      of (Ident.t * type_exp)
-  | DefinedConst   of (Ident.t * type_exp option * val_exp)
-and
-  (**************************************************)
-  (** Info associée à un identificateur de type *)
-  (**************************************************)
-  type_info =
-    ExternalType of (Ident.t)
-  | AliasedType  of (Ident.t * type_exp)
-  | EnumType     of (Ident.t * Ident.t srcflaged list)
-	  (* Pour les struct, on a un type un peu plus complexe *)
-  | StructType   of struct_type_info
-and
-  (***************************************************)
-  (* Type structure                                  *)
-  (***************************************************)
-  (** Info de type structure                         *)
-  (* On garde :                                      *)
-  (* - la liste des noms de champ                    *)
-  (* - une table d'info de champ                     *)
-  (***************************************************)
-  struct_type_info = {
-    st_name : Ident.t ;
-    st_flist : Ident.t list ;
-    st_ftable  : (Ident.t, field_info srcflaged)  Hashtbl.t 
-  }
-and field_info = {
-  fd_name  : Ident.t ;
-  fd_type  : type_exp ;
-  fd_value : val_exp option
-}
-and
-  (************************************************************)
-  (** Type "immédiat" : type les flots, params, constantes etc *) 
-  (* N.B. : toujours srcflaged, soit par le lexeme de l'ident *)
-  (* soit sur l'opérateur ^ des tableaux                      *) 
-  (************************************************************)
-  type_exp = type_exp_core srcflaged
-and
-  type_exp_core =
-    Bool_type_exp
-  | Int_type_exp
-  | Real_type_exp
-  | Named_type_exp  of Ident.idref 
-  | Array_type_exp  of (type_exp * val_exp)
-and
-  (*************************************************)
-  (** Info associée à un identificateur d'operateur *)
-  (** - Soit un node, soit une fonction externe     *)
-  (*************************************************)
-  oper_info =
-    Node  of node_info
-  | Func  of func_info
-and
-  (*************************************************)
-  (** Info associée à un identificateur de fonction *)
-  (*************************************************)
-  func_info = {
-    fn_name    : Ident.t ;
-    fn_inpars  : (Ident.t option * type_exp) list ;
-    fn_outpars : (Ident.t option * type_exp) list
-  }
-and
-  (**********************************************)
-  (** Info associée à un identificateur de noeud *)
-  (** Soit une def complete, soit un alias       *)
-  (**********************************************)
-  node_info = {
-    ni_name       : Ident.t ;
-    ni_staticlist : static_param srcflaged list ;
-    ni_value : node_def
-  }
-and node_profile = (var_info srcflaged list * var_info srcflaged list)
-and node_def =
-    NodeExtern of node_profile
-  | NodeBody  of node_body
-  | NodeAlias of node_profile option * oper_exp srcflaged
-	  (**********************************************)
-	  (* Pour une def complete, on garde :          *)
-	  (* - une table des variables avec src_info    *)
-	  (* - une liste des noms de vars pour chaque   *)
-	  (* sorte de var                               *)
-	  (**********************************************)
-and node_body = {
-  nbdy_inlist  :   Ident.t list ;
-  nbdy_outlist :   Ident.t list ;
-  nbdy_loclist :   Ident.t list ;
-  nbdy_vartable:   var_info_table ;
-  nbdy_asserts :   (val_exp srcflaged) list ;
-  nbdy_eqs     :   (eq_info srcflaged) list
-}
-and var_info_table = (Ident.t, var_info srcflaged)  Hashtbl.t
-and static_param =
-    StaticParamType  of Ident.t
-  | StaticParamConst of (Ident.t * type_exp)
-  | StaticParamNode  of (Ident.t * var_info srcflaged list * var_info srcflaged list)
-and var_info = {
-  va_nature : var_nature;
-  va_name   : Ident.t;
-  va_type   : type_exp;
-  va_clock  : clock_exp 
-}
-and var_nature =
-    VarInput
-  | VarOutput
-  | VarLocal
-and eq_info = {
-  eq_left : left_part list ;
-  eq_right: val_exp
-}
-    (* Information d'horloge pour les variables de noeud *)
-and clock_exp =
-    BaseClock
-  | NamedClock of Ident.t srcflaged
-and left_part = 
-    (* tous les acces en partie gauche sont flagés *)
-    LeftVar of (Ident.t srcflaged)
-  | LeftField of (left_part * (Ident.t srcflaged))
-  | LeftArray of (left_part * (val_exp srcflaged))  
-  | LeftSlice of (left_part * (slice_info srcflaged))
-and slice_info = {
-  si_first : val_exp ;
-  si_last  : val_exp ;
-  si_step  : val_exp option ;
-}
-
-(************************************************)
-(* Info associées aux expressions               *)
-(************************************************)
-(* Vision "fonctionnelle" des val_exp :         *)
-(* Une exp. est une application d'operation :   *)
-(* - avec passage par position, auquel cas les  *)
-(* opérandes sont des val_exp                   *)
-(* - avec passage par nom, auquel cas les       *)
-(* opérandes sont des Ident.t * val_exp          *)
-(************************************************)
-and val_exp =
-    CallByPos  of (by_pos_op  srcflaged  * val_exp list) 
-  | CallByName of (by_name_op srcflaged  * (Ident.t srcflaged * val_exp) list)
-   
-	  (* Toutes les opérations classiques *)
-and by_pos_op =
-    (* zeroaire *)
-    NULL_exp
-  | TRUE_n
-  | FALSE_n
-  | ICONST_n of Ident.t
-  | RCONST_n of Ident.t
-  | IDENT_n  of Ident.idref
-	  (* unaires *)
-  | NOT_n
-  | UMINUS_n
-  | PRE_n
-  | CURRENT_n
-  | REAL2INT_n
-  | INT2REAL_n
-      (* binaires *)
-  | ARROW_n
-  | FBY_n
-  | WHEN_n
-  | AND_n
-  | OR_n
-  | XOR_n
-  | IMPL_n
-  | EQ_n
-  | NEQ_n
-  | LT_n
-  | LTE_n
-  | GT_n
-  | GTE_n
-  | DIV_n
-  | MOD_n
-  | MINUS_n
-  | PLUS_n
-  | SLASH_n
-  | TIMES_n
-  | POWER_n
-  | HAT_n
-  | CONCAT_n
-      (* ternaires *)
-  | IF_n
-  | WITH_n
-      (* n-aires *)
-  | NOR_n
-  | DIESE_n
-  | TUPLE_n
-  | ARRAY_n
-      (************************************************)
-      (* Info associées aux expressions  (suite)      *)
-      (************************************************)
-      (* pseudo-unaire : A USAGE INTERNE *)
-      (* projection de tuple             *)
-  | PROJ_n of int
-      (* pseudo-unaire : appel par position *)
-  | CALL_n of oper_exp srcflaged
-      (* pseudo-unaire : acces tableau *)
-  | ARRAY_ACCES_n of val_exp
-  | ARRAY_SLICE_n of slice_info
-      (* pseudo-unaire : acces structure *)
-  | STRUCT_ACCESS_n    of Ident.t
-      (* Opération avec passage de param par nom *)
-
-(*   | MERGE_n of Ident.t * ((Ident.t * val_exp) list) *)
-      
-
-and by_name_op =
-    BYNAME_CALL_n of Ident.idref
-      (* structure non typée *)
-  | STRUCT_EXP_n
-      (* Descripteur d'operateur call *)
-and oper_exp =
-    CallPreDef of by_pos_op
-  | CallUsrDef of (Ident.idref * static_arg srcflaged list)
-	  (*
-	    Params statiques effectifs :
-	    - val_exp (pour les constantes)
-	    - type_exp (pour les types)
-	    - oper_exp (pour les node)
-	    - ident : a résoudre, peut etre const, type ou node 
-	  *)
-and static_arg =
-    StaticArgIdent of Ident.idref
-  | StaticArgConst of val_exp
-  | StaticArgType  of type_exp
-  | StaticArgNode  of oper_exp
-
 
 
 (**********************************************
@@ -332,33 +86,6 @@ let give_pack_this_name nme pbdy = (
    }
 )
 
-(**********************************************
-Utilitaires pour fabriquer des val_exp
-**********************************************)
-
-let leafexp lxm op = (
-  CallByPos ( {src = lxm ; it = op } , [] )	
-) 
-
-let unexp lxm op e1 = (
-  CallByPos ( {src = lxm ; it = op } , [e1] )	
-) 
-
-let binexp lxm op e1 e2 = (
-  CallByPos ( {src = lxm ; it = op } , [e1 ; e2] )	
-) 
-
-let ternexp lxm op e1 e2 e3 = (
-  CallByPos ( {src = lxm ; it = op } , [e1 ; e2; e3] )	
-) 
-
-let naryexp lxm op elst = (
-  CallByPos ( {src = lxm ; it = op } , elst )	
-) 
-
-let bynameexp lxm op nelst = (
-  CallByName ( {src = lxm ; it = op } , nelst )	
-) 
 
 (*----------------------------------------------------------------------------*)
 (*                      INTERFACE AVEC LE PARSER                              *)
@@ -410,8 +137,8 @@ let add_info
 	Hashtbl.add htbl (Lxm.id lxm) { src = lxm ; it  = info }
       )
     )
+
 (*---------------------------------------------------------------------
-lexeme_of_val_exp
 lexeme_of_left_part
 -----------------------------------------------------------------------
 Rôle : retourne le lexeme ``principal'' d'une expression/d'un 
@@ -422,9 +149,6 @@ Sorties : Lxm.t
 
 Effets de bord :
 ----------------------------------------------------------------------*)
-let lexeme_of_val_exp = function
-    CallByPos  (opflaged, args) -> opflaged.src
-  | CallByName (opflaged, args) -> opflaged.src
 
 let rec lexeme_of_left_part = function
   | LeftVar sflg -> sflg.src
@@ -433,12 +157,6 @@ let rec lexeme_of_left_part = function
   | LeftSlice (x, _) -> lexeme_of_left_part x
 	  
 
-let lexeme_of_pack_or_model = (
-  function 
-      NSPack p -> p.src
-    | NSModel m -> m.src
-)
-
 (********************************************)
 let (pack_or_model_to_string: pack_or_model -> string) =
   function
diff --git a/src/syntaxTreeCore.ml b/src/syntaxTreeCore.ml
new file mode 100644
index 00000000..faaa5658
--- /dev/null
+++ b/src/syntaxTreeCore.ml
@@ -0,0 +1,270 @@
+(** Time-stamp: <modified the 06/02/2008 (at 11:42) by Erwan Jahier> *)
+
+
+(** (Raw) Abstract syntax tree of source programs. *)
+
+open Lxm
+
+
+(**********************************************************************************)
+type clock_exp =
+  | BaseClock
+  | NamedClock of Ident.t srcflaged
+
+(**********************************************************************************)
+(** [type_exp] is used to type flow, parameters, constants. *)
+type type_exp = type_exp_core srcflaged
+and
+  type_exp_core =
+  | Bool_type_exp
+  | Int_type_exp
+  | Real_type_exp
+  | Named_type_exp of Ident.idref 
+  | Array_type_exp of (type_exp * val_exp)
+and
+  (**************************************************)
+  (** Info associée à un identificateur d'operateur *)
+  (** - Soit un node, soit une fonction externe     *)
+  (**************************************************)
+  oper_info =
+  | Node  of node_info
+  | Func  of func_info
+and
+  (*************************************************)
+  (** Info associée à un identificateur de fonction *)
+  (*************************************************)
+  func_info = {
+    fn_name    : Ident.t ;
+    fn_inpars  : (Ident.t option * type_exp) list ;
+    fn_outpars : (Ident.t option * type_exp) list
+  }
+and
+  (**********************************************)
+  (** Info associée à un identificateur de noeud *)
+  (** Soit une def complete, soit un alias       *)
+  (**********************************************)
+  node_info = {
+    ni_name       : Ident.t ;
+    ni_staticlist : static_param srcflaged list ;
+    ni_value      : node_def
+  }
+and static_param =
+    StaticParamType  of Ident.t
+  | StaticParamConst of (Ident.t * type_exp)
+  | StaticParamNode  of (Ident.t * var_info srcflaged list * var_info srcflaged list)
+
+and node_profile = (var_info srcflaged list * var_info srcflaged list)
+and node_def =
+  | NodeExtern of node_profile
+  | NodeBody   of node_body
+  | NodeAlias  of node_profile option * node_exp srcflaged
+	  (**********************************************)
+	  (* Pour une def complete, on garde :          *)
+	  (* - une table des variables avec src_info    *)
+	  (* - une liste des noms de vars pour chaque   *)
+	  (* sorte de var                               *)
+	  (**********************************************)
+and node_body = {
+  nbdy_inlist  : Ident.t list;
+  nbdy_outlist : Ident.t list;
+  nbdy_loclist : Ident.t list;
+  nbdy_vartable: var_info_table;
+  nbdy_asserts : (val_exp srcflaged) list;
+  nbdy_eqs     : (eq_info srcflaged) list
+}
+and var_info_table = (Ident.t, var_info srcflaged) Hashtbl.t
+and var_info = {
+  va_nature : var_nature;
+  va_name   : Ident.t;
+  va_type   : type_exp;
+  va_clock  : clock_exp 
+}
+and var_nature =
+  | VarInput
+  | VarOutput
+  | VarLocal
+
+and eq_info = {
+  eq_left : left_part list ;
+  eq_right: val_exp
+}
+and left_part = 
+  | LeftVar of (Ident.t srcflaged)
+  | LeftField of (left_part * (Ident.t srcflaged))
+  | LeftArray of (left_part * (val_exp srcflaged))  
+  | LeftSlice of (left_part * (slice_info srcflaged))
+and slice_info = {
+  si_first : val_exp ;
+  si_last  : val_exp ;
+  si_step  : val_exp option ;
+}
+
+(* predef_node = operator *)
+and predef_node =
+(* zeroaire *)
+    NULL_exp
+  | TRUE_n
+  | FALSE_n
+  | ICONST_n of Ident.t
+  | RCONST_n of Ident.t
+  | IDENT_n  of Ident.idref
+(* unaires *)
+  | NOT_n
+  | UMINUS_n
+  | PRE_n
+  | CURRENT_n
+  | REAL2INT_n
+  | INT2REAL_n
+(* binaires *)
+  | ARROW_n
+  | FBY_n
+  | WHEN_n
+  | AND_n
+  | OR_n
+  | XOR_n
+  | IMPL_n
+  | EQ_n
+  | NEQ_n
+  | LT_n
+  | LTE_n
+  | GT_n
+  | GTE_n
+  | DIV_n
+  | MOD_n
+  | MINUS_n
+  | PLUS_n
+  | SLASH_n
+  | TIMES_n
+  | POWER_n
+  | HAT_n
+  | CONCAT_n
+(* ternaires *)
+  | IF_n
+  | WITH_n
+(* n-aires *)
+  | NOR_n
+  | DIESE_n
+  | TUPLE_n
+  | ARRAY_n
+      (************************************************)
+      (* Info associées aux expressions  (suite)      *)
+      (************************************************)
+      (* pseudo-unaire : A USAGE INTERNE *)
+      (* projection de tuple             *)
+  | PROJ_n of int
+      (* pseudo-unaire : appel par position *)
+  | CALL_n of node_exp srcflaged
+      (* pseudo-unaire : acces tableau *)
+
+  | ARRAY_ACCES_n of val_exp
+  | ARRAY_SLICE_n of slice_info
+      (* pseudo-unaire : acces structure *)
+
+  | STRUCT_ACCESS_n    of Ident.t
+  | STRUCT_n of (Ident.t * Ident.t list)
+      (** name of the struture + field name list *)
+
+  | MERGE_n of (Ident.t * (Ident.t list))
+  
+  | ITERATOR_n of (Ident.t * Ident.t * val_exp)
+      (** iterator name, node ident, array size *)
+
+(************************************************)
+(* Info associées aux expressions               *)
+(************************************************)
+(* Vision "fonctionnelle" des val_exp :         *)
+(* Une exp. est une application d'operation :   *)
+(* - avec passage par position, auquel cas les  *)
+(* opérandes sont des val_exp                   *)
+(* - avec passage par nom, auquel cas les       *)
+(* opérandes sont des Ident.t * val_exp         *)
+(************************************************)
+(* and val_exp = predef_node srcflaged * operands *)
+
+and val_exp = 
+  | CallByPos  of (predef_node  srcflaged  * operands) 
+  | CallByName of (by_name_op srcflaged  * (Ident.t srcflaged * val_exp) list)
+   
+and operands = Oper of val_exp list
+
+	  (* Toutes les opérations classiques *)
+
+and by_name_op =
+    BYNAME_CALL_n of Ident.idref
+      (* structure non typée *)
+  | STRUCT_EXP_n
+      (* Descripteur d'operateur call *)
+
+and node_exp =
+  | CallPreDef of predef_node
+  | CallUsrDef of (Ident.idref * static_arg srcflaged list)
+	  (*
+	    Params statiques effectifs :
+	    - val_exp (pour les constantes)
+	    - type_exp (pour les types)
+	    - node_exp (pour les node)
+	    - ident : a résoudre, peut etre const, type ou node 
+	  *)
+and static_arg =
+  | StaticArgIdent of Ident.idref
+  | StaticArgConst of val_exp
+  | StaticArgType  of type_exp
+  | StaticArgNode  of node_exp
+
+
+(**********************************************************************************)
+
+(** constant *)
+
+type const_info = 
+  | ExternalConst  of (Ident.t * type_exp)
+  | EnumConst      of (Ident.t * type_exp)
+  | DefinedConst   of (Ident.t * type_exp option * val_exp)
+
+(** Type *)
+
+type field_info = {
+  fd_name  : Ident.t ;
+  fd_type  : type_exp ;
+  fd_value : val_exp option
+}
+type struct_type_info = {
+  st_name    : Ident.t ;
+  st_flist   : Ident.t list; (* field name list *)
+  st_ftable  : (Ident.t, field_info srcflaged)  Hashtbl.t 
+}
+type type_info =
+  | ExternalType of (Ident.t)
+  | AliasedType  of (Ident.t * type_exp)
+  | EnumType     of (Ident.t * Ident.t srcflaged list)
+  | StructType   of struct_type_info
+  | ArrayType    of (Ident.t * type_exp * val_exp)
+
+(** Operator *)
+
+type item_ident =
+  | ConstItem of Ident.t
+  | TypeItem  of Ident.t
+  | OperItem  of Ident.t
+      
+type item_info =
+    ConstInfo of const_info
+  | TypeInfo  of type_info
+  | OperInfo  of oper_info
+
+(**********************************************************************************)
+
+(** Utilitaries to build [val_exp] *)
+
+let leafexp lxm op = CallByPos({src = lxm ; it = op }, Oper [])
+
+let unexp lxm op e1 = CallByPos( {src = lxm ; it = op }, Oper [e1] )	
+
+let binexp lxm op e1 e2 = CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2] ) 
+
+let ternexp lxm op e1 e2 e3 = CallByPos( {src = lxm ; it = op }, Oper [e1 ; e2; e3] )
+
+let naryexp lxm op elst = CallByPos( {src = lxm ; it = op }, Oper elst )	
+
+
+let bynameexp lxm op nelst = CallByName( {src = lxm ; it = op } , nelst )
diff --git a/src/syntaxTreeDump.ml b/src/syntaxTreeDump.ml
index bf0e9f77..0d34846b 100644
--- a/src/syntaxTreeDump.ml
+++ b/src/syntaxTreeDump.ml
@@ -1,14 +1,15 @@
-(** Time-stamp: <modified the 19/12/2007 (at 11:05) by Erwan Jahier> *)
+(** Time-stamp: <modified the 06/02/2008 (at 11:33) by Erwan Jahier> *)
 
 
 open Lxm
 open SyntaxTree
+open SyntaxTreeCore
 open Format
 
 (***********************************************************************************)
 (* exported *)
 
-let (op2string : SyntaxTree.by_pos_op -> string) =
+let (op2string : SyntaxTreeCore.predef_node -> string) =
   fun op ->  
   match op with 
       (* unaires *)
@@ -63,6 +64,10 @@ let (op2string : SyntaxTree.by_pos_op -> string) =
     | (ARRAY_SLICE_n sl) -> assert false
 	(* pseudo-unaire : acces structure *)
     | (STRUCT_ACCESS_n fld) -> assert false
+    | STRUCT_n _ -> assert false
+
+    | ITERATOR_n _ -> assert false
+    | MERGE_n _ -> assert false
 
 
 (***********************************************************************************)
@@ -134,11 +139,15 @@ and dump_type_def (os: Format.formatter) (info: type_info ) = (
 	(* fprintf os "= enum {@[<b 3>@,%a@,@]}" dump_id_list clist *)
 	fprintf os "= enum { %a}" dump_id_list clist
        
-    | StructType {st_name = id; st_flist = fl; st_ftable = ft} -> (
+    | StructType {st_name = id; st_flist = fl; st_ftable = ft} ->
 	let filst = List.map (function id -> (Hashtbl.find ft id).it) fl in
 	  fprintf os "= struct {@\n@[<b 3>   %a@]@\n}"
 	    dump_field_list filst
-      )
+
+    | ArrayType (id, texp, vexp) ->
+	fprintf os " = %a" dump_type_exp texp;
+	fprintf os "^%a"   dump_val_exp vexp;
+	
 )
   (****************************)
   (* dump d'une liste de noms *)
@@ -259,7 +268,7 @@ and dump_node (os: Format.formatter) (x: node_info srcflaged) = (
     match ninfo.ni_value with
 	NodeBody nbody -> dump_node_body os nbody
       | NodeAlias (_,{it = nexp; src = lxm}) -> 
-	  fprintf os " = @,%a;@\n" dump_oper_exp nexp
+	  fprintf os " = @,%a;@\n" dump_node_exp nexp
       | NodeExtern _ -> assert false
 )
 
@@ -388,65 +397,68 @@ and dump_val_exp_list (os : formatter) (xl: val_exp list) = (
   (****************************)
   (* Appels "par position"    *)
   (****************************)
-and dump_by_pos_exp (os: Format.formatter) (oper: by_pos_op) (pars: val_exp list) =
+and dump_by_pos_exp (os: Format.formatter) (oper: predef_node) (pars: operands) =
   (
     match (oper, pars) with 
-	(TRUE_n,     [])  -> dump_leaf_exp os "true" 
-      | (FALSE_n,    [])  -> dump_leaf_exp os "false"
-      | (ICONST_n s, [])  -> dump_leaf_exp os (Ident.to_string s) 
-      | (RCONST_n s, [])  -> dump_leaf_exp os (Ident.to_string s)
-      | (IDENT_n  id, [])  -> dump_leaf_exp os (Ident.string_of_idref id)
+	(TRUE_n,     Oper [])  -> dump_leaf_exp os "true" 
+      | (FALSE_n,    Oper [])  -> dump_leaf_exp os "false"
+      | (ICONST_n s, Oper [])  -> dump_leaf_exp os (Ident.to_string s) 
+      | (RCONST_n s, Oper [])  -> dump_leaf_exp os (Ident.to_string s)
+      | (IDENT_n  id,Oper [])  -> dump_leaf_exp os (Ident.string_of_idref id)
 	    (* unaires *)
-      | (NOT_n,       [p0]) -> dump_unary_exp os "not" p0
-      | (UMINUS_n,    [p0]) -> dump_unary_exp os "-" p0
-      | (PRE_n,       [p0]) -> dump_unary_exp os "pre" p0
-      | (CURRENT_n,   [p0]) -> dump_unary_exp os "current" p0
-      | (REAL2INT_n,  [p0]) -> dump_unary_exp os "int" p0
-      | (INT2REAL_n,  [p0]) -> dump_unary_exp os "real" p0
+      | (NOT_n,      Oper [p0]) -> dump_unary_exp os "not" p0
+      | (UMINUS_n,   Oper [p0]) -> dump_unary_exp os "-" p0
+      | (PRE_n,      Oper [p0]) -> dump_unary_exp os "pre" p0
+      | (CURRENT_n,  Oper [p0]) -> dump_unary_exp os "current" p0
+      | (REAL2INT_n, Oper [p0]) -> dump_unary_exp os "int" p0
+      | (INT2REAL_n, Oper [p0]) -> dump_unary_exp os "real" p0
 	  (* binaires *)
-      | (ARROW_n,  [p0;p1]) -> dump_binary_exp os "->" p0 p1
-      | (FBY_n,    [p0;p1]) -> dump_binary_exp os "fby" p0 p1
-      | (WHEN_n,   [p0;p1]) -> dump_binary_exp os "when" p0 p1
-      | (AND_n,    [p0;p1]) -> dump_binary_exp os "and" p0 p1
-      | (OR_n,     [p0;p1]) -> dump_binary_exp os "or" p0 p1
-      | (XOR_n,    [p0;p1]) -> dump_binary_exp os "xor" p0 p1
-      | (IMPL_n,   [p0;p1]) -> dump_binary_exp os "=>" p0 p1
-      | (EQ_n,     [p0;p1]) -> dump_binary_exp os "=" p0 p1
-      | (NEQ_n,    [p0;p1]) -> dump_binary_exp os "<>" p0 p1
-      | (LT_n,     [p0;p1]) -> dump_binary_exp os "<" p0 p1
-      | (LTE_n,    [p0;p1]) -> dump_binary_exp os "<=" p0 p1
-      | (GT_n,     [p0;p1]) -> dump_binary_exp os ">" p0 p1
-      | (GTE_n,    [p0;p1]) -> dump_binary_exp os ">=" p0 p1
-      | (DIV_n,    [p0;p1]) -> dump_binary_exp os "div" p0 p1
-      | (MOD_n,    [p0;p1]) -> dump_binary_exp os "mod" p0 p1
-      | (MINUS_n,  [p0;p1]) -> dump_binary_exp os "-" p0 p1
-      | (PLUS_n,   [p0;p1]) -> dump_binary_exp os "+" p0 p1
-      | (SLASH_n,  [p0;p1]) -> dump_binary_exp os "/" p0 p1
-      | (TIMES_n,  [p0;p1]) -> dump_binary_exp os "*" p0 p1
-      | (POWER_n,  [p0;p1]) -> dump_binary_exp os "**" p0 p1
-      | (HAT_n,    [p0;p1]) -> dump_binary_exp os "^" p0 p1
-      | (CONCAT_n, [p0;p1]) -> dump_binary_exp os "|" p0 p1
+      | (ARROW_n,  Oper [p0;p1]) -> dump_binary_exp os "->" p0 p1
+      | (FBY_n,    Oper [p0;p1]) -> dump_binary_exp os "fby" p0 p1
+      | (WHEN_n,   Oper [p0;p1]) -> dump_binary_exp os "when" p0 p1
+      | (AND_n,    Oper [p0;p1]) -> dump_binary_exp os "and" p0 p1
+      | (OR_n,     Oper [p0;p1]) -> dump_binary_exp os "or" p0 p1
+      | (XOR_n,    Oper [p0;p1]) -> dump_binary_exp os "xor" p0 p1
+      | (IMPL_n,   Oper [p0;p1]) -> dump_binary_exp os "=>" p0 p1
+      | (EQ_n,     Oper [p0;p1]) -> dump_binary_exp os "=" p0 p1
+      | (NEQ_n,    Oper [p0;p1]) -> dump_binary_exp os "<>" p0 p1
+      | (LT_n,     Oper [p0;p1]) -> dump_binary_exp os "<" p0 p1
+      | (LTE_n,    Oper [p0;p1]) -> dump_binary_exp os "<=" p0 p1
+      | (GT_n,     Oper [p0;p1]) -> dump_binary_exp os ">" p0 p1
+      | (GTE_n,    Oper [p0;p1]) -> dump_binary_exp os ">=" p0 p1
+      | (DIV_n,    Oper [p0;p1]) -> dump_binary_exp os "div" p0 p1
+      | (MOD_n,    Oper [p0;p1]) -> dump_binary_exp os "mod" p0 p1
+      | (MINUS_n,  Oper [p0;p1]) -> dump_binary_exp os "-" p0 p1
+      | (PLUS_n,   Oper [p0;p1]) -> dump_binary_exp os "+" p0 p1
+      | (SLASH_n,  Oper [p0;p1]) -> dump_binary_exp os "/" p0 p1
+      | (TIMES_n,  Oper [p0;p1]) -> dump_binary_exp os "*" p0 p1
+      | (POWER_n,  Oper [p0;p1]) -> dump_binary_exp os "**" p0 p1
+      | (HAT_n,    Oper [p0;p1]) -> dump_binary_exp os "^" p0 p1
+      | (CONCAT_n, Oper [p0;p1]) -> dump_binary_exp os "|" p0 p1
 	  (* ternaires *)
-      | (IF_n,   [p0;p1;p2]) -> dump_ternary_exp os "if" "then" "else" p0 p1 p2
-      | (WITH_n, [p0;p1;p2]) -> dump_ternary_exp os "with" "then" "else" p0 p1 p2
+      | (IF_n,   Oper [p0;p1;p2]) -> dump_ternary_exp os "if" "then" "else" p0 p1 p2
+      | (WITH_n, Oper [p0;p1;p2]) -> dump_ternary_exp os "with" "then" "else" p0 p1 p2
 	  (* n-aires *)
-      | (NOR_n,    pl) -> dump_nary_exp os "nor" pl
-      | (DIESE_n,  pl) -> dump_nary_exp os "#" pl
-      | (TUPLE_n,  pl) -> dump_nary_exp os "" pl
-      | (CALL_n s, pl) -> fprintf os "%a(@,%a@,)"
-	  dump_oper_exp s.it dump_val_exp_list pl 
+      | (NOR_n,    Oper pl) -> dump_nary_exp os "nor" pl
+      | (DIESE_n,  Oper pl) -> dump_nary_exp os "#" pl
+      | (TUPLE_n,  Oper pl) -> dump_nary_exp os "" pl
+      | (CALL_n s, Oper pl) -> fprintf os "%a(@,%a@,)"
+	  dump_node_exp s.it dump_val_exp_list pl 
 	    (* tableau (spécial) *)
-      | (ARRAY_n,  pl) -> fprintf os "[@,%a@,]" dump_val_exp_list pl
+      | (ARRAY_n,  Oper pl) -> fprintf os "[@,%a@,]" dump_val_exp_list pl
 	  (* pseudo-unaire : acces tableau *)
-      | (ARRAY_ACCES_n ix, [p0]) ->  fprintf os "%a[@,%a@,]" 
+      | (ARRAY_ACCES_n ix, Oper [p0]) ->  fprintf os "%a[@,%a@,]" 
 	  dump_val_exp p0 dump_val_exp ix 
-      | (ARRAY_SLICE_n sl, [p0]) ->  fprintf os "%a[@,%a@,]" 
+      | (ARRAY_SLICE_n sl, Oper [p0]) ->  fprintf os "%a[@,%a@,]" 
 	  dump_val_exp p0 dump_slice_info sl 
 	    (* pseudo-unaire : acces structure *)
-      | (STRUCT_ACCESS_n fld, [p0]) -> fprintf os "%a.%s"
+      | (STRUCT_ACCESS_n fld, Oper [p0]) -> fprintf os "%a.%s"
 	  dump_val_exp p0 (Ident.to_string fld)
 
-	    
+      | (ITERATOR_n _, _) -> assert false
+      | (MERGE_n _,_) -> assert false
+      | (STRUCT_n _, _) -> assert false
+
       | (FBY_n, _) -> assert false
       | (PROJ_n _, _) -> assert false
       | (NULL_exp, _) -> assert false
@@ -484,10 +496,10 @@ and dump_by_pos_exp (os: Format.formatter) (oper: by_pos_op) (pars: val_exp list
       | (UMINUS_n, _) -> assert false
       | (NOT_n, _) -> assert false
       | (IDENT_n _, _) -> assert false
-      | (RCONST_n _, _::_) -> assert false
-      | (ICONST_n _, _::_) -> assert false
-      | (FALSE_n, _::_) -> assert false
-      | (TRUE_n, _::_) -> assert false
+      | (RCONST_n _, Oper (_::_)) -> assert false
+      | (ICONST_n _, Oper (_::_)) -> assert false
+      | (FALSE_n, Oper (_::_)) -> assert false
+      | (TRUE_n, Oper (_::_)) -> assert false
 
   )
     (* les procs standard pour les operateurs predefs *)
@@ -529,9 +541,9 @@ and dump_nary_exp
       fprintf os "%s(@,%a@,)" s dump_val_exp_list ops
     )
 
-and dump_oper_exp
+and dump_node_exp
     (os : Format.formatter)
-    (n: oper_exp)
+    (n: node_exp)
     = (
       match n with
 	  CallPreDef op -> (
@@ -570,7 +582,7 @@ and dump_static_arg
 		    fprintf os "type %a" dump_type_exp te 
 		  ) |
 		      StaticArgNode  ne -> (
-			fprintf os "node %a" dump_oper_exp ne
+			fprintf os "node %a" dump_node_exp ne
 		      ) 
     )
 and dump_slice_info 
diff --git a/src/syntaxTreeDump.mli b/src/syntaxTreeDump.mli
index 51ae344d..fa4a8cbe 100644
--- a/src/syntaxTreeDump.mli
+++ b/src/syntaxTreeDump.mli
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 19/12/2007 (at 11:05) by Erwan Jahier> *)
+(** Time-stamp: <modified the 06/02/2008 (at 11:28) by Erwan Jahier> *)
 
 (** Pretty-printing the internal structure *)
 
@@ -7,4 +7,4 @@ val packinfo : Format.formatter -> SyntaxTree.pack_info Lxm.srcflaged -> unit
 val packbody : Format.formatter -> SyntaxTree.packbody -> unit
 
 val modelinfo : Format.formatter -> SyntaxTree.model_info Lxm.srcflaged -> unit
-val op2string : SyntaxTree.by_pos_op -> string
+val op2string : SyntaxTreeCore.predef_node -> string
diff --git a/src/test/Makefile b/src/test/Makefile
index a77e031c..76b6e6a2 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,58 +1,59 @@
 LC=../lus2lic -vl 3 
 
+NL="----------------------------------------------------------------------\\n"
 
 test: 
 	echo "Non-regression tests" > test.res
 	\
-	echo " " >> test.res; echo "====> $(LC) newpacks.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) newpacks.lus" >> test.res
 	$(LC) newpacks.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) struct0.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) struct0.lus" >> test.res
 	$(LC) struct0.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) t0.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) t0.lus" >> test.res
 	$(LC) t0.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) t2.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) t2.lus" >> test.res
 	$(LC) t2.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) test.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) test.lus" >> test.res
 	$(LC) test.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) trivial.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) trivial.lus" >> test.res
 	$(LC) trivial.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) x.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) x.lus" >> test.res
 	$(LC) x.lus >> test.res 2>&1  || true 
 	\
-	echo " " >> test.res; echo "====> $(LC) consensus.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) consensus.lus" >> test.res
 	$(LC) consensus.lus 2>&1   >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) left.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) left.lus" >> test.res
 	$(LC) left.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) packs.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) packs.lus" >> test.res
 	$(LC) packs.lus 2>&1  >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) p.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) p.lus" >> test.res
 	$(LC) p.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) t.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) t.lus" >> test.res
 	$(LC) t.lus >> test.res 2>&1 || true
 	\
-	echo " " >> test.res; echo "====> $(LC) trivial.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) trivial.lus" >> test.res
 	$(LC) trivial.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) t1.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) t1.lus" >> test.res
 	$(LC) t1.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) onlyroll.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) onlyroll.lus" >> test.res
 	$(LC) onlyroll.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) heater_control.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) heater_control.lus" >> test.res
 	$(LC) heater_control.lus >> test.res 2>&1
 	\
-	echo " " >> test.res; echo "====> $(LC) pfs.lus" >> test.res
+	echo " " >> test.res; echo -e "$(NL)====> $(LC) pfs.lus" >> test.res
 	$(LC) pfs.lus >> test.res 2>&1 || true
 	\
 	diff -u test.res.exp test.res > test.diff || (cat test.diff ; echo "cf test.diff")
diff --git a/src/test/packs.lus b/src/test/packs.lus
index 7a2b25e1..dd4fcfff 100644
--- a/src/test/packs.lus
+++ b/src/test/packs.lus
@@ -54,7 +54,7 @@ body
 
 	type couleurs = enum { bleu, rose, jaune };
 	type  T = int^N;
-	const
+        const
 		X = N;
 		N : int = -2 * inter::n;
  
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index db695cce..7a021882 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -1,5 +1,6 @@
 Non-regression tests
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  newpacks.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -64,6 +65,7 @@ End of Syntax table dump. 
 	Exported constants:
 		const n = -4
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  struct0.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -88,6 +90,7 @@ End of Syntax table dump. 
 		type Toto =  {x : int (1); y : int (2)}
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  t0.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -113,6 +116,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  t2.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -139,6 +143,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  test.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -164,6 +169,7 @@ End of Syntax table dump. 
 	Exported constants:
 		const y = 3
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  trivial.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -186,6 +192,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  x.lus
 Error. 'm' (file:x.lus, line:3, col:7 to 7):
 ---> recursion loop detected:
@@ -218,6 +225,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  consensus.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -243,6 +251,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  left.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -267,6 +276,7 @@ End of Syntax table dump. 
 		type truc =  {a : bool^100; b : int}
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  packs.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -353,6 +363,7 @@ End of Syntax table dump. 
 		const X = inter::X
 		const Y = inter::Y
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  p.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -417,6 +428,7 @@ End of Syntax table dump. 
 	Exported constants:
 		const n = -4
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  t.lus
 Error. '+' (file:t.lus, line:33, col:1 to 1):
 ---> can't eval constant: type combination error, int*int or real*real expected
@@ -444,6 +456,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  trivial.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -466,6 +479,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  t1.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -490,6 +504,7 @@ End of Syntax table dump. 
 	Exported types:
 	Exported constants:
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  onlyroll.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -593,6 +608,7 @@ End of Syntax table dump. 
 		const CROSS_CH_TOL_YAW = 10.000000
 		const TIME_CROSS_ROLL = 3
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  heater_control.lus
 *** SyntaxTab.create pass 1
 *** SyntaxTab.create pass 2
@@ -633,6 +649,7 @@ End of Syntax table dump. 
 		const TMAX = 9.000000
 		const DELTA = 0.500000
  
+----------------------------------------------------------------------
 ====> ../lus2lic -vl 3  pfs.lus
 Error. '[' (file:pfs.lus, line:43, col:22 to 22):
 ---> syntax error
-- 
GitLab