Skip to content

Commit

Permalink
chore: docs and remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakFarmer committed Nov 3, 2023
1 parent 40899f6 commit 2acb862
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 45 deletions.
17 changes: 0 additions & 17 deletions codegen/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,4 @@ impl<'ink, 'b> ExpressionBuilder<'ink, 'b> {

BasicValueEnum::IntValue(result)
}

/// Build an infix expression
fn build_add_infix_expression<'ctx>(
&'ctx self,
left: BasicValueEnum<'ctx>,
right: BasicValueEnum<'ctx>,
) -> BasicValueEnum<'ctx> {
match left {
BasicValueEnum::IntValue(left) => match right {
BasicValueEnum::IntValue(right) => {
BasicValueEnum::IntValue(self.llvm.builder.build_int_add(left, right, "add"))
}
_ => panic!("Expected IntValue for right operand"),
},
_ => panic!("Expected IntValue for left operand"),
}
}
}
28 changes: 0 additions & 28 deletions llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,34 +99,6 @@ impl<'ctx> Llvm<'ctx> {
self.builder.build_alloca(*data_type, name)
}

// /// Compile a node
// pub fn compile(&self, ast: &Node) -> Result<i32, Error> {
// let bool_type = self.context.bool_type();
// let i32_type = self.context.i32_type();

// let main_function_type = i32_type.fn_type(&[], false);
// let main_function = self.module.add_function("main", main_function_type, None);

// let basic_block = self.context.append_basic_block(main_function, "entry");

// self.builder.position_at_end(basic_block);

// // Build the program
// let recursive_builder = RecursiveBuilder::new(bool_type, i32_type, &self.builder);

// let return_value = recursive_builder.build(ast);

// _ = self.builder.build_return(Some(&return_value));

// // unsafe {
// // let jit_function: JitFunction<'_, MainFn> =
// // self.execution_engine.get_function("main")
// // .expect("Unable to find main function");

// // Ok(jit_function.call())
// // }
// }

pub fn load_pointer(&self, pointer: &PointerValue<'ctx>, name: &str) -> BasicValueEnum<'ctx> {
self.builder.build_load(self.i32_type(), *pointer, name)
}
Expand Down
1 change: 1 addition & 0 deletions token/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// A type of token in the PHP language
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub enum TokenType {
Illegal,
Expand Down

0 comments on commit 2acb862

Please sign in to comment.