2025-09-17 07:43:07 +09:00
|
|
|
use crate::box_trait::{IntegerBox, NyashBox};
|
2025-09-14 00:44:28 +09:00
|
|
|
use crate::mir::function::MirModule;
|
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
pub struct LLVMCompiler {
|
|
|
|
|
values: HashMap<crate::mir::ValueId, Box<dyn NyashBox>>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl LLVMCompiler {
|
|
|
|
|
pub fn new() -> Result<Self, String> {
|
2025-09-17 07:43:07 +09:00
|
|
|
Ok(Self {
|
|
|
|
|
values: HashMap::new(),
|
|
|
|
|
})
|
2025-09-14 00:44:28 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn compile_module(&self, _mir: &MirModule, _out: &str) -> Result<(), String> {
|
|
|
|
|
// Mock: pretend emitted
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-17 07:43:07 +09:00
|
|
|
pub fn compile_and_execute(
|
|
|
|
|
&mut self,
|
|
|
|
|
_mir: &MirModule,
|
|
|
|
|
_out: &str,
|
|
|
|
|
) -> Result<Box<dyn NyashBox>, String> {
|
2025-09-14 00:44:28 +09:00
|
|
|
Ok(Box::new(IntegerBox::new(0)))
|
|
|
|
|
}
|
|
|
|
|
}
|