From f9b1184f1823231c1aef273c9390715bfebdab70 Mon Sep 17 00:00:00 2001 From: MCorange Date: Mon, 13 Mar 2023 23:33:06 +0200 Subject: [PATCH] fixed lt and gt --- src/interpret/linux_x86_64.rs | 4 ++-- test.mcl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interpret/linux_x86_64.rs b/src/interpret/linux_x86_64.rs index d5ac5bb..f25a6dc 100644 --- a/src/interpret/linux_x86_64.rs +++ b/src/interpret/linux_x86_64.rs @@ -42,14 +42,14 @@ pub fn run(tokens: Vec) -> Result<(), &'static str>{ ti += 1; }, OpType::Gt => { - let a = stack_pop(&mut stack)?; let b = stack_pop(&mut stack)?; + let a = stack_pop(&mut stack)?; stack.push((a > b) as i32); ti += 1; }, OpType::Lt => { - let a = stack_pop(&mut stack)?; let b = stack_pop(&mut stack)?; + let a = stack_pop(&mut stack)?; stack.push((a < b) as i32); ti += 1; }, diff --git a/test.mcl b/test.mcl index ac1e00b..ab3029f 100644 --- a/test.mcl +++ b/test.mcl @@ -1,4 +1,4 @@ -1 2 < if +2 1 < if 1 print else 0 print