【Hacker News搬运】为什么我喜欢Rust的标记和解析
-
Title: Why I love Rust for tokenising and parsing
为什么我喜欢Rust的标记和解析
Text:
Url: https://xnacly.me/posts/2024/rust-pldev/
很抱歉,作为一个AI,我无法直接访问外部链接。因此,我无法查看您提供的链接内容,也无法进行抓取、分析和总结。 如果您能提供该链接的内容或其摘要,我可以尝试帮助您进行分析和总结。如果您需要将非中文内容翻译成中文,您可以提供原文,我将尽力提供翻译。
Post by: thunderbong
Comments:
tptacek: 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.<p>Again: not throwing shade. I think this is a place where Rust is genuinely quite strong.
tptacek: 所以,首先,我用Rust编写了一个eBPF反汇编器和(半心半意的)模拟器,我也发现它是一种令人愉快的语言来解析类型的东西;第六步进入他们的案例研究。宏不是;不完全是代码生成,但它也没有;我也不太想在语言中习惯性地工作<p> 再次强调:不要投阴影。我认为这是Rust真正强大的地方。
sksxihve: I've found that the logos crate is really nice for writing lexers in rust<p><a href="https://docs.rs/logos/0.14.2/logos/" rel="nofollow">https://docs.rs/logos/0.14.2/logos/</a>
sksxihve: 我;我发现logos crate非常适合在rust中编写词法分析器<p><a href=“https:”docs.rs“logos”0.14.2“logo”rel=“nofollow”>https:”/;docs.rs;徽标;0.14.2℉;徽标</一
jamra: Does anyone have a good EBNF notation for Sqlite? I tried to make a tree-sitter grammar, which produces C code and great Rust bindings for it. But they use some lemon parser. Not sure how to read the grammar from that.
jamra: 有人对Sqlite有一个好的EBNF表示法吗?我试图制作一个树形语法,它可以生成C代码和很棒的Rust绑定。但他们使用了一些柠檬解析器。不知道该怎么读语法。
hu3: Related, I love Rob Pike's talk about lexical Scanning in Go (2011).<p>Educational and elegant approach.<p><a href="https://www.youtube.com/watch?v=HxaD_trXwRE" rel="nofollow">https://www.youtube.com/watch?v=HxaD_trXwRE</a>
hu3: 相关,我喜欢Rob Pike;我们来谈谈Go中的词汇扫描(2011)<p> 教育和优雅的方法<p> <a href=“https:”www.youtube.com“观看?v=HxaD_trXwRE”rel=“nofollow”>https:”/;www.youtube.com;看?v=HxaD_trXwRE</a>