DEV Community


Discussion on: Translating Rust to other languages (Pt 1- Context Free Grammar)

benaryorg profile image

I wonder whether you could use Rust's macro system for the AST creation.
I mean, it already builds an AST there, so you could use a macro that exposes a text version of the AST directly from the Rust compiler.
That way you wouldn't need to re-define the language externally.…

living_syn profile image
Jeremy Mill Author

Yup, I think you could. Other people suggested this on Reddit as well. This was fun to write though, and relatively quick