tipi-lang/src/lib.rs
2025-10-30 13:50:28 +01:00

20 lines
474 B
Rust

use std::collections::HashMap;
use crate::scanner::scan;
pub mod ast_compiler;
pub mod bytecode_compiler;
pub mod chunk;
mod keywords;
pub mod scanner;
mod compiler_tests;
mod tokens;
mod value;
pub mod vm;
pub fn compile(src: &str) -> anyhow::Result<chunk::Chunk> {
let tokens = scan(src)?;
let mut registry = HashMap::new();
let ast= ast_compiler::compile(tokens)?;
let bytecode = bytecode_compiler::compile("", &ast, &mut registry)?;
Ok(bytecode)
}