Miscellanea.

This commit is contained in:
Christian Rinderknecht 2019-07-24 15:43:51 +02:00
parent dc4f14d469
commit fe2c56aedb
4 changed files with 30 additions and 20 deletions

View File

@ -11,18 +11,19 @@ let abort msg =
let printf = Printf.printf
let sprintf = Printf.sprintf
let print = print_endline
(* Help *)
let help () =
let file = Filename.basename Sys.argv.(0) in
printf "Usage: %s [<option> ...] [<input>.mligo | \"-\"]\n" file;
print_endline "where <input>.mligo is the CameLIGO source file (default: stdin),";
print_endline "and each <option> (if any) is one of the following:";
print_endline " -I <paths> Library paths (colon-separated)";
print_endline " --verbose=<phases> Colon-separated phases: cmdline, lexer, parser";
print_endline " --version Send short commit hash to stdout";
print_endline " -h, --help This help";
print "where <input>.mligo is the CameLIGO source file (default: stdin),";
print "and each <option> (if any) is one of the following:";
print " -I <paths> Library paths (colon-separated)";
print " --verbose=<phases> Colon-separated phases: cmdline, lexer, parser";
print " --version Send short commit hash to stdout";
print " -h, --help This help";
exit 0
(* Version *)
@ -99,12 +100,12 @@ let check () =
and libs = !libs in
let () =
if Utils.String.Set.mem "cmdline" verbose then
begin
printf "\nEXPORTED COMMAND LINE\n";
printf "input = %s\n" (string_of quote input);
printf "verbose = %s\n" !verb_str;
printf "I = %s\n" (string_of_path libs)
if Utils.String.Set.mem "cmdline" verbose then
begin
printf "\nEXPORTED COMMAND LINE\n";
printf "input = %s\n" (string_of quote input);
printf "verbose = %s\n" !verb_str;
printf "libs = %s\n" (string_of_path libs)
end
in {input; libs; verbose}

View File

@ -1,9 +1,16 @@
(* Command-line options for CameLIGO *)
(* If the value of [input] is [Some src], the name of the CameLIGO
(* The type [options] gathers the command-line options.
If the field [input] is [Some src], the name of the CameLIGO
source file, with the extension ".mligo", is [src]. If [input] is
[Some "-"] or [None], the source file is read from standard
input. *)
[Some "-"] or [None], the source file is read from standard input.
The field [libs] is made of library paths (colon-separated).
The field [verbose] is a set of stages of the compiler chain,
about which more information may be displayed.
*)
type options = {
input : string option;
@ -11,4 +18,6 @@ type options = {
verbose : Utils.String.Set.t;
}
(* Parsing the command-line options on stdin *)
val read : unit -> options

View File

@ -1,12 +1,12 @@
(* Driver for the lexer of Mini-ML *)
(* Driver for the lexer of CameLIGO *)
(* Error printing and exception tracing *)
Printexc.record_backtrace true;;
let () = Printexc.record_backtrace true
(* Running the lexer on the source *)
let options = EvalOpt.read ();;
let options = EvalOpt.read ()
open EvalOpt;;

View File

@ -1,8 +1,8 @@
(* Driver for the parser of Mini-ML *)
(* Driver for the parser of CameLIGO *)
(* Error printing and exception tracing *)
Printexc.record_backtrace true;;
let () = Printexc.record_backtrace true
(* Reading the command-line options *)