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::*; use LLVMIntPredicate::*;
match (self, signed) { match (self, signed) {
(LT, true) => LLVMIntSLT, (LT, true) => LLVMIntSLT,
(LE, true) => LLVMIntSLE,
(GT, true) => LLVMIntSGT, (GT, true) => LLVMIntSGT,
(LE, true) => LLVMIntSLE,
(GE, true) => LLVMIntSGE, (GE, true) => LLVMIntSGE,
(LT, false) => LLVMIntULT, (LT, false) => LLVMIntULT,
(LE, false) => LLVMIntULE,
(GT, false) => LLVMIntUGT, (GT, false) => LLVMIntUGT,
(LE, false) => LLVMIntULE,
(GE, false) => LLVMIntUGE, (GE, false) => LLVMIntUGE,
(EQ, _) => LLVMIntEQ, (EQ, _) => LLVMIntEQ,
(NE, _) => LLVMIntNE, (NE, _) => LLVMIntNE,

View File

@ -1,12 +1,12 @@
// Main // Main
fn main() -> bool { fn main() -> bool {
return 2 == fibonacci(3); return 1 == fibonacci(3);
} }
// Fibonacci // Fibonacci
fn fibonacci(value: u16) -> u16 { fn fibonacci(value: u16) -> u16 {
if value <= 2 { if value < 3 {
return 1; 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 { match self {
mir::LogicOperator::LT => CmpPredicate::LT, mir::LogicOperator::LT => CmpPredicate::LT,
mir::LogicOperator::GT => CmpPredicate::GT, mir::LogicOperator::GT => CmpPredicate::GT,
mir::LogicOperator::LE => CmpPredicate::LE, mir::LogicOperator::LE => CmpPredicate::LT,
mir::LogicOperator::GE => CmpPredicate::GE, mir::LogicOperator::GE => CmpPredicate::GE,
mir::LogicOperator::EQ => CmpPredicate::EQ, mir::LogicOperator::EQ => CmpPredicate::EQ,
mir::LogicOperator::NE => CmpPredicate::NE, 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(); let mut tokens = Vec::new();
while let Some(character) = &cursor.next() { 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 { let variant = match character {
// Whitespace // Whitespace
w if w.is_whitespace() => continue, 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 { tokens.push(FullToken {
token: variant, token: variant,
position, position: cursor.position,
}); });
} }