5 ms·
Use S-Expressions?
by eru 4y ago
Use S-Expressions?
- usrnm 4y agoWith each tool using its own macro-based DSL for managing them. That would be fun
- jerf 4y agoI know what s-expressions are, vaguely. Vaguely in terms of "I couldn't write a grammar for them off the top of my head.", that is, not "what are they". Is there a single agreed-upon defined grammar that everyone can use? Preferably one simple enough that like JSON's it is at least capable of being used as a graphic on the home page for the format? https://www.json.org/json-en.html https://www.json.org/json-en.html This is an honest question, because there may well be and I don't know it. However, I will put this marker down in advance: If multiple people jump up to say "oh, yes, of course, it's right here", and their answers are not 100% compatible with each other, then the answer is no. The other marker I'll put down is "just use common lisp", I want verification that it really is 100% standardized, no question what any construct means, ever, and I still bet we get people who would rather see Scheme or Clojure, and I bet there's some sort of difference. Neither of these objections is fatal to the idea. JSON is technically not just "javascript objects", so if someone carved out a defined format from s-expressions, then held it up as a standard, that would be as valid as what Crockford did. But at least as of right now, I'm not aware of anyone having done that standardization work. Replies welcome.
- lapinot 4y agoSEXPR := YOUR-CUSTOM-LITERALS | "(" SEXPR* ")"
- jerf 4y agoAlong with the many other issues that would have for just straight-up not being a usable grammar, the word "CUSTOM" appearing in a nominal cross language standard is a non-starter.
- lapinot 4y agoOh come on. Did you think anybody would write an RFC in the comments? Add arbitrary list of whitespace tokens everywhere and pick whatever favorite grammar you have for literals. Json strings and numbers since you seem to like them.
- jerf 4y agoOf course not. But you are at least semi-seriously trying to propose something. I promise you it won't be that easy to get any sort of agreement. This is a classic "oh come on how hard can it be" that, once you get into it, it turns out the answer is very. Arbitrarily so. Agreement is hard. Details are hard. A standard with no details is not terribly different from "just give us some text".
- zvr 4y agoAh, no types, no NIL. Every user has to specify how their usage expresses strings, integers, booleans, etc. Maybe start from one of the already existing standards https://en.wikipedia.org/wiki/S-expression#Standardization https://en.wikipedia.org/wiki/S-expression#Standardization ?
- mirekrusin 4y agoDune [0] is using sexp [1]. [0] https://dune.build https://dune.build [1] https://dev.realworldocaml.org/data-serialization.html https://dev.realworldocaml.org/data-serialization.html
- tgbugs 4y agoMy distaste for yaml led me to attempt just that. The first piece that was missing for me was a python parser that could produce reasonable error messages and could be transformed into the desired internal representation in python. So I wrote one [0]. It was supposed to be a single file that was less than 100 lines and could be copied and pasted into any project that I needed. Turns out that the issue was a bit more complex. The issue is that there is sufficient complexity in finding a portable representation for configuration formats that it just kicks the can down the road. On the other hand it means that as soon as you decide what format you are going to support you can quickly implement it. There is more or less a intersectional grammar that works across most if not all lisps, and that is the plist `(:k v :k2 (:k3 v2))`. So I settled on that for my own use. After all that work I have not dealt with the fact that numbers and chars do not have a portable representation across lisp dialects, which is a key complaint in other threads here. Limited support for let binding constants also seems like a feature that would allow for just enough expressivity to make the format useful without opening up the terror that is `&` and `*` in yaml (cool and useful as it may be). In summary s-expressions are: 1. missing good parsers in a number of language ecosystems 2. not standard across lisp dialects 3. need additional semantics for binding, multiple expressions, etc. 4. still better than yaml and json 0. https://github.com/tgbugs/sxpyr https://github.com/tgbugs/sxpyr