2024-05-09 16:41:59 -05:00
|
|
|
#![feature(noop_waker)]
|
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);
|
|
|
|
}
|
|
|
|
)*};
|
|
|
|
}
|
|
|
|
|
|
|
|
mod codegen;
|
2024-05-10 14:33:42 -05:00
|
|
|
mod ident;
|
|
|
|
mod instrs;
|
2024-05-09 16:41:59 -05:00
|
|
|
mod lexer;
|
|
|
|
mod parser;
|
|
|
|
mod tests;
|
|
|
|
mod typechk;
|
|
|
|
|
2024-05-10 14:33:42 -05:00
|
|
|
#[repr(packed)]
|
|
|
|
struct Args<A, B, C, D>(u8, A, B, C, D);
|
|
|
|
fn as_bytes<T>(args: &T) -> &[u8] {
|
|
|
|
unsafe { core::slice::from_raw_parts(args as *const _ as *const u8, core::mem::size_of::<T>()) }
|
|
|
|
}
|
|
|
|
|
2024-05-09 16:41:59 -05:00
|
|
|
pub fn try_block<R>(f: impl FnOnce() -> R) -> R {
|
|
|
|
f()
|
|
|
|
}
|