top | item 44295096

Show HN: Sexprs – Lisp dialect written in Rust

26 points| gfalcao | 9 months ago |github.com | reply

5 comments

order
[+] uncircle|9 months ago|reply
The code in the screenshot/asciinema isn't s-expr by any common conception of the term, or as a Lisp would parse it.

  (flatten '( '(a '( b)) '( c   d)))
That argument to flatten is in fact [macroexpanding manually, forgive errors]

  '((quote (a (quote (b)))) (quote c d))
which flattens to

  '(quote a quote b quote c d)
---

Parsing sexprs is quite easy, no need to use a complex parser generator. The core of parsing sexprs is you have a "read_list" function, which accumulates values until it finds a ')', and whenever you encounter a '(' character, you recurse into that same read_list function. You don't even need a lexer.

Also, this is divided in 8 crates for some reason... don't take this the wrong way, but is it the result of vibe coding?

[+] mplanchard|9 months ago|reply
Doesn’t seem vibe coded to me. The crates aren’t unreasonable: data structures, parser, formatter, repl, “util,” some proc macros (which have to be in a separate crate in rust), and a VM.
[+] junon|9 months ago|reply
Haha, funny. I also wrote something similar for working with KiCad files, naming it Sexprs, also in Rust. I was worried someone had found it and posted it here.

Is there a way to modify and re-emit them at runtime? Seems neat, but the readme is lacking.

[+] s1mplicissimus|9 months ago|reply

[deleted]

[+] Y_Y|9 months ago|reply
I think keyword filters haven't managed to prevent widespread awareness of sex. News of sex has even reached Scunthorpe.
[+] 3836293648|9 months ago|reply
This is lisp. S-expressions are almost always spelled sexp and it's been like that since the 50s. This is not a real issue