From 17021634783e736273c7c25b93cac19a3fa0b978 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 16 Jan 2017 02:47:05 -0800 Subject: [PATCH] Add flag for llvm --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index e498324..5c55751 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,9 +30,10 @@ fn main() { } }; let trace = option_matches.opt_present("t"); + let show_llvm = option_matches.opt_present("l"); match option_matches.free[..] { [] | [_] => { - let mut repl = Repl::new(trace); + let mut repl = Repl::new(trace, show_llvm); repl.run(); } [_, ref filename, _..] => { @@ -49,6 +50,9 @@ fn program_options() -> getopts::Options { options.optflag("t", "trace-evaluation", "Print out trace of evaluation"); + options.optflag("l", + "llvm-in-repl", + "Show LLVM IR in REPL"); options } @@ -96,13 +100,13 @@ struct Repl<'a> { } impl<'a> Repl<'a> { - fn new(trace_evaluation: bool) -> Repl<'a> { + fn new(trace_evaluation: bool, show_llvm: bool) -> Repl<'a> { let mut reader: linefeed::Reader<_> = linefeed::Reader::new("Schala").unwrap(); reader.set_prompt(">> "); Repl { show_tokens: false, show_parse: false, - show_llvm_ir: false, + show_llvm_ir: show_llvm, evaluator: Evaluator::new_with_opts(None, trace_evaluation), interpreter_directive_sigil: '.', reader: reader,