1
0
Fork 0
forked from koniifer/ableos
ableos-framebuffer/hblang/src/lib.rs

32 lines
692 B
Rust

#![feature(noop_waker)]
#![feature(macro_metavar_expr)]
#![feature(let_chains)]
#![allow(dead_code)]
#![feature(const_mut_refs)]
#[macro_export]
macro_rules! run_tests {
($runner:path: $($name:ident => $input:expr;)*) => {$(
#[test]
fn $name() {
$crate::tests::run_test(std::any::type_name_of_val(&$name), $input, $runner);
}
)*};
}
pub mod codegen;
mod ident;
mod instrs;
mod lexer;
mod log;
pub mod parser;
mod tests;
mod typechk;
#[inline]
unsafe fn encode<T>(instr: T) -> (usize, [u8; instrs::MAX_SIZE]) {
let mut buf = [0; instrs::MAX_SIZE];
std::ptr::write(buf.as_mut_ptr() as *mut T, instr);
(std::mem::size_of::<T>(), buf)
}