Compare commits

..

No commits in common. "8afb2c2572d1075766db5ac006396bfb24d4f272" and "d5daaa0e870426d1acd2969371efea2b7745fa7a" have entirely different histories.

4 changed files with 7 additions and 10 deletions

View File

@ -359,12 +359,12 @@ impl CmpPredicate {
use LLVMIntPredicate::*;
match (self, signed) {
(LT, true) => LLVMIntSLT,
(LE, true) => LLVMIntSLE,
(GT, true) => LLVMIntSGT,
(LE, true) => LLVMIntSLE,
(GE, true) => LLVMIntSGE,
(LT, false) => LLVMIntULT,
(LE, false) => LLVMIntULE,
(GT, false) => LLVMIntUGT,
(LE, false) => LLVMIntULE,
(GE, false) => LLVMIntUGE,
(EQ, _) => LLVMIntEQ,
(NE, _) => LLVMIntNE,

View File

@ -1,12 +1,12 @@
// Main
fn main() -> bool {
return 2 == fibonacci(3);
return 1 == fibonacci(3);
}
// Fibonacci
fn fibonacci(value: u16) -> u16 {
if value <= 2 {
if value < 3 {
return 1;
}
return fibonacci(value - 1) + fibonacci(value - 2);
return 5 + fibonacci(value - 2);
}

View File

@ -291,7 +291,7 @@ impl mir::LogicOperator {
match self {
mir::LogicOperator::LT => CmpPredicate::LT,
mir::LogicOperator::GT => CmpPredicate::GT,
mir::LogicOperator::LE => CmpPredicate::LE,
mir::LogicOperator::LE => CmpPredicate::LT,
mir::LogicOperator::GE => CmpPredicate::GE,
mir::LogicOperator::EQ => CmpPredicate::EQ,
mir::LogicOperator::NE => CmpPredicate::NE,

View File

@ -134,9 +134,6 @@ pub fn tokenize<T: Into<String>>(to_tokenize: T) -> Result<Vec<FullToken>, Error
let mut tokens = Vec::new();
while let Some(character) = &cursor.next() {
// Save "current" token first character position
let position = (cursor.position.0 - 1, cursor.position.1);
let variant = match character {
// Whitespace
w if w.is_whitespace() => continue,
@ -207,7 +204,7 @@ pub fn tokenize<T: Into<String>>(to_tokenize: T) -> Result<Vec<FullToken>, Error
tokens.push(FullToken {
token: variant,
position,
position: cursor.position,
});
}