DEV Community

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

Collapse
 
benaryorg profile image
#benaryorg

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.…

Collapse
 
living_syn profile image
Jeremy Mill

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