feat: init
This commit is contained in:
23
nix-js-macros/src/lib.rs
Normal file
23
nix-js-macros/src/lib.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
//! This crate provides procedural macros for the nixjit project.
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
mod builtins;
|
||||
mod ir;
|
||||
|
||||
/// A procedural macro to reduce boilerplate when defining an Intermediate Representation (IR).
|
||||
///
|
||||
/// It generates an enum for the IR, along with `Ref` and `Mut` variants,
|
||||
/// `From` implementations, and a `ToIr` trait.
|
||||
#[proc_macro]
|
||||
pub fn ir(input: TokenStream) -> TokenStream {
|
||||
ir::ir_impl(input)
|
||||
}
|
||||
|
||||
/// A procedural macro attribute to simplify the definition of built-in functions.
|
||||
///
|
||||
/// It generates the necessary boilerplate to wrap functions and expose them
|
||||
/// to the evaluation engine, handling argument type conversions and arity checking.
|
||||
#[proc_macro_attribute]
|
||||
pub fn builtins(_attr: TokenStream, input: TokenStream) -> TokenStream {
|
||||
builtins::builtins_impl(input)
|
||||
}
|
||||
Reference in New Issue
Block a user