HigherOrderCO / HVM

A massively parallel, optimal functional runtime in Rust

Home Page:https://higherorderco.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using HVM as transformation engine for Proc-Macros?

frehberg opened this issue · comments

Implementing Proc-Macros with Rust, the Rust-code may become a bit cryptic. I would prefer a clear declarative form, using pattern matching etc. to transform an input TokenStream into an output TokenStream.
So, do you think it would make any sense to implement an TokenStream Adapter for the HVM-runtime, so that the HVM runtime + HVM-App would realize the transformation?

This might look like

const TOKEN_STREAM_TRANSFORM_FUNCTION : &str = "
..
(Derive token_stream) = ...
";

#[proc_macro_derive(AnswerFn)]
pub fn derive_answer_fn(_item: TokenStream) -> TokenStream {
     let token_stream_value: HvmTokenStream = item.into()
     hvm::execute(TOKEN_STREAM_TRANSFORM_FUNCTION, token_stream_value).into()
}

What do you think?