diff --git a/src/lazyCompiler.ml b/src/lazyCompiler.ml index 16ee50d85251c9f754248718dd2b6bf7d65a570f..2b3e2ef431d88346c53ff4264f0db6d556bd7b0a 100644 --- a/src/lazyCompiler.ml +++ b/src/lazyCompiler.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 13/03/2008 (at 17:26) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/03/2008 (at 13:28) by Erwan Jahier> *) open Lxm @@ -335,16 +335,18 @@ and (const_check_interface_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> (string_of_type_eff teff_body) ^ "") )) | Bool_const_eff _ - | Int_const_eff _ - | Real_const_eff _ + | Int_const_eff _ + | Real_const_eff _ | Struct_const_eff (_,_) | Array_const_eff (_,_) -> - print_string ( - (Ident.string_of_long cn) ^ " = " ^ - (string_of_const_eff prov_const_eff) ^ " can be provided."); - assert false - (* ougth to be catched by the syntax checking *) + if prov_const_eff = body_const_eff then + body_const_eff + else + raise(Compile_error ( + const_def.src, + " provided constant does not match with its definition.")) + and (type_check_do: t -> Ident.long -> Lxm.t -> SymbolTab.t -> Ident.pack_name -> SyntaxTreeCore.type_info srcflagged -> CompiledData.type_eff) = diff --git a/src/symbolTab.mli b/src/symbolTab.mli index a80772dfbb3f48192d8e9708f804e2ebbbaafd88..3f07f4219ec2d1a61d0053985e54fa83f1abe33d 100644 --- a/src/symbolTab.mli +++ b/src/symbolTab.mli @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 20/02/2008 (at 14:43) by Erwan Jahier> *) +(** Time-stamp: <modified the 14/03/2008 (at 11:11) by Erwan Jahier> *) (********************************************************** Sous-module pour SyntaxTab @@ -35,9 +35,9 @@ val add_import_type : t -> Ident.t -> Ident.long -> unit val add_import_node : t -> Ident.t -> Ident.long -> unit (** Add local items declaration *) -val add_type : t -> Ident.t -> type_info Lxm.srcflagged -> unit -val add_const : t -> Ident.t -> const_info Lxm.srcflagged -> unit -val add_node : t -> Ident.t -> node_info Lxm.srcflagged -> unit +val add_type : t -> Ident.t -> type_info Lxm.srcflagged -> unit +val add_const : t -> Ident.t -> const_info Lxm.srcflagged -> unit +val add_node : t -> Ident.t -> node_info Lxm.srcflagged -> unit (* Itérer sur les items *) diff --git a/src/test/should_work/NONREG/Int.lus b/src/test/should_work/NONREG/Int.lus index 93b4052ba558627d71a3de196edc7e49696c4a14..0be7a8c81dea508c4b8ac44144f9024838531057 100644 --- a/src/test/should_work/NONREG/Int.lus +++ b/src/test/should_work/NONREG/Int.lus @@ -1,30 +1,33 @@ model Int -needs const n:int; -provides -type Int; -const zero: Int; -function incr (x: Int) returns (incr: Int); -function add (x,y: Int) returns (sum: Int); -body -type Int = bool^n; -const zero = false^n; -function incr (x: Int) returns (incr: Int); -var co: bool; -let + needs + const n:int; + + provides + type Int; + const zero: Int; + function incr (x: Int) returns (incr: Int); + function add (x,y: Int) returns (sum: Int); + + body + type Int = bool^n; + const zero = false^n; + function incr (x: Int) returns (incr: Int); + var co: bool; + let (incr,co) = map_red<<fulladd,n>>(true,x,zero); -tel + tel -function fulladd(ci, x, y: bool) returns (s, co: bool); -let + function fulladd(ci, x, y: bool) returns (s, co: bool); + let s = ci xor (x xor y); co = (ci and x) or (x and y) or (y and ci); -tel + tel -function add (x,y: Int) returns (sum: Int); -var co: bool; -let + function add (x,y: Int) returns (sum: Int); + var co: bool; + let (sum, co) = map_red<<fulladd,n>>(false,x,y); -tel + tel end diff --git a/src/test/test.res.exp b/src/test/test.res.exp index ebb2dbade96c665abb2cf3f44e71e6c082b642a0..238734a959440084aa5c9c815895e7626f3d6081 100644 --- a/src/test/test.res.exp +++ b/src/test/test.res.exp @@ -58,9 +58,11 @@ End of Syntax table dump. Exported types: type Int8::Int = Int8::Int Exported constants: -Int8::n = 8 can be provided. -*** oops: an internal error occurred in file lazyCompiler.ml, line 346, column 5 -*** when compiling lustre program should_work/NONREG/Int.lus + const Int8::n = 8 + const Int8::zero = [false, false, false, false, false, false, false, false] + Exported nodes: +*** Error in file "should_work/NONREG/Int.lus", line 17, col 14 to 20, token 'map_red': unknown node + ---------------------------------------------------------------------- ====> ../lus2lic -vl 3 should_work/NONREG/PCOND.lus