4 ms·
whoa, so you can write like a DSL parser using the rust macro matcher syntax?
by devxpy 6y ago
whoa, so you can write like a DSL parser using the rust macro matcher syntax?
- dgb23 6y agoEssentially yes. Macros in Rust are very powerful, similar to Lisp macros (although they are naturally clunkier). As you would expect, you will find macros for HTML, JSON etc. in libraries, but there are also quite a bunch of smaller, frequent macros that simply reduce common boilerplate.
- nulptr 6y agorust allows for procedural macros (basically a function that takes a token stream and returns a token stream, and yes you can do parsing in this funciton https://doc.rust-lang.org/reference/procedural-macros.html https://doc.rust-lang.org/reference/procedural-macros.html
- deleted 6y ago[deleted]