diff options
Diffstat (limited to 'users/glittershark/achilles/src/commands/eval.rs')
-rw-r--r-- | users/glittershark/achilles/src/commands/eval.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/users/glittershark/achilles/src/commands/eval.rs b/users/glittershark/achilles/src/commands/eval.rs deleted file mode 100644 index 61a712c08a8e..000000000000 --- a/users/glittershark/achilles/src/commands/eval.rs +++ /dev/null @@ -1,32 +0,0 @@ -use clap::Clap; - -use crate::codegen; -use crate::interpreter; -use crate::parser; -use crate::tc; -use crate::Result; - -/// Evaluate an expression and print its result -#[derive(Clap)] -pub struct Eval { - /// JIT-compile with LLVM instead of interpreting - #[clap(long)] - jit: bool, - - /// Expression to evaluate - expr: String, -} - -impl Eval { - pub fn run(self) -> Result<()> { - let (_, parsed) = parser::expr(&self.expr)?; - let hir = tc::typecheck_expr(parsed)?; - let result = if self.jit { - codegen::jit_eval::<i64>(&hir)?.into() - } else { - interpreter::eval(&hir)? - }; - println!("{}", result); - Ok(()) - } -} |