Hi all. Wanted to share a couple YAML things here...
First is https://play.yaml.com/
This is a complete redo of the old one some of you may have seen. I think it's pretty awesome. All of the runtimes are up to date (well within a week or two). You can login to github with it and submit new test cases you find to the https://github.com/yaml/yaml-test-suite/
You can even run the whole test suite against any parser in the browser
It caches results and you can get an instant omparison report
Use K to see key shortcuts to get started
Second is https://github.com/yaml/yaml-reference-parser/tree/main/parser-1.2/clojure The YAML reference parser is now ported to clojure (passes 100% of yaml test suite)
This would be used as an alternate to parser to SnakeYAML to make clj-yaml available as pure Clojure.
I'd be glad to help out if there is interest in doing something.
FYI
Cool, @ingy!
I wonder if it might make sense to create a separate yaml lib instead of trying to shoehorn this into clj-yaml. Do you know if the reference implementation is babashka compatible? What's the intended public API?
it looks like something is bb compatible:
$ rlwrap bb
Babashka v1.12.214-SNAPSHOT REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require '[yaml-parser.core :as y])
nil
user=> (y/parse-yaml "- a")
"+STR\n+DOC\n+SEQ\n=VAL :a\n-SEQ\n-DOC\n-STR\n"yaml parsers turn yaml into a stream of event structs this is what you use snakeyaml for and what the refparser does
I assume the integration would be rather trivial
I will say that the reference parser is not very performant...
yet, 🙂
It was originally written he cause not a yaml parser passed the test suite in 2021.
Now a bunch do. I'd say 6 7?
😂
at least 4
The reference parser is generated code from the (211) spec productions turned into a yaml file
generated as perl, coffeescript, javascript and now clojure
I actually have yes for it in YS, Because avoiding snake and having it be pure clojure Opens up doors to other clojure platforms
@lee I agree having as a separate lib is probably wisest for now
If there is even any interest. I would like to see the generated code become more performant. esp if I do anything serious with if.
Having it in clojure feels like a win towards that goal
I'm sure you guys know of a lot of tools that would help with that