logoalt Hacker News

vermilinguayesterday at 11:41 PM4 repliesview on HN

Claims to have all the syntax covered, but not a single example of specifying lifetimes or the turbofish, some of the trickiest rust syntax


Replies

kibwentoday at 12:05 AM

If you already have the ability to express the grammar productions in Rust that allow for optionally-specified types (e.g. variable declaration), then you have the ability to express lifetimes and the turbofish (which is just a curious way to call a generic function with a specific type parameter). The only weird thing would be that Lisp uses the apostrophe character for something very different than Rust, but you could just pick any other way to denote lifetimes.

show 1 reply
kccqzytoday at 1:38 AM

The HRTB is probably the trickiest syntax for specifying lifetimes. It looks like `for<'a> F: Fn(&'a (u8, u16)) -> &'a u8`.

show 1 reply
thatxlinertoday at 3:15 AM

You can also drop into direct Rust with the (rust "...") macro if I forgot to implement anything

andrepdyesterday at 11:52 PM

It's a vibecoded parser...

show 1 reply