Thanks. I wasn't so much looking to make a DSL as I was making a code generator that spits out Rust code. It could be called and executed at runtime, or spit out code to stdout or to a file for later compilation. I just don't know how practical it is to build a big string and then "inject" it into the current runtime like rust-repl does it.
On Wed, Oct 24, 2012 at 7:04 AM, Lucian Branescu <[email protected]>wrote: > On 22 October 2012 20:28, Chad Retz <[email protected]> wrote: > > I am very new to Rust, but I have a little project where I'd like to > compile > > something else into Rust code. I have seen the macro syntax which doesn't > > operate on pure strings (from what I see) and I have seen projects like > > rust-repl that parse and inject at runtime. Which approach should I take > if > > I want to be able to transpile both to a string to save into a file and > to > > use it at runtime depending on what the user wants? (I have done this in > D, > > yet the mixins there work with strings natively so there is no real > decision > > to make). > > Rust's macro system won't let you implement a DSL that is very > different from rust itself. > You could express the language as function calls, which you could do > at runtime or from a macro. >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
