docs: 添加 Rustdoc 注释

This commit is contained in:
爱特每羊队
2026-08-05 21:46:47 +08:00
parent bbdfca1a1c
commit f461235f04
158 changed files with 1440 additions and 15 deletions
+6
View File
@@ -1,16 +1,22 @@
//! 编译入口:`Compiler::compile` 串联 emit 与 lowering。
use oxide_bytecode::module::CompiledModule;
use oxide_emit::Emitter;
use oxide_ir::lower::lower;
/// 结构哈希 / 编译模块哈希 re-export(供编译缓存作键)。
pub use crate::hash::{compiled_module_hash, structural_hash};
/// 编译入口(marker 类型):无状态,编译状态在 emit/lower 内部。
pub struct Compiler;
impl Compiler {
/// 构造 `Compiler`(无状态,恒返回空实例)。
pub fn new() -> Self {
Self
}
/// 编译整个 program:AST → IR(`Emitter::emit_program`)→ bytecode(`lower`)。
pub fn compile(&self, program: &oxide_parser::Program) -> Result<CompiledModule, String> {
crate::compiler_debug!("compile: starting...");
let ir = Emitter::new().emit_program(program)?;