Commit 2904be8c authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

By default now generate the realize.svg output

parent 4a1f13ae
......@@ -32,7 +32,7 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
ACG_DIR=src/scripting
ACGC_DIR=src/acg-data
ACGC_DIR=src/grammars
DATA_DIR=@datarootdir@/acgtk
......
......@@ -17,7 +17,7 @@
(* *)
(**************************************************************************)
VERSION="1.2-20150528"
VERSION="1.2-20150529"
AC_INIT([ACG DTK],[$VERSION],[sylvain.pogodalla@loria.fr])
......@@ -187,7 +187,8 @@ AC_MSG_CHECKING([for $OCAMLC version])
AC_MSG_RESULT([$OCAMLC version is $OCAML_VERSION])
# Check whether the caml version checker is provided
ML_CHECK_FILE=config/ml_check.ml
DIR=$( cd "$( dirname "$0" )" && pwd )
ML_CHECK_FILE=$DIR/config/ml_check.ml
AC_CHECK_FILE($ML_CHECK_FILE,,AC_MSG_ERROR(Cannot check versions))
# check that this version is at least the one we need
......
......@@ -3215,7 +3215,8 @@ $as_echo_n "checking for $OCAMLC version... " >&6; }
$as_echo "$OCAMLC version is $OCAML_VERSION" >&6; }
# Check whether the caml version checker is provided
ML_CHECK_FILE=config/ml_check.ml
DIR=$( cd "$( dirname "$0" )" && pwd )
ML_CHECK_FILE=$DIR/config/ml_check.ml
as_ac_File=`$as_echo "ac_cv_file_$ML_CHECK_FILE" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ML_CHECK_FILE" >&5
$as_echo_n "checking for $ML_CHECK_FILE... " >&6; }
......
archive: "http://calligramme.loria.fr/acg/software/acg-1.1-20150506.tar.gz"
checksum: "2bb5e2cb41c3b2439ea7eb268c111fb8"
archive: "http://calligramme.loria.fr/acg/software/acg-1.2-20150529.tar.gz"
checksum: "129a3d11907d7688172ba35f36709b54"
......@@ -21,10 +21,10 @@
#SUBDIRS= utils logic grammars acg-data scripting lambda datalog
#SUBDIRS= utils logic grammars acg-data scripting datalog reduction s_datalog
SUBDIRS= utils logic datalog.prover grammars acg-data scripting datalog.solver
SUBDIRS= utils logic datalog.prover acg-data grammars scripting datalog.solver
ACG_DIR=scripting
ACGC_DIR=acg-data
ACGC_DIR=grammars
acg acg.opt:
$(MAKE) -r -S -C $(ACG_DIR) $@
......
......@@ -26,21 +26,21 @@ include ../Makefile.master
###############################
# Used libraries
LIBS += dyp.cma str.cma ANSITerminal.cma
LIBS += dyp.cma str.cma
# The corresponding directories
# (if not in the main ocaml lib directory,
# ex. -I +campl4
LIBDIR += @DYPGEN_INCLUDE@ @ANSITerminal_INCLUDE@
LIBDIR += @DYPGEN_INCLUDE@
# Directories to which the current source files depend on
PREVIOUS_DIRS = ../utils ../logic ../grammars ../datalog.prover
PREVIOUS_DIRS = ../utils ../logic ../datalog.prover
# Source files in the right order of dependance
ML = type_system.ml signature.ml reduction.ml acg_lexicon.ml
ML = error.ml type_system.ml interface.ml signature.ml reduction.ml acg_lexicon.ml
EXE_SOURCES = acgc.ml
EXE_SOURCES =
####################################
# #
......
......@@ -452,4 +452,4 @@ struct
end
module Sylvain_lexicon = Make (Sylvains_signature)
module Data_Lexicon = Make (Data_Signature)
......@@ -19,4 +19,7 @@
open Signature
module Sylvain_lexicon : Interface.Lexicon_sig with type Signature.term=Lambda.Lambda.term and type Signature.stype=Lambda.Lambda.stype
module Data_Lexicon : Interface.Lexicon_sig
with
type Signature.term=Lambda.Lambda.term
and type Signature.stype=Lambda.Lambda.stype
(**************************************************************************)
(* *)
(* ACG development toolkit *)
(* *)
(* Copyright 2008 INRIA *)
(* *)
(* More information on "http://acg.gforge.inria.fr/" *)
(* License: CeCILL, see the LICENSE file or "http://www.cecill.info" *)
(* Authors: see the AUTHORS file *)
(* *)
(* *)
(* *)
(* *)
(* $Rev:: $: Revision of last commit *)
(* $Author:: $: Author of last commit *)
(* $Date:: $: Date of last commit *)
(* *)
(**************************************************************************)
module Sg = Signature.Sylvains_signature
(*module Lex = Syntactic_data_structures.Abstract_lex*)
module Lex = Acg_lexicon.Sylvain_lexicon
module Test = Interactive.Make(Lex)
Test.main ()
......@@ -441,6 +441,6 @@ module Table = Table.Make_table(struct let b = 10 end)
end
*)
module Sylvains_signature = Make(Tries.Tries)(Table)
module Data_Signature = Make(Tries.Tries)(Table)
......@@ -20,14 +20,16 @@
open Abstract_syntax
open Lambda
(*
type sig_entry =
| Type_declaration of string * int * Lambda.kind
| Type_definition of string * int * Lambda.kind * Lambda.stype
| Term_declaration of string * int * Abstract_syntax.syntactic_behavior * Lambda.stype
| Term_definition of string * int * Abstract_syntax.syntactic_behavior * Lambda.stype * Lambda.term
*)
module Sylvains_signature : Interface.Signature_sig
module Data_Signature : Interface.Signature_sig
with
type term = Lambda.term
and type stype = Lambda.stype
......
......@@ -26,21 +26,21 @@ include ../Makefile.master
###############################
# Used libraries
LIBS += dyp.cma str.cma
LIBS += dyp.cma str.cma ANSITerminal.cma
# The corresponding directories
# (if not in the main ocaml lib directory,
# ex. -I +campl4
LIBDIR += @DYPGEN_INCLUDE@
LIBDIR += @DYPGEN_INCLUDE@ @ANSITerminal_INCLUDE@
# Directories to which the current source files depend on
PREVIOUS_DIRS = ../utils ../logic
PREVIOUS_DIRS = ../utils ../logic ../datalog.prover ../acg-data
# Source files in the right order of dependance
#ML = error.ml interface.ml environment.ml entry.ml syntactic_data_structures.ml acg_token.ml data_lexer.ml data_parser.ml interactive.ml
ML = error.ml interface.ml environment.ml entry.ml acg_token.ml data_lexer.ml data_parser.ml interactive.ml
ML = environment.ml entry.ml acg_token.ml data_lexer.ml data_parser.ml
EXE_SOURCES =
EXE_SOURCES = acgc.ml
DYP = data_parser.dyp
CAMLLEX = data_lexer.mll
......@@ -69,14 +69,14 @@ include ../Makefile.common
# @OCAMLLEX@ $<
data_parser.ml: ../utils/utils.cmi acg_token.cmi \
data_lexer.cmi error.cmi environment.cmi entry.cmi \
data_lexer.cmi ../acg-data/error.cmi environment.cmi entry.cmi \
../logic/abstract_syntax.cmi
data_parser.cmo: ../utils/utils.cmi acg_token.cmi \
data_lexer.cmo error.cmi environment.cmi entry.cmi \
data_lexer.cmo ../acg-data/error.cmi environment.cmi entry.cmi \
../logic/abstract_syntax.cmi data_parser.cmi
data_parser.cmx: ../utils/utils.cmx acg_token.cmx \
data_lexer.cmx error.cmx environment.cmx entry.cmx \
data_lexer.cmx ../acg-data/error.cmx environment.cmx entry.cmx \
../logic/abstract_syntax.cmx data_parser.cmi
data_parser.ml: ../utils/utils.cmi acg_token.cmi \
......@@ -98,4 +98,4 @@ truc : $(filter-out essai_sylvain.cmo,$(CMO)) example_dispatch.cmo essai_sylvai
echo $^
example_dispatch.cmo : PP=-pp "@OCAMLP4@ pa_r.cmo pa_rp.cmo pr_dump.cmo pa_extend.cmo"
example_dispatch.cmx : PP=-pp "@OCAMLP4@ pa_r.cmo pa_rp.cmo pr_dump.cmo pa_extend.cmo"
\ No newline at end of file
example_dispatch.cmx : PP=-pp "@OCAMLP4@ pa_r.cmo pa_rp.cmo pr_dump.cmo pa_extend.cmo"
(**************************************************************************)
(* *)
(* ACG development toolkit *)
(* *)
(* Copyright 2008 INRIA *)
(* *)
(* More information on "http://acg.gforge.inria.fr/" *)
(* License: CeCILL, see the LICENSE file or "http://www.cecill.info" *)
(* Authors: see the AUTHORS file *)
(* *)
(* *)
(* *)
(* *)
(* $Rev:: $: Revision of last commit *)
(* $Author:: $: Author of last commit *)
(* $Date:: $: Date of last commit *)
(* *)
(**************************************************************************)
(* module Lex = Acg_lexicon.Data_Lexicon *)
(*module Test = Interactive.Make(Lex)
Test.main ()
*)
(*module Actual_env = Environment.Make(Lex) *)
module Actual_env = Environment.Environment
module Sg=Actual_env.Signature1
type return_status = Failure | Success of ((string option) * Actual_env.t)
(* The pair is meant to keep the name of the current parsing file,
and the build environment *)
(*module Actual_parser = Data_parser.Make(Actual_env) *)
module Actual_parser = Data_parser.Parser
let resize_terminal () =
let () = Utils.sterm_set_size () in
Utils.term_set_size ()
let empty_env = Actual_env.empty
let interactive = ref false
let dirs = ref [""]
let output_name = ref None
let return_status = ref (Success (None,empty_env))
let initialize name =
let () = output_name := Some name in
return_status := Success (!output_name,empty_env)
let options =
[
("-version", Arg.Unit (fun () -> Printf.printf "%s\n" Version.version;exit 0), Format.sprintf "@[@,@[<hov 10>@[Prints@ the@ version@ number@]@]@]");
("-o", Arg.String initialize, Format.sprintf "@[-o file_name@, @[<hv 9>@[sets@ the@ name@ of@ the@ ouput@ file@ to@ \"file_name\".@ The@ default@ is@ to@ use@ the@ base@ name@ (with@ no@ extension)@ of@ the@ first@ file@ argument@ with@ the@ suffix@ \".acgo\"@]@]@]");
("-i", Arg.Set interactive , Format.sprintf "@[@,@[<5>Enters@ the@ interaction@ loop@ to@ parse@ terms@ according@ to@ signatures@]@]");
("-I", Arg.String (fun dir -> dirs := (!dirs)@[dir]) , Format.sprintf "@[@[-I dir@, @[<15>@[sets@ dir@ as@ a@ directory@ in@ which@ file@ arguments@ can@ be@ looked@ for@]@]@]@]")
]
let usg_msg = Format.sprintf "@[usage:\n@[\t%s [options] file1 file2 ...@]@, @[This@ command@ parse@ the@ files@ which@ are@ supposed@ to@ be@ files@ containing@ acg@ signatures@ or@ lexicons@,@ either@ as@ source@ files@ (the_file.acg)@ or@ object@ files@ (the_file.acgo).@ If@ all@ the@ parses@ are@ successful@,@ a@ binary@ containing@ all@ the@ acg@ signatures@ and@ lexicons@ is@ created.@ Its@ default@ name@ is@ \"filen.acgo\"@ where@ filen.acg@ is@ the@ last@ acg@ source@ file@ of@ the@ list@ (see@ option@ -o).@ Files@ should@ have@ a@ suffix@ \".acg\"@ or@ \".acgo\".@]@]@]" Sys.executable_name
let parse_term sg =
let t = ref None in
let rec parse_rec = function
| true ->
let () = Printf.printf "Enter a term: " in
let term_string = read_line () in
(match Actual_parser.parse_term term_string sg with
| None -> parse_rec true
| Some ta -> let () = t:= (Some ta) in false )
| false -> false in
let () =
while (parse_rec true) do
()
done in
match !t with
| Some u -> u
| _ -> failwith "Strange..."
type file_type = Source | Object | Neither
let parse filename dirs status =
match status with
| Failure -> Failure
| Success (name,env) ->
let file_type =
match Filename.check_suffix filename ".acg" with
| true -> Source
| false ->
(match Filename.check_suffix filename ".acgo" with
| true -> Object
| false -> Neither) in
match file_type with
| Neither ->
let () = Printf.fprintf stderr "File name's suffixes should be \".acg\" or \".acgo\". The name \"%s\" has not this suffix.\n" filename in
Failure
| Source ->
let basename=Filename.basename filename in
let name_wo_suffix = Filename.chop_suffix basename ".acg" in
begin
match Actual_parser.parse_data filename dirs env with
| None -> Failure
| Some e -> Success ((Some (Printf.sprintf "%s.acgo" name_wo_suffix)),e)
end
| Object ->
let new_env = Actual_env.read filename dirs in
match new_env with
| None -> Failure
| Some n_e -> Success (name,Actual_env.append env n_e)
let term_parsing i env =
if not i then
()
else
let n = Actual_env.sig_number env in
let m = Actual_env.lex_number env in
let available_data =
Utils.string_of_list
"\n"
(fun x -> x)
(Actual_env.fold
(fun d a ->
match d with
| Actual_env.Signature sg -> (Printf.sprintf "\tSignature\t%s" (fst (Actual_env.Signature1.name sg)))::a
| Actual_env.Lexicon lx -> (Printf.sprintf "\tLexicon\t\t%s" (fst (Actual_env.Lexicon.name lx)))::a)
[]
env) in
let chosen_sig=Actual_env.choose_signature env in
let chosen_sig_name_loaded =
match chosen_sig with
| None -> ""
| Some s -> Printf.sprintf "Signature \"%s\" loaded." (fst (Sg.name s)) in
if (n+m=0) || (not i)
then
()
else
try
let () = if (n=1)&&(m=0) then Printf.printf "%s\n" chosen_sig_name_loaded else () in
while true do
try
let () = Printf.printf "Available data:\n%s\n" available_data in
let entry =
match n,chosen_sig with
| 1, Some s -> Actual_env.Signature s
| _,_ ->
let () = Printf.printf "Enter a name: " in
let sig_string = read_line () in
Actual_env.get sig_string env in
match entry with
| Actual_env.Signature sg -> ignore (parse_term sg)
| Actual_env.Lexicon lex ->
let abs,obj=Actual_env.Lexicon.get_sig lex in
let t,ty = parse_term abs in
let t',ty'=Actual_env.Lexicon.interpret t ty lex in
Printf.printf
"Interpreted as:\n%s : %s\n"
(Actual_env.Signature1.term_to_string t' obj)
(Actual_env.Signature1.type_to_string ty' obj)
with
| Actual_env.Signature_not_found sig_name -> Printf.printf "No such signature in %s\n" sig_name
done
with
| End_of_file -> let () = print_newline () in ()
let output_env name env =
let () = Actual_env.write name env in
Printf.printf "Output written on: \"%s\"\n%!" name
let main () =
let () = resize_terminal () in
let anon_fun file =
return_status := parse file !dirs !return_status in
let () = Arg.parse options anon_fun usg_msg in
match !return_status with
| Failure -> 1
| Success (name,env) ->
match name with
| None ->
let () = Printf.fprintf stderr "No ouput file is produced\nPlease specify an output file.\n%!"
in 0
| Some n ->
let () = output_env n env in
let () = term_parsing !interactive env in
0
let _ = main ()
This diff is collapsed.
......@@ -28,9 +28,6 @@ sig
exception Lexicon_not_found of string
exception Entry_not_found of string
(* module Signature1:Signature_sig*)
module Signature1:Signature_sig with type term=Lambda.Lambda.term
module Lexicon:Interface.Lexicon_sig with type Signature.t=Signature1.t and type Signature.term=Signature1.term and type Signature.stype=Signature1.stype
......@@ -64,10 +61,14 @@ sig
val focus : t -> entry option
end
(*
module Make (Lex:Interface.Lexicon_sig) =
*)
module Lex=Acg_lexicon.Data_Lexicon
module Environment =
struct
(* module Signature=Sg*)
module Lexicon=Lex
module Sg=Lex.Signature
module Signature1=Sg
......
......@@ -130,5 +130,18 @@ end
(** The functor that builds the environment *)
module Make (Lex:Interface.Lexicon_sig) : Environment_sig
with type Signature1.t=Lex.Signature.t and type Lexicon.t = Lex.t and type Signature1.term = Lex.Signature.term and type Signature1.stype = Lex.Signature.stype
(*module Make (Lex:Interface.Lexicon_sig) : Environment_sig
with
type Signature1.t=Lex.Signature.t
and type Lexicon.t = Lex.t
and type Signature1.term = Lex.Signature.term
and type Signature1.stype = Lex.Signature.stype
*)
module Environment : Environment_sig
with
type Signature1.t=Acg_lexicon.Data_Lexicon.Signature.t
and type Lexicon.t = Acg_lexicon.Data_Lexicon.t
and type Signature1.term = Acg_lexicon.Data_Lexicon.Signature.term
and type Signature1.stype = Acg_lexicon.Data_Lexicon.Signature.stype
......@@ -19,6 +19,10 @@
open Abstract_syntax
let resize_terminal () =
let () = Utils.sterm_set_size () in
Utils.term_set_size ()
module Make(Lex:Interface.Lexicon_sig) =
struct
......@@ -43,13 +47,13 @@ struct
let options =
[
("-version", Arg.Unit (fun () -> Printf.printf "%s\n" Version.version;exit 0), Format.sprintf "@[Prints the version number@]");
("-o", Arg.String initialize, Format.sprintf "@[-o @[<hov 3>file_name sets the name of the ouput file to \"file_name\".@ The default is to use the base name@ (with no extension)@ of the first file argument with the suffix \".acgo\"@]@]");
("-i", Arg.Set interactive , " Enters the interaction loop to parse terms according to signatures");
("-I", Arg.String (fun dir -> dirs := (!dirs)@[dir]) , " -I dir sets dir as a directory in which file arguments can be looked for")
("-version", Arg.Unit (fun () -> Printf.printf "%s\n" Version.version;exit 0), Format.sprintf "@[@,@[<hov 10>@[Prints@ the@ version@ number@]@]@]");
("-o", Arg.String initialize, Format.sprintf "@[-o file_name@, @[<hv 9>@[sets@ the@ name@ of@ the@ ouput@ file@ to@ \"file_name\".@ The@ default@ is@ to@ use@ the@ base@ name@ (with@ no@ extension)@ of@ the@ first@ file@ argument@ with@ the@ suffix@ \".acgo\"@]@]@]");
("-i", Arg.Set interactive , Format.sprintf "@[@,@[<5>Enters@ the@ interaction@ loop@ to@ parse@ terms@ according@ to@ signatures@]@]");
("-I", Arg.String (fun dir -> dirs := (!dirs)@[dir]) , Format.sprintf "@[@[-I dir@, @[<15>@[sets@ dir@ as@ a@ directory@ in@ which@ file@ arguments@ can@ be@ looked@ for@]@]@]@]")
]
let usg_msg = Format.sprintf "@[usage:\n@[\t%s [options] file1 file2 ...@]@.@[This command parse the files which are supposed to be files containing acg signatures or lexicons.@ If all the parses are successful, a binary containing all the acg signatures and lexicons is created.@ Its default name is \"file1.acgo\"@ (see option -o).@ Files should have suffix \".acg\".@]" Sys.executable_name
let usg_msg = Format.sprintf "@[usage:\n@[\t%s [options] file1 file2 ...@]@, @[This@ command@ parse@ the@ files@ which@ are@ supposed@ to@ be@ files@ containing@ acg@ signatures@ or@ lexicons@,@ either@ as@ source@ files@ (the_file.acg)@ or@ object@ files@ (the_file.acgo).@ If@ all@ the@ parses@ are@ successful@,@ a@ binary@ containing@ all@ the@ acg@ signatures@ and@ lexicons@ is@ created.@ Its@ default@ name@ is@ \"filen.acgo\"@ where@ filen.acg@ is@ the@ last@ acg@ source@ file@ of@ the@ list@ (see@ option@ -o).@ Files@ should@ have@ a@ suffix@ \".acg\"@ or@ \".acgo\".@]@]@]" Sys.executable_name
let parse_term sg =
......@@ -163,6 +167,7 @@ struct
let main () =
let () = resize_terminal () in
let anon_fun file =
return_status := parse file !dirs !return_status in
let () = Arg.parse options anon_fun usg_msg in
......
......@@ -34,7 +34,7 @@ LIBS += dyp.cma str.cma ANSITerminal.cma bigarray.cma cairo2.cma
LIBDIR += @DYPGEN_INCLUDE@ @ANSITerminal_INCLUDE@ @OCamlCairo2_INCLUDE@
# Directories to which the current source files depend on
PREVIOUS_DIRS = ../utils ../datalog.prover ../logic ../grammars ../acg-data
PREVIOUS_DIRS = ../utils ../datalog.prover ../logic ../acg-data ../grammars
# Source files in the right order of dependance
......@@ -54,13 +54,13 @@ EXE_SOURCES = acg.ml
include ../Makefile.common
script_parser.ml: scripting_errors.cmi script_lexer.cmi functions.cmi \
../grammars/error.cmi ../grammars/environment.cmi \
../acg-data/error.cmi ../grammars/environment.cmi \
../logic/abstract_syntax.cmi
script_parser.cmo: scripting_errors.cmi script_lexer.cmo functions.cmi \
../grammars/error.cmi ../grammars/environment.cmi \
../acg-data/error.cmi ../grammars/environment.cmi \
../logic/abstract_syntax.cmi script_parser.cmi
script_parser.cmx: scripting_errors.cmx script_lexer.cmx functions.cmx \
../grammars/error.cmx ../grammars/environment.cmx \
../acg-data/error.cmx ../grammars/environment.cmx \
../logic/abstract_syntax.cmx script_parser.cmi
(**************************************************************************)
(* *)
(* g *)
(* ACG development toolkit *)
(* *)
(* Copyright 2008 INRIA *)
......@@ -25,13 +25,16 @@ let () = Sys.catch_break true
let dirs = ref [""]
let pp_output = ref true
let svg_output = ref true
(*
module Lex = Acg_lexicon.Sylvain_lexicon
module E = Environment.Make(Lex)
*)
(*module P = Script_parser.Make(E) *)
module P = Script_parser.Make(E)
module P = Script_parser.Parser
module F = P.F
......@@ -41,6 +44,7 @@ let options =
("-I", Arg.String (fun dir -> dirs := (!dirs)@[dir]) , " -I dir sets dir as a directory in which file arguments can be looked for");
("-nc"), Arg.Unit (fun () -> F.color_output false), " toggle off the colors on the output";
("-npp"), Arg.Unit (fun () -> let () = Utils.no_pp () in pp_output:=false), " toggle off the pretty printing of the output";
("-nsvg"), Arg.Unit (fun () -> svg_output:=false), " toggle off the svg output";
]
let usg_msg = Printf.sprintf "%s [options] file1 file2 ...\n\nThis will parse the files which are supposed to be files acripting commands and then run the ACG command interpreter." Sys.executable_name
......@@ -52,7 +56,7 @@ let copyright_string = "©INRIA 2008-2014"
let bug_string = "Please send your comments or bug reports or feature requests to sylvain.pogodalla@inria.fr"
let env = ref E.empty
let env = ref Environment.Environment.empty
let resize_terminal () =
if !pp_output then
......@@ -97,7 +101,7 @@ let print_welcome_message () =
let anon_fun s =
let () = print_welcome_message () in
let () = resize_terminal () in
env := P.parse_file s !dirs !env
env := P.parse_file ~svg_output:!svg_output s !dirs !env
let _ =
(* ANSITerminal get the size info from stdin In case of redirection,
......@@ -113,7 +117,7 @@ let _ =
let () =
while !continue do
try
let () = env := P.parse_entry ~resize:!pp_output stdin_tmp_in_ch !dirs !env in
let () = env := P.parse_entry ~resize:!pp_output ~svg_output:!svg_output stdin_tmp_in_ch !dirs !env in
Format.print_flush ()
with
| End_of_file
......
This diff is collapsed.
......@@ -17,8 +17,6 @@
(* *)
(**************************************************************************)
open Environment
val info : Unix.file_descr -> string -> unit
......@@ -78,7 +76,7 @@ sig
val check : ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> unit
val realize : ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> unit
val realize : ?names:(string * (Lexing.position * Lexing.position)) list -> svg_output:bool -> env -> string -> (Lexing.position * Lexing.position) -> unit
val realize_show : ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> unit
......@@ -117,4 +115,6 @@ sig
end
module Make(E:Environment_sig) : Action_sig with type env=E.t
(*module Make(E:Environment_sig) : Action_sig with type env=E.t *)
module Functions : Action_sig with type env=Environment.Environment.t
......@@ -19,30 +19,35 @@
/**************************************************************************/
%mltop{
open Environment
open Script_lexer
let id = fun x -> x
let pr s = Printf.printf "%s\n%!" s
module Make (E:Environment.Environment_sig) =
(* module Make (E:Environment.Environment_sig) = *)
module Parser =
struct
module F = Functions.Make(E)
(* module F = Functions.Make(Environment) *)
module F=Functions.Functions
}
{
open Dyp
let local_data = (E.empty,fun _ -> failwith "Bug: Not yet defined")
(* for global_data, the first projection describe whether when
executing a script, the interpreter should wait between two
commands. The second projection is used to specify whether to
echo the current command. The third projection correspond to
the include dirs. *)
let global_data = false,true,[""]
let echo ((_:bool),b,(_:string list)) s = if b then Printf.printf "%s\n%!" s else ()
let wait (b,(_:bool),(_:string list)) f =
let local_data = (Environment.empty,fun _ -> failwith "Bug: Not yet defined")
(* for global_data, the first projection describe whether when
executing a script, the interpreter should wait between two
commands. The second projection is used to specify whether to
echo the current command. The third projection correspond to
the include dirs, and the fourt one indicates whether a svg
output (if relevant) should be generated. *)
let global_data = false,true,[""],true
let echo ((_:bool),b,(_:string list),(_:bool)) s = if b then Printf.printf "%s\n%!" s else ()
let wait (b,(_:bool),(_:string list),(_:bool)) f =
if b then ignore (f () )
let svg ((_:bool),(_:bool),(_:string list),b) = b
}
......@@ -86,7 +91,7 @@ QUERY_HELP
SAVE_HELP
%start <(E.t)> zzcommands
%start <(Environment.t)> zzcommands
%%
......@@ -115,18 +120,18 @@ QUERY_HELP
command:
| WAIT SEMICOLONN<l> @{let g_d1,g_d2,g_d3 = dyp.global_data in
(fun e -> let () = echo dyp.global_data l in let () = F.wait () in e),[Global_data (true,g_d2,g_d3)]}
| DONT WAIT SEMICOLONN<l> @{let g_d1,g_d2,g_d3 = dyp.global_data in
(fun e -> let () = echo dyp.global_data l in let () = F.dont_wait () in e),[Global_data (false,g_d2,g_d3)]}
| WAIT SEMICOLONN<l> @{let g_d1,g_d2,g_d3,g_d4 = dyp.global_data in
(fun e -> let () = echo dyp.global_data l in let () = F.wait () in e),[Global_data (true,g_d2,g_d3,g_d4)]}
| DONT WAIT SEMICOLONN<l> @{let g_d1,g_d2,g_d3,g_d4 = dyp.global_data in
(fun e -> let () = echo dyp.global_data l in let () = F.dont_wait () in e),[Global_data (false,g_d2,g_d3,g_d4)]}
| LOAD_DATA<s,loc,l> {fun e -> let () = echo dyp.global_data l in
let _,_,incl = dyp.global_data in
let _,_,incl,_ = dyp.global_data in
F.load F.Data s incl e}
| LOAD_OBJECT<s,loc,l> {fun e -> let () = echo dyp.global_data l in