Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions compiler/compilerScript.sml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ OPTIONS:

--pancake takes a pancake program as input

--no_warn silences pancake warning output

--main_return=B here B can be either true or false; the default is
false; setting this to true causes the main function to
return to caller instead of exit; this option is
Expand Down Expand Up @@ -629,10 +631,11 @@ Definition parse_top_config_def:
let typeinference = find_bool (strlit"--skip_type_inference=") ls F in
let sexpprint = MEMBER (strlit"--print_sexp") ls in
let onlyprinttypes = MEMBER (strlit"--types") ls in
let nowarnings = MEMBER (strlit"--no_warn") ls in
let mainreturn = find_bool (strlit"--main_return=") ls F in
case (sexp,prelude,typeinference,mainreturn) of
(INL sexp,INL prelude,INL typeinference,INL mainreturn) =>
INL (sexp,prelude,typeinference,onlyprinttypes,sexpprint,mainreturn)
INL (sexp,prelude,typeinference,onlyprinttypes,sexpprint,mainreturn,nowarnings)
| _ => INR (concat [
get_err_str sexp;
get_err_str prelude;
Expand Down Expand Up @@ -678,7 +681,7 @@ Definition compile_64_def:
let confexp = parse_target_64 cl in
let topconf = parse_top_config cl in
case (confexp,topconf) of
(INL (conf,export), INL(sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret)) =>
(INL (conf,export), INL(sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret,nowarn)) =>
(let ext_conf = extend_conf cl conf in
case ext_conf of
INL ext_conf =>
Expand Down Expand Up @@ -714,21 +717,21 @@ Definition compile_pancake_64_def:
let topconf = parse_top_config cl in
case (topconf) of
| INR err => (List[], error_to_str (ConfigError err))
| INL (sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret) =>
| INL (sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret,nowarn) =>
let ext_conf = extend_conf cl conf in
case ext_conf of
| INR err =>
(List[], error_to_str (ConfigError (get_err_str ext_conf)))
| INL ext_conf =>
case compiler$compile_pancake ext_conf input of
| (Failure err, td, warns) =>
(List[], concat (MAP error_to_str (err::warns)))
(List[], concat (MAP error_to_str (err::(if nowarn then [] else warns))))
| (Success (bytes, data, c), td, warns) =>
(add_tap_output td
(export (ffinames_to_string_list $
the [] c.lab_conf.ffi_names) bytes data c.symbols
c.exported mainret T),
concat (MAP error_to_str warns))
concat (MAP error_to_str (if nowarn then [] else warns)))
End

Definition full_compile_64_def:
Expand All @@ -752,7 +755,7 @@ Definition compile_32_def:
let confexp = parse_target_32 cl in
let topconf = parse_top_config cl in
case (confexp,topconf) of
(INL (conf,export), INL(sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret)) =>
(INL (conf,export), INL(sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret,nowarn)) =>
(let ext_conf = extend_conf cl conf in
case ext_conf of
INL ext_conf =>
Expand Down Expand Up @@ -788,21 +791,21 @@ Definition compile_pancake_32_def:
let topconf = parse_top_config cl in
case (topconf) of
| INR err => (List[], error_to_str (ConfigError err))
| INL (sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret) =>
| INL (sexp,prelude,typeinfer,onlyprinttypes,sexpprint,mainret,nowarn) =>
let ext_conf = extend_conf cl conf in
case ext_conf of
| INR err =>
(List[], error_to_str (ConfigError (get_err_str ext_conf)))
| INL ext_conf =>
case compiler$compile_pancake ext_conf input of
| (Failure err, td, warns) =>
(List[], concat (MAP error_to_str (err::warns)))
(List[], concat (MAP error_to_str (err::(if nowarn then [] else warns))))
| (Success (bytes, data, c), td, warns) =>
(add_tap_output td
(export (ffinames_to_string_list $
the [] c.lab_conf.ffi_names) bytes data c.symbols
c.exported mainret T),
concat (MAP error_to_str warns))
concat (MAP error_to_str (if nowarn then [] else warns)))
End

Definition full_compile_32_def:
Expand Down