Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

whoa, so you can write like a DSL parser using the rust macro matcher syntax?


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


And then there are the Rust macros that let you write code in Lisp syntax, although I don't recall that any of them had a defmacro form…


Oh god, what have I seen


I'm sorry; I should have thought about the more sensitive readers.


rust 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




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: