Commit 22b05289 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Integrate the new Lutin runtime into Lurette.

Change the Lutin naming scheme that consisted into adding a _ in
front of I/O variables. But that was confusing lurette.  Hence, name
clashes are now possible (albeit unlikely to happen). This has to be
fix one day.
parent 5765e241
......@@ -15,7 +15,7 @@ test1:
-l 30 -td 10 --sut heater_ctrl_int -msn heater_ctrl_int --seed 1 \
--draw-inside 10 --draw-edges 10 --draw-all-vertices --draw-vertices 10 \
--do-not-show-step -ns2c -go -o test1.rif0 --draw-inside 10 --draw-edges 10 \
-go temp_int &&\
-go temp_int.luc &&\
grep -v "lurette chronogram" test1.rif0 | \
grep -v "The execution lasted"| sed -e "s/^M//" \
> test1.rif &&\
......@@ -28,7 +28,7 @@ test2:
-td 10 -msn heater_ctrl --sut heater_ctrl.lus --seed 1 \
--draw-inside 10 --draw-edges 10 --draw-all-vertices --draw-all-formula \
--do-not-show-step -ns2c -o test2.rif0 --draw-inside 10 --draw-edges 10 \
temp_float &&\
temp_float.luc &&\
grep -v "lurette chronogram" test2.rif0 | \
grep -v "The execution lasted"| sed -e "s/^M//"\
> test2.rif &&\
......
......@@ -23,7 +23,7 @@ let ecr = ref stderr
(** lurette toplevel loop. *)
let usage = "
usage: lurettetop [<options>] [<env ([x] env)*>]
usage: lurettetop [<options>] [<(env)+>]
lurettetop is a top level loop that let one use lurette.
Type help and/or man at the prompt for more info.
......@@ -718,13 +718,11 @@ let (explicit_the_luc_files : string -> unit) =
if s = "x"
then flag.env <- (flag.env ^ " x ")
else flag.env <-
let env =
try chop_ext s
with Invalid_argument _ -> s
let env = s in
in
if Filename.is_implicit env
then (flag.env ^ (Filename.concat flag.sut_dir (env ^ ".luc ")))
else (flag.env ^ env ^ ".luc ")
then (flag.env ^ (Filename.concat flag.sut_dir env)^" ")
else (flag.env ^ env ^ " " )
......@@ -997,20 +995,20 @@ let (run_lucky : unit -> int) =
if !(flag.display_local_var) then ["--locals"] else []
and env_str =
let lut_list = Util2.string_to_string_list flag.env in
List.iter
(fun lut ->
if lut = "x" then () else
if Util.get_extension lut = ".lut" then
let file = chop_ext lut in
ignore (lutin lut (file ^ ".luc"))
)
lut_list;
List.map
(fun lut ->
try let file = chop_ext lut in
(file ^ ".luc")
with _ -> lut
)
(* List.iter *)
(* (fun lut -> *)
(* if lut = "x" then () else *)
(* if Util.get_extension lut = ".lut" then *)
(* let file = chop_ext lut in *)
(* ignore (lutin lut (file ^ ".luc")) *)
(* ) *)
(* lut_list; *)
(* List.map *)
(* (fun lut -> *)
(* try let file = chop_ext lut in *)
(* (file ^ ".luc") *)
(* with _ -> lut *)
(* ) *)
lut_list
and pp_str =
......@@ -1362,20 +1360,20 @@ let (run : string -> int) =
if !(flag.display_local_var) then ["--display-local-var"] else ["-nlv"]
and env_str =
let lut_list = Util2.string_to_string_list flag.env in
List.iter
(fun lut ->
if lut = "x" then () else
if Util.get_extension lut = ".lut" then
let file = chop_ext lut in
ignore (lutin lut (file ^ ".luc"))
)
lut_list;
List.map
(fun lut ->
try let file = chop_ext lut in
(file ^ ".luc")
with _ -> lut
)
(* List.iter *)
(* (fun lut -> *)
(* if lut = "x" then () else *)
(* if Util.get_extension lut = ".lut" then *)
(* let file = chop_ext lut in *)
(* ignore (lutin lut (file ^ ".luc")) *)
(* ) *)
(* lut_list; *)
(* List.map *)
(* (fun lut -> *)
(* try let file = chop_ext lut in *)
(* (file ^ ".luc") *)
(* with _ -> lut *)
(* ) *)
lut_list
and pp_str =
......@@ -1556,7 +1554,7 @@ show
show of post-script version of the current environment
set_env \"<env ([x] env)*>\" (env=<file name>)
set_env \"<env (env)+>\" (env=<file name>)
to set the environment field (.luc files). Automata of
environments separated by \"x\" are multiplied.
The current value of this field is "
......@@ -2029,9 +2027,9 @@ and
try
(
match tok with parser
| [< 'Genlex.Ident(_, "x") ; tail = parse_env >] -> (" x " ^ tail)
| [< 'Genlex.String(_, str ); tail = parse_env >] -> (str ^ tail)
| [< 'Genlex.Ident(_, id ) ; tail = parse_env >] -> (id ^ ".luc " ^ tail)
(* | [< 'Genlex.Ident(_, "x") ; tail = parse_env >] -> (" x " ^ tail) *)
| [< 'Genlex.String(_, str ); tail = parse_env >] -> (str ^ " " ^tail)
(* | [< 'Genlex.Ident(_, id ) ; tail = parse_env >] -> (id ^ ".luc " ^ tail) *)
| [< _ >] -> ""
)
with e ->
......
......@@ -53,17 +53,24 @@ let get_fresh pfx = (
)
let get s = (
sprintf "_%s" s
(* XXX migth clash! (in the user name one of its I/O variable "_X001" for instance)
The correct code would be :
sprintf "_%s" s
but it confuses the current version of lurette *)
sprintf "%s" s
)
let reset () = (
_idcpt := 0
_idcpt := 0
)
(** Avec l'expansion, la remontée au source se fait par
une "pile" de couples (lexeme de la ref, lexeme du contexte),
le contexte étant toujours une déclaration de macro
(ou de noeud pour le top-level)
une "pile" de couples (lexeme de la ref, lexeme du contexte),
le contexte étant toujours une déclaration de macro
(ou de noeud pour le top-level)
*)
type src_stack = (Lexeme.t * Lexeme.t) list
......
......@@ -794,6 +794,7 @@ Puis on expanse [[e]]~:
*)
and treat_exp_call
(env : CheckEnv.t)
(e : Syntaxe.val_exp)
(sstack : scope_stack)
(id : Syntaxe.ident)
(args : Syntaxe.val_exp list)
......@@ -826,7 +827,8 @@ and treat_exp_call
) else ();
CoAlgExp.of_call
(CoIdent.from_string id.it)
(CkIdentInfo.get_type info)
(* (CkIdentInfo.get_type info) *)
(CheckEnv.get_exp_type env e)
aelist
) else (
(* ident de déclaration : utile ? *)
......@@ -1067,7 +1069,7 @@ treat_exp
)
(* opérateur *)
| CALL_n (id, args) -> (
treat_exp_call env sstack id args
treat_exp_call env e sstack id args
)
(* traces => impossible *)
| EXIST_n _
......
......@@ -64,7 +64,8 @@ let rec lucky_exp_of (env:t) (e: CoAlgExp.t) = (
Exp.Numer (lucky_numexp_of env e)
else if t = CkTypeEff.real then
Exp.Numer (lucky_numexp_of env e)
else assert false
else failwith ("XXX :"^(CkTypeEff.to_string t)^":"^(CoAlgExp.lus_dumps e)^"\n")
) and lucky_ref_of tab nme = (
try (
......
......@@ -45,8 +45,9 @@ USE_CAMLP4 = yes
SOURCES_C = call_lurette_main.c lurette_exe.c ocaml2c.idl \
$(HERE)/Ezdl_c.c $(HERE)/liblutin_c.c $(HERE)/liblutin.idl
HERE=$(LURETTE_PATH)/source/
HERE=./
HERE=.
LUTDIR=Lutin
SOURCES = $(SOURCES_C) \
......@@ -54,6 +55,7 @@ SOURCES = $(SOURCES_C) \
$(HERE)/Ezdl.mli \
$(HERE)/error.ml \
$(HERE)/version.ml \
$(LUTDIR)/lutVersion.ml \
$(HERE)/util.ml \
$(HERE)/util2.ml \
$(HERE)/graphUtil.ml \
......@@ -67,6 +69,39 @@ SOURCES = $(SOURCES_C) \
$(HERE)/genlex.ml \
$(HERE)/lexeme.mli \
$(HERE)/lexeme.ml \
$(LUTDIR)/utils.ml \
$(LUTDIR)/utils.mli \
$(LUTDIR)/verbose.ml \
$(LUTDIR)/verbose.mli \
$(LUTDIR)/errors.ml \
$(LUTDIR)/lutParser.mly \
$(LUTDIR)/lutLexer.mll \
$(LUTDIR)/parsers.ml \
$(LUTDIR)/parsers.mli \
$(LUTDIR)/syntaxe.ml \
$(LUTDIR)/syntaxeDump.ml \
$(LUTDIR)/ckTypeEff.ml \
$(LUTDIR)/ckTypeEff.mli \
$(LUTDIR)/ckIdentInfo.ml \
$(LUTDIR)/ckIdentInfo.mli \
$(LUTDIR)/checkEnv.ml \
$(LUTDIR)/checkEnv.mli \
$(LUTDIR)/predef.ml \
$(LUTDIR)/checkType.ml \
$(LUTDIR)/coIdent.ml \
$(LUTDIR)/coIdent.mli \
$(LUTDIR)/coAlgExp.ml \
$(LUTDIR)/coAlgExp.mli \
$(LUTDIR)/coTraceExp.ml \
$(LUTDIR)/coTraceExp.mli \
$(LUTDIR)/expand.ml \
$(LUTDIR)/expand.mli \
$(LUTDIR)/autoExplore.ml \
$(LUTDIR)/autoExplore.mli \
$(LUTDIR)/mainArg.mli \
$(LUTDIR)/mainArg.ml \
$(LUTDIR)/auto2Lucky.ml \
$(LUTDIR)/auto2Lucky.mli \
$(HERE)/graph.mli \
$(HERE)/graph.ml \
$(HERE)/poly_draw.mli \
......@@ -109,6 +144,8 @@ SOURCES = $(SOURCES_C) \
$(HERE)/Lucky/show_env.ml \
$(HERE)/prog.mli \
$(HERE)/prog.ml \
$(LUTDIR)/lutProg.ml \
$(LUTDIR)/lutProg.mli \
$(HERE)/Lucky/lucProg.mli \
$(HERE)/Lucky/lucProg.ml \
$(HERE)/fGen.mli \
......
......@@ -467,8 +467,31 @@ and
in
let env_list = (get_env_from_args 6 []) in
(* XXX LUTIN *)
let state0 = LucProg.make_state options.pp env_list in
let state0 =
debug_msg ("elnv_list = " ^ (String.concat "," env_list) ^ "\n");
match env_list with
| [file] ->
if Util.get_extension file = ".lut" then
Some (file,"main")
else
None
| _ -> None
in
let state0 =
match state0 with
Some(file,node) -> LutProg.make_state file node
| None -> (
List.iter
(fun f -> if (Util.get_extension f <> ".luc") then (
output_msg ("A .luc file is expected instead of '"^f^"'\n");
lurette_exit 2))
env_list;
LucProg.make_state options.pp env_list)
in
let init_state_dyn =
{
memory = state0.d.memory;
......
let str="1.50"
let sha="adb057e"
let sha="5765e24"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment