-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theory of JSON parsing #1403
Theory of JSON parsing #1403
Conversation
Converted to draft: I'll add another commit with some minor fixes and cleanup. |
I'd be happy to take delivery of this more or less as is, but do take your time polishing to your satisfaction. One thing, I'd particularly like to see, but can do myself if you prefer is to really use |
Thanks for your feedback. I would also hope for a better number representation than the current one, and I tried rewriting the theory to use Should I try using |
This is an interesting question. Of course, if you're committed to being that accurate, you might use HOL's floating point type. |
Thanks for the tip. I've looked through
A brief search reveals there was an extension of Harrison's formalisation (which Therefore, I suggest I document the JSON number representation further, define a separate type for it, then provide mechanisms for extracting |
…e_jsonTheory. Small correction to treatment of trailing zeroes
JSON RFC says
which suggests to me that you could use |
Yes, the RFC says that 64-bit implementations have "good interoperability", but for full interoperability you must support arbitrary precision. You can have a RFC-compliant 64-bit implementation, but it wouldn't be interoperable with all other RFC-compliant implementations as far as numbers are concerned. This was the main priority I had in mind when writing this (specifically, permitting as many cases prefixed by "i" in this list as possible). Of course, there could also be a point in having an implementation that is limited to 64-bit floats, if you want to exclude the existence of more precise floats. It would be easy to just create another file and have, for example, It's your call in the end and if you only want |
Thanks for taking the time over this. I agree with you that the current approach is probably the best match for the full generality of what the RFC requires. |
Thanks again for your feedback. I have now marked the PR as ready for review and merge. |
Thanks again! May move within the |
This small JSON parsing theory, written by @arolle and myself, has been validated against the "Parsing JSON is a Minefield" test suite. @myreen suggested I make a PR in some previous discussion - please give feedback on whether there is additional work or cleanup needed.