6 ms·
Silent moment for those of us using niche languages to meet production requirements in environments that do not allow third-party code and do not have JSON pars
by ben_jones 10y ago
Silent moment for those of us using niche languages to meet production requirements in environments that do not allow third-party code and do not have JSON parsing in the std lib...
- oblio 10y agoIf your language doesn't come with JSON in the stdlib, you're really on the cutting edge. Or using a language meant for embedding :)
- grondo4 10y agoDoesn't Java lack a JSON parser in the standard library?
- prodigal_erik 10y agoThe standard Java library includes a JavaScript interpreter, so there has to be a parser for object literals in there somewhere.
- tree_of_item 10y agoObject literals aren't JSON, though.
- Volt 10y agoJS has stringify and parse, so there ought to be a JSON parser somewhere.
- dfox 10y agoOne thing that the article mentions is that there are in fact strings that are valid JSON but not valid JS object literals.
- Macha 10y agohttps://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... A modern JS implementation should also have a JSON parser
- amake 10y agoAs of Java 8, the Nashorn JavaScript engine is included by default, and it does support JSON parsing. [1] http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/ http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/
- int_19h 10y ago> you're really on the cutting edge. Or the other way around. Think about something like MUMPS.
- differentman 10y agoNo, no thank you. Did it for a year. Pretty sure I don't even want to think about doing it again.
- deleted 10y ago[deleted]
- jfoutz 10y agoIf you don't have a solution, or you're not happy with your current solution, take a look at parsec style parsing. you can make a lot of progress with just a few combinators, and those style parsers are pretty easy to read. You can get an implementation working with a fairly high level of confidence that it's right. If it's not fast enough, make a pretty printer for your AST. Then do a CPS transform (by hand) on your library and parser, so you can make the stack explicit. Make sure the transformed version pretty prints exactly the same way. Then make a third version that prints out the code that should run when parsing a document, rather than doing the parsing directly. You'll get a big case switch for each grammar you want to parse. Your pretty printer will help you find many bugs. It's a pretty achievable path to get your grammar correct, and then get a specialized parser for it.
- thechao 10y agoPour a 40 for me; I shall go wallow in my assembly shame.