diff --git a/src/codegen/expressions.rs b/src/codegen/expressions.rs index 242c5b7..fa30731 100644 --- a/src/codegen/expressions.rs +++ b/src/codegen/expressions.rs @@ -17,50 +17,20 @@ pub fn compile_expr<'ctx: 'parent, 'parent>( block: &'parent Block<'ctx>, expr: &Expr, ) -> Value<'ctx, 'parent> { - let location = Location::unknown(ctx.ctx); - let i64_type: Type = IntegerType::new(ctx.ctx, 64).into(); match expr { - Expr::Number(value) => { - let value = block - .append_operation(arith::constant( - ctx.ctx, - IntegerAttribute::new(IntegerType::new(ctx.ctx, 64).into(), *value).into(), - location, - )) - .result(0) - .unwrap() - .into(); - - value + Expr::Number(_value) => { + todo!() } Expr::Variable(name) => { - let local_ptr = *locals.get(name).unwrap(); - let value = block - .append_operation(llvm::load( - ctx.ctx, - local_ptr, - i64_type, - location, - Default::default(), - )) - .result(0) - .unwrap() - .into(); - - value - } - Expr::Op(lhs_expr, opcode, rhs_expr) => { - let lhs = compile_expr(ctx, locals, block, lhs_expr); - let rhs = compile_expr(ctx, locals, block, rhs_expr); - - match opcode { - Opcode::Mul => todo!(), - Opcode::Div => todo!(), - Opcode::Add => todo!(), - Opcode::Sub => todo!(), - Opcode::Eq => todo!(), - Opcode::Neq => todo!(), - } + todo!() } + Expr::Op(lhs_expr, opcode, rhs_expr) => match opcode { + Opcode::Mul => todo!(), + Opcode::Div => todo!(), + Opcode::Add => todo!(), + Opcode::Sub => todo!(), + Opcode::Eq => todo!(), + Opcode::Neq => todo!(), + }, } } diff --git a/src/codegen/ifelse_stmt.rs b/src/codegen/ifelse_stmt.rs index b2725da..ab3771a 100644 --- a/src/codegen/ifelse_stmt.rs +++ b/src/codegen/ifelse_stmt.rs @@ -15,5 +15,5 @@ pub fn compile_if<'ctx, 'parent>( block: &'parent Block<'ctx>, stmt: &IfStmt, ) { - let cond = compile_expr(ctx, locals, block, &stmt.cond); + todo!() } diff --git a/src/codegen/let_stmt.rs b/src/codegen/let_stmt.rs index bd9c9b5..a2a2f37 100644 --- a/src/codegen/let_stmt.rs +++ b/src/codegen/let_stmt.rs @@ -12,6 +12,5 @@ pub fn compile_let<'ctx: 'parent, 'parent>( block: &'parent Block<'ctx>, stmt: &LetStmt, ) { - let value = compile_expr(ctx, locals, block, &stmt.expr); - locals.insert(stmt.variable.clone(), value); + todo!() } diff --git a/src/codegen/return_stmt.rs b/src/codegen/return_stmt.rs index 0ff307c..3fc51c0 100644 --- a/src/codegen/return_stmt.rs +++ b/src/codegen/return_stmt.rs @@ -12,4 +12,5 @@ pub fn compile_return<'ctx, 'parent>( block: &'parent Block<'ctx>, stmt: &ReturnStmt, ) { + todo!() }