2024-05-09 16:41:59 -05:00
|
|
|
#![feature(noop_waker)]
|
2024-05-11 15:22:08 -05:00
|
|
|
#![feature(macro_metavar_expr)]
|
2024-05-10 15:54:12 -05:00
|
|
|
#![feature(let_chains)]
|
2024-05-10 08:29:11 -05:00
|
|
|
#![feature(non_null_convenience)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
|
2024-05-09 16:41:59 -05:00
|
|
|
#[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);
|
|
|
|
}
|
|
|
|
)*};
|
|
|
|
}
|
|
|
|
|
2024-05-12 17:02:32 -05:00
|
|
|
pub mod codegen;
|
2024-05-10 14:33:42 -05:00
|
|
|
mod ident;
|
|
|
|
mod instrs;
|
2024-05-09 16:41:59 -05:00
|
|
|
mod lexer;
|
2024-05-11 15:22:08 -05:00
|
|
|
mod log;
|
2024-05-12 17:02:32 -05:00
|
|
|
pub mod parser;
|
2024-05-09 16:41:59 -05:00
|
|
|
mod tests;
|
|
|
|
mod typechk;
|
|
|
|
|
2024-05-11 05:51:32 -05:00
|
|
|
#[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)
|
2024-05-09 16:41:59 -05:00
|
|
|
}
|