<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature">On Fri, Oct 27, 2017 at 1:53 PM, Sam McCall via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>We don't have a dedicated JSON library in the LLVM tree, I'd like to add one. The pressing need is for clangd, but we have other tools that read/write JSON too.</div><div><br></div><div>I'm proposing we write a new one, rather than importing a third-party library (licensing/integration reasons), on or extending YamlParser/YamlIO (usability/flexibility). I lean towards a design that parses a full DOM at once, and provides literal-like syntax for composing documents.</div><div><br></div><div>I've written a document laying out the reasons for taking this path, and my proposal for a design (with links to a prototype)</div><a href="https://docs.google.com/document/d/1OEF9IauWwNuSigZzvvbjc1cVS1uGHRyGTXaoy3DjqM4/edit" target="_blank">https://docs.google.com/<wbr>document/d/<wbr>1OEF9IauWwNuSigZzvvbjc1cVS1uGH<wbr>RyGTXaoy3DjqM4/edit</a><br><div>(Comments are enabled, but high-level discussion probably belongs on the list instead.)<br></div><div><br></div><div>What do you think? I'm particularly interested in which parts of LLVM produce/consume JSON (or might want to), and what they need. I'm mostly familiar with the stuff in clang-tools-extra.</div><div><br></div><div>Cheers, Sam</div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">The technical problems you've listed for YAMLIO aren't fundamental to the design of the library, and wouldn't be too hard to fix (it already has output support). However the usability concerns you have are pretty fundamental to the design, as it's designed for strong typing as opposed to exposing a DOM.</div><div class="gmail_extra"><br></div><div class="gmail_extra">An alternative I would suggest looking at is adding a JSON mode to YamlParser and then adding a YAML compatible DOM API similar to what you've proposed on top of that. I could see this being more complex/less usable than a dedicated JSON parser, but just want to make sure it's weighed against the cost of adding yet another parser.</div><div class="gmail_extra"><br></div><div class="gmail_extra">- Michael Spencer<br></div></div>