logoalt Hacker News

tptacek11/08/20243 repliesview on HN

So, just to kick this off: I wrote an eBPF disassembler and (half-hearted) emulator in Rust and I also found it a pleasant language to do parsing-type stuff in. But: I think the author cuts against their argument when they manage to necessitate a macro less than 1/6th of the way into their case study. A macro isn't quite code-gen, but it also doesn't quite feel like working idiomatically within the language, either.

Again: not throwing shade. I think this is a place where Rust is genuinely quite strong.


Replies

thesz11/08/2024

How can one define an infinite grammar in Rust?

E.g., a context-free rule S ::= abc|aabbcc|aaabbbccc|... can effectively parse a^Nb^Nc^N which is an example of context-sensitive grammar.

This is a simple example, but something like that can be seen in practice. One example is when language allows definition of operators.

So, how does Rust handle that?

show 2 replies
jamra11/08/2024

Link us your eBPF disassembler if you can. Sounds cool.

show 1 reply