Commit 1b2125f4 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain

Moved to command line arguments for acg and acgc handle by the cmdliner library

parent 46944819
......@@ -17,57 +17,36 @@
(* *)
(**************************************************************************)
open Cmdliner
open UtilsLib
module Actual_env = AcgData.Environment.Environment
module Sg=Actual_env.Signature1
module Actual_parser = Grammars.Parsers
(** This module correspond to the main funtion of the ACG compiler and
its command line interface. *)
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 *)
(** Tries a reference to {!Logic.Lambda.Lambda.stype}. *)
module Actual_parser = Grammars.Parsers
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 *)
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 =
output_name := Some name
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
(match Actual_parser.parse_term ~color:true term_string sg with
| None -> parse_rec true
| Some ta -> let () = t:= (Some ta) in false )
| false -> false in
......@@ -85,17 +64,24 @@ let parse filename dirs status =
match status with
| Failure -> Failure
| Success (name,env) ->
let () = Logs.debug (fun m -> m "The environment currently has %d signature(s) and %d lexicon(s)." (Actual_env.sig_number env) (Actual_env.lex_number env)) in
let () = Logs.debug
(fun m -> m
"The environment currently has %d signature(s) and %d lexicon(s)."
(Actual_env.sig_number env)
(Actual_env.lex_number env)) in
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
| true -> Object
| false -> Neither) in
match file_type with
| Neither ->
let () = Logs.err (fun m -> m "File name's suffixes should be \".acg\" or \".acgo\". The name \"%s\" has not this suffix.\n" filename) in
let () = Logs.err
(fun m -> m
"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
......@@ -110,7 +96,13 @@ let parse filename dirs status =
match new_env with
| None -> Failure
| Some n_e -> Success (name,Actual_env.append env n_e)
let parse_files status dirs files =
List.fold_left
(fun acc file -> parse file dirs acc)
status
files
let term_parsing i env =
if not i then
......@@ -174,27 +166,58 @@ let output_env ?output_file name env =
| Some f -> f in
let () = Actual_env.write actual_output_file env in
Logs.app (fun m -> m "Output written on: \"%s\"\n%!" actual_output_file)
let main () =
let main_function interactive output_file dirs files =
let () = resize_terminal () in
let () = Log.set_level ~app:"acgc" Logs.Warning in
(* let () = Log.set_level ~app:"acgc" Logs.Debug 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
let dirs =
match dirs with
| [""] -> dirs
| _ -> ("")::dirs in
let return_status = parse_files (Success (None,Actual_env.empty)) dirs files in
match return_status with
| Failure ->
`Error (false,"No output file was generated.")
| Success (name,env) ->
match name with
| None ->
let () = Printf.fprintf stderr "No ouput file is produced\nPlease specify an output file.\n%!"
in 0
in `Ok 0
| Some n ->
let () = Logs.debug (fun m -> m "The environment currently has %d signature(s) and %d lexicon(s)." (Actual_env.sig_number env) (Actual_env.lex_number env)) in
let () = output_env ?output_file:!output_name n env in
let () = term_parsing !interactive env in
0
let () =
Logs.debug (fun m -> m "The environment currently has %d signature(s) and %d lexicon(s)." (Actual_env.sig_number env) (Actual_env.lex_number env)) in
let () = output_env ?output_file:output_file n env in
let () = term_parsing interactive env in
`Ok 0
let main =
let doc = "Compile ACG files into a binary representation." in
let output_file =
let doc = "Outputs the result of the command in $(docv) instead of printing it on the standard output." in
Arg.(value & opt (some string) None & info ["o"; "output"] ~docv:"FILE" ~doc) in
let dirs =
let doc = "Sets $(docv) as a directory in which file arguments can be looked for." in
Arg.(value & opt_all dir [""] & info ["I";"include"] ~docv:"DIR" ~doc) in
let interactive =
let doc = "Enters the interaction loop to parse terms according to signatures." in
Arg.(value & flag & info ["i";"interactive"] ~doc) in
let man = [
`S Manpage.s_description ;
`P "$(tname) parses each file $(i,FILE), which is supposed to be a file containing ACG signatures or lexicons, either as source files (typically with the .acg extension) or object files (with the .acgo extension).";
`P "If all the files are successfully parsed, a binary containing all the ACG signatures and lexicons is created. By default, the name of the generated binay file is \"$(b,FILE)n.acgo\" where $(b,FILE)n.acg is the last parameter (see option -o)." ;
`P "Files should have \".acg\" or \".acgo\" as suffix.";
`S Manpage.s_bugs;
`P "Report bugs by submitting issues at https://gitlab.inria.fr/ACG/dev/ACGtk/issues.";
`P "Or report bugs to <sylvain.pogodalla@inria.fr>.";
] in
let files = Arg.(non_empty & pos_all string [] & info [] ~docv:"FILE") in
let exits = Term.((exit_info ~doc:"on failure (at least one of the argument files $(b,FILE) does not compile)." 1)::default_exits) in
Term.(ret (const main_function $ interactive $ output_file $ dirs $ files)),
Term.info "acgc" ~version:Version.version ~doc ~exits ~man
let _ = main ()
let () =
let () = Log.set_level ~app:"acgc" Logs.Warning in
Term.(exit @@ eval main)
......@@ -77,6 +77,8 @@
(libraries
logs
fmt.tty
cmdliner
logic
acgData
grammars
......
......@@ -107,19 +107,23 @@ let parse_data ?(overwrite=false) ?(output=false) filename includes env =
let () = Logs.err (fun m -> m "%s" (Error.error_msg e filename)) in
None
let pp_error er t =
let pp_error ~color er t =
let () = Utils.sformat "@." in
let _ = Format.flush_str_formatter () in
let s,e = Error.get_loc_error er in
let s',e' = s.Lexing.pos_cnum - s.Lexing.pos_bol,e.Lexing.pos_cnum - e.Lexing.pos_bol in
let t_init = String.sub t 0 s' in
let t_error = Utils.red (String.sub t s' (e'-s')) in
let t_error_wo_color = String.sub t s' (e'-s') in
let t_error =
match color with
| true -> Utils.red t_error_wo_color
| false -> t_error_wo_color in
let end_start_index = (s' + (e'-s')) in
let t_end = String.sub t end_start_index ((String.length t) - end_start_index) in
let () = Logs.err (fun m -> m "%s%s%s" t_init t_error t_end) in
Logs.err (fun m -> m "%s" (Error.error_msg er "stdin"))
let parse_term ?(output=false) t sg =
let parse_term ?(output=false) ~color t sg =
let lexbuf = Lexing.from_string t in
try
let abs_term,abs_type = I.loop_handle (fun x -> x) (fail lexbuf) (supplier lexbuf) (Data_parser.Incremental.term_alone lexbuf.lex_curr_p) sg in
......@@ -146,13 +150,13 @@ let parse_term ?(output=false) t sg =
Some (abs_term,abs_type)
with
| Error.Error er ->
let () = pp_error er t in
let () = pp_error ~color er t in
None
| End_of_file -> None
let parse_heterogenous_term ?(output=false) t lex =
let parse_heterogenous_term ?(output=false) ~color t lex =
let lexbuf = Lexing.from_string t in
let abs,obj=Environment.Lexicon.get_sig lex in
try
......@@ -178,28 +182,28 @@ let parse_heterogenous_term ?(output=false) t lex =
Some (obj_term,abs_type)
with
| Error.Error er ->
let () = pp_error er t in
let () = pp_error ~color er t in
None
| End_of_file -> None
let parse_sig_entry t sg e =
let parse_sig_entry ~color t sg e =
let lexbuf = Lexing.from_string t in
try
Some (I.loop (supplier lexbuf) (Data_parser.Incremental.sig_entry_eoi lexbuf.lex_curr_p) sg e)
with
| Error.Error er ->
let () = pp_error er t in
let () = pp_error ~color er t in
None
| End_of_file -> None
let parse_lex_entry t lex e =
let parse_lex_entry ~color t lex e =
let lexbuf = Lexing.from_string t in
try
Some (I.loop (supplier lexbuf) (Data_parser.Incremental.lex_entry_eoi lexbuf.lex_curr_p) lex e )
with
| Error.Error er ->
let () = pp_error er t in
let () = pp_error ~color er t in
None
| End_of_file -> None
......
......@@ -14,31 +14,37 @@ open AcgData.Environment
to ouput the new environment. *)
val parse_data : ?overwrite:bool -> ?output:bool -> string -> string list -> Environment.t -> Environment.t option
(** [parse_term ~out s sg] parses the term contained in sthe string
[s] according to the signature [sg] and returns [None] if the
parse fails and [Some (term,stype)] where [term] and [stype]
correspond to [s].*)
val parse_term : ?output:bool -> string -> Environment.Signature1.t -> (Lambda.term*Lambda.stype) option
(** [parse_term ~out ~col s sg] parses the term contained in sthe
string [s] according to the signature [sg] and returns [None] if
the parse fails and [Some (term,stype)] where [term] and [stype]
correspond to [s]. If [col] is true, then, in case of error, the
substring corrresponding to this error in the error message is
colored.*)
val parse_term : ?output:bool -> color:bool -> string -> Environment.Signature1.t -> (Lambda.term*Lambda.stype) option
(** [parse_term ~out s lex] parses the term and type contained in sthe
string [s] (in the form of [<term>:<stype>]) according to the
lexicon [lex] and returns [None] if the parse fails and [Some
(term,stype)] where [term] and [stype] correspond to [s]. It is
expected that the term is to be parsed according to the object
signature, and the type according to the abstract signature of
[lex].*)
val parse_heterogenous_term : ?output:bool -> string -> Environment.Lexicon.t -> (Lambda.term*Lambda.stype) option
(** [parse_term ~out ~col s lex] parses the term and type contained in
sthe string [s] (in the form of [<term>:<stype>]) according to the
lexicon [lex] and returns [None] if the parse fails and [Some
(term,stype)] where [term] and [stype] correspond to [s]. It is
expected that the term is to be parsed according to the object
signature, and the type according to the abstract signature of
[lex]. If [col] is true, then, in case of error, the substring
corrresponding to this error in the error message is colored.*)
val parse_heterogenous_term : ?output:bool -> color:bool -> string -> Environment.Lexicon.t -> (Lambda.term*Lambda.stype) option
(** [parse_sig_entry s sg e] parses the signature entry [s] and adds
it to the signature [sg] in the environment [e] and returns [None]
if parsing fails or [Some sg'] where [sg'] is the new
signature. *)
val parse_sig_entry : string -> Environment.Signature1.t -> AcgData.Environment.Environment.t -> Environment.Signature1.t option
(** [parse_sig_entry ~col s sg e] parses the signature entry [s] and
adds it to the signature [sg] in the environment [e] and returns
[None] if parsing fails or [Some sg'] where [sg'] is the new
signature. If [col] is true, then, in case of error, the substring
corrresponding to this error in the error message is colored. *)
val parse_sig_entry : color:bool -> string -> Environment.Signature1.t -> AcgData.Environment.Environment.t -> Environment.Signature1.t option
(** [parse_lex_entry s lex e] parses the lexicon entry [s] and adds it
to the lexicon [lex] in the environment [e] and returns [None] if
parsing fails or [Some lex'] where [lex'] is the new lexicon. *)
val parse_lex_entry : string -> Environment.Lexicon.t -> AcgData.Environment.Environment.t -> Environment.Lexicon.t option
(** [parse_lex_entry ~col s lex e] parses the lexicon entry [s] and adds it
to the lexicon [lex] in the environment [e] and returns [None] if
parsing fails or [Some lex'] where [lex'] is the new lexicon. If
[col] is true, then, in case of error, the substring corrresponding
to this error in the error message is colored.*)
val parse_lex_entry : color:bool -> string -> Environment.Lexicon.t -> AcgData.Environment.Environment.t -> Environment.Lexicon.t option
......@@ -17,56 +17,32 @@
(* *)
(**************************************************************************)
open Cmdliner
open UtilsLib
open Scripting
open Functions
let () = Sys.catch_break true
let dirs = ref [""]
let pp_output = ref true
let svg_output = ref (Some "realize.svg")
let dont_exit_on_end_of_file = ref false
module P = Parse_functions
module F = Functions
let options =
[
("-version", Arg.Unit (fun () -> Printf.printf "%s\n" Version.version;exit 0), " Prints the version number");
("-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";
("-svg"), Arg.String (fun filename -> svg_output:=Some filename), " set the file name of the svg output of the \"realize\" acg command";
("-nsvg"), Arg.Unit (fun () -> svg_output:=None), " toggle off the svg output";
("-realize", Arg.String (fun file -> F.set_config file !dirs), " sets the config rendering for the realize.svg files");
(* ("-b"), Arg.Unit (fun () -> dont_exit_on_end_of_file:=true), " does not exit when reaching the end of the input file"; *)
]
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." (Filename.basename Sys.executable_name)
let welcome_string = "Welcome to the ACG toplevel"
let version_string = Printf.sprintf "Version %s" Version.version
let copyright_string = "©INRIA 2008-2018"
let copyright_string = "©INRIA 2008-2021"
let bug_string = "Please send your comments or bug reports or feature requests to sylvain.pogodalla@inria.fr"
let env = ref AcgData.Environment.Environment.empty
let resize_terminal () =
if !pp_output then
let resize_terminal pp_output =
if pp_output then
let () = Utils.sterm_set_size () in
Utils.term_set_size ()
else
()
let welcome_msg () =
let () = resize_terminal () in
let welcome_msg pp_output =
let () = resize_terminal pp_output in
let l =
let l = Format.get_margin () in
if l > 1000 then
......@@ -87,72 +63,76 @@ let welcome_msg () =
[welcome_string;version_string;copyright_string;bug_string] in
Format.printf "@,@[<v>@[<v15>Type@,help;@]@,@[to@ get@ help.@]@]@,@]@.@?"
let printed_welcome_message = ref false
let print_welcome_message () =
if !printed_welcome_message then
()
else
let () = welcome_msg ()in
printed_welcome_message := true
let anon_fun s =
let () = print_welcome_message () in
let () = resize_terminal () in
let ctx = F.context ~wait:false ~echo:true ~svg:!svg_output ~dirs:!dirs ~parse_fun:P.parse_file in
env := snd (P.parse_file s ctx !env)
let invite () =
let () = Arg.parse options anon_fun usg_msg in
print_welcome_message ()
let main first =
(* ANSITerminal get the size info from stdin In case of redirection,
let rec repeat f (ctx,env) =
match f (ctx,env) with
| P.Continue (c',e') -> repeat f (c',e')
| P.Stop _ -> ()
| exception F.Stop -> ()
| exception F.Quit -> ()
| exception Sys.Break -> ()
| exception End_of_file -> ()
let parse_files dirs svg_output no_color no_pp no_svg svg_config filenames =
let () = Log.set_level ~app:"acg" ~colored:(not no_color) Logs.Warning in
let dirs =
match dirs with
| [""] -> dirs
| _ -> ("")::dirs in
let rendering_config =
match svg_config with
| None -> Rendering_config.default
| Some conf_file -> Rendering_config.get_config conf_file dirs in
let ctx = F.make_context ~wait:false ~colored_output:(not no_color) ~pretty_printed_output:(not no_pp) ~echo:true ~svg:svg_output ~dirs:dirs ~rendering_config ~parse_fun:P.parse_file in
let env = AcgData.Environment.Environment.empty in
(* ANSITerminal get the size info from stdin, In case of redirection,
the latter may not be set. That's why it is first duplicated and
stdin is then duplicated from stdout *)
let stdin_tmp=Unix.dup Unix.stdin in
let stdin_tmp_in_ch = Unix.in_channel_of_descr stdin_tmp in
let () = Unix.dup2 Unix.stdout Unix.stdin in
let () = if first then invite () else () in
let continue = ref true in
let () = resize_terminal () in
while !continue do
try
let ctx = F.context ~wait:false ~echo:true ~svg:!svg_output ~dirs:!dirs ~parse_fun:P.parse_file in
let () = env := snd (P.parse_entry ~resize:!pp_output stdin_tmp_in_ch ctx !env) in
Format.print_flush ()
with
| End_of_file ->
if !dont_exit_on_end_of_file then
()
else
continue:=false
done
let wait = Unix.sleep
let _ =
let () = Log.set_level ~app:"acg" Logs.Warning in
(*let () = Log.set_level ~app:"acg" Logs.Debug in *)
(*
let c = Mtime_clock.counter () in
Logs.info (fun m -> m "Starting run");
let delay1, delay2, delay3 = 1, 2, 4 in
Logs.info (fun m -> m "Start action 1 (%d)." delay1 ~tags:(Log.stamp c));
wait delay1;
Logs.info (fun m -> m "Start action 2 (%d)." delay2 ~tags:(Log.stamp c));
wait delay2;
Logs.info (fun m -> m "Done." ?header:None ~tags:(Log.stamp c));
*)
let () =
try main true with
| F.Stop -> ()
| F.Quit -> ()
| Sys.Break -> () in
Logs.app (fun m -> m "Goodbye.")
let () = welcome_msg (not no_pp) in
try
let ctx',env' =
List.fold_left
(fun (c,e) filename -> P.parse_file filename c e)
(ctx,env)
filenames in
repeat (fun (c,e) -> P.parse_entry ~resize:(F.resize ctx') stdin_tmp_in_ch c e) (ctx',env')
with
| F.Stop -> ()
let parse_files_t =
let doc = "Interactive ACG command interpreter. Also parse and interpret files given on the command line (if any)." in
let dirs =
let doc = "Sets $(docv) as a directory in which file arguments can be looked for." in
Arg.(value & opt_all dir [""] & info ["I";"include"] ~docv:"DIR" ~doc) in
let svg_output =
let doc = "Set the file name of the svg output of the $(i,realize) command to $(docv)." in
Arg.(value & opt (some string) None & info ["svg"] ~docv:"FILE" ~doc) in
let no_color =
let doc = "Toggle off coloring the output." in
Arg.(value & flag & info ["nc";"no-color"] ~doc) in
let no_pp =
let doc = "Toggle off pretty printing the output." in
Arg.(value & flag & info ["npp";"no-pretty-printing"] ~doc) in
let no_svg =
let doc = "Toggle off svg output when running the $(i,realize) command." in
Arg.(value & flag & info ["nsvg";"no-svg"] ~doc) in
let svg_config =
let doc = "Sets the json config rendering file for the svg generated (by the $(i,realize) command) files to $(docv)." in
Arg.(value & opt (some string) None & info ["r";"realize"] ~docv:"FILE" ~doc) in
let man = [
`S Manpage.s_description ;
`P "$(tname) parses each file $(i,FILE) (if any), which is supposed to be a file containing ACG commands, and interpret them. Then interactively run the ACG command interpreter.";
`P "A list of the available commands is available by running the \"help;\" command in the interpreter." ;
`S Manpage.s_bugs;
`P "Report bugs by submitting issues at https://gitlab.inria.fr/ACG/dev/ACGtk/issues.";
`P "Or report bugs to <sylvain.pogodalla@inria.fr>.";
] in
let files = Arg.(value & pos_all string [] & info [] ~docv:"FILE") in
Term.(const parse_files $ dirs $ svg_output $ no_color $ no_pp $ no_svg $ svg_config $ files),
Term.info "acg" ~version:Version.version ~doc ~exits:Term.default_exits ~man
let () =
Term.(exit @@ eval parse_files_t)
This diff is collapsed.
......@@ -79,6 +79,8 @@
(libraries
cairo2
fmt.tty
cmdliner
utilsLib
acgData
grammars
......
This diff is collapsed.
......@@ -27,10 +27,9 @@ sig
type env
type context
(* exception Not_yet_implemented of string*)
exception Stop
exception Quit
type action =
| Load
| List
......@@ -60,13 +59,15 @@ sig
| Object
| Script of (string -> context * env -> context * env)
val color_output : bool -> unit
val color_output : context -> bool -> context
val set_config : context -> string -> string list -> context
val set_config : string -> string list -> unit
val resize : context -> bool
val load : file_type -> string -> context * env -> context * env
val list : env -> unit
val list : context -> env -> unit
val select : string -> (Lexing.position * Lexing.position) -> env -> env
......@@ -77,28 +78,28 @@ sig
val print : ?name:string -> env -> (Lexing.position * Lexing.position) -> unit
val analyse : ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> unit
val analyse : context -> ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> unit
val check : ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> unit
val check : context -> ?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:string -> env -> string -> (Lexing.position * Lexing.position) -> unit
val realize : context -> ?names:(string * (Lexing.position * Lexing.position)) list -> ?svg_output:string -> env -> string -> (Lexing.position * Lexing.position) -> unit
val realize_show : ?names:(string * (Lexing.position * Lexing.position)) list -> ?svg_output:string -> env -> string -> (Lexing.position * Lexing.position) -> unit
val realize_show : ?names:(string * (Lexing.position * Lexing.position)) list -> ?svg_output:string -> context -> env -> string -> (Lexing.position * Lexing.position) -> unit
val parse : ?name:string -> env -> string -> (Lexing.position * Lexing.position) -> unit
val parse : context -> ?name:string -> env -> string -> (Lexing.position * Lexing.position) -> unit
val idb : ?name:string -> env -> (Lexing.position * Lexing.position) -> unit
val query : ?name:string -> env -> string -> (Lexing.position * Lexing.position) -> unit
val query : ?name:string -> context -> env -> string -> (Lexing.position * Lexing.position) -> unit
val add : ?names:(string * (Lexing.position * Lexing.position)) list -> env -> string -> (Lexing.position * Lexing.position) -> env
val add : ?names:(string * (Lexing.position * Lexing.position)) list -> context -> env -> string -> (Lexing.position * Lexing.position) -> env
val compose :
string * (Lexing.position * Lexing.position) ->
string * (Lexing.position * Lexing.position) ->
string * (Lexing.position * Lexing.position) -> env -> env
val context : wait:bool -> echo:bool -> svg:string option -> dirs:string list -> parse_fun:(string -> context -> Environment.t -> context * Environment.t) -> context
val make_context : wait:bool -> colored_output:bool -> pretty_printed_output:bool -> echo:bool -> svg:string option -> dirs:string list -> rendering_config:Rendering_config.config -> parse_fun:(string -> context -> Environment.t -> context * Environment.t) -> context