Am I getting paranoid or does this text read very LLMish?
I tried to nail down ubiiquitous formatting for a typed nl-like sexpr language I have been mostly vibe coding.
It is surprisingly hard. I ended up mostly copying the algorithm that can be used through raco (the racket command line tool). It is not particularly fast, only about 10lines of code per core-second, but it produces a good enough result. I had to leave some things to the user, but only about 5 forms.
I've been tinkering with common lisp again lately (via VSCode) and I've been looking for something like this! Going to play with it this weekend.
Lisp people: Look at the elegance and simplicity of S-expressions! Isn't it a beauty?
Also Lisp people: Here is a thesis-sized article about formatting them properly O:)
i once have written a lisp parser for some static analysy tool. in the end i read the code backwards, nade things more easy. cant rember why
Question for the author: how does Sift decide indentation for user-defined macros? Since the right layout for a form like `with-foo` or `my-let` depends on how it is defined (body-style vs. plain call), I'd be curious whether you ship a fixed table of known forms, read indent hints from the source, or let users configure it per project. For a formatter that runs in CI, I'd guess predictability matters more than being perfectly right for every macro.
A tool I've found really valuable when writing Lisp is https://github.com/shcv/parenmedic
It compares the indentation to the parentheses, and complains if they don't agree. It doesn't care about indentation amount (like I-expressions/Wisp/etc.), only that lines following some opened parens get indented more; lines following some closed parens get indented less; and sibling lines are indented the same amount.
I find this much more accurate at spotting the cause of a problem, compared to simply counting whether the openers and closers balance; e.g. the latter will only spot a missing close parenthesis when it reaches the end of the file. This is especially useful for LLMs, which are terrible at counting parentheses.
Unfortunately, there can be some cases where an auto-indenter (e.g. elisp-autofmt) causes parenmedic to complain. One remedy is to alter the auto-indenter's behaviour by inserting a line-comment; but it's not ideal.
I wonder whether Sift would (knowingly or unknowingly) adhere to the rules parenmedic requires?