jzoller Posted August 23, 2012 Report Share Posted August 23, 2012 (edited) Maybe someone can find what I'm doing incorrectly... I'm doing a fairly literal port of json_parse.js from Douglas Crockford. It's an indirect recursive descent parser that uses a global to track where it's at in the JSON string that it's parsing. Essentially, value() calls object(). object() may then call value(), and so on. Works great... as long as my value.vi has a breakpoint inserted at the beginning. Take the breakpoint out, and the vi doesn't... really seem to execute. Or it does, but unpredictably. Does anyone have any insight into what might be going on here? The code was crashing with an access violation. I spoke with an AE, and he said my top level VI was corrupted. Replacing the LV native globals with an LV2 global fixed the crash, but hasn't fixed the execution issue. Code's attached, if anyone has any insight. Parse.vi is the top level. (Sorry, haven't had a chance to implement array() yet...) Thanks, Joe Z. json indirect recursion.zip Edited August 23, 2012 by jzoller Quote Link to comment
Ton Plomp Posted August 23, 2012 Report Share Posted August 23, 2012 I saw one possible race condition in 'value'. There was no data-dependency between 'white' and 'global' (white calls global internally). Adding that fixed it it on my PC. Ton Quote Link to comment
jzoller Posted August 23, 2012 Author Report Share Posted August 23, 2012 Thanks Ton! I'll scrub the code for other possible race conditions as well. Joe Z. Quote Link to comment
Ton Plomp Posted August 23, 2012 Report Share Posted August 23, 2012 Have you ever looked at the 'Variant Probe/XControl'? Here's the output plotted (on my comma seperated computer): Ton Quote Link to comment
jzoller Posted August 23, 2012 Author Report Share Posted August 23, 2012 It looks useful. My work currently doesn't allow me to get to the mirrors that carry the OpenG tools, so I'll check it out later tonight. Quote Link to comment
Ton Plomp Posted August 25, 2012 Report Share Posted August 25, 2012 Hi Joe, your code looks interesting! Any thought on uploading it to the CR? Ton Quote Link to comment
jzoller Posted August 29, 2012 Author Report Share Posted August 29, 2012 Ton, There are potential licensing issues on this version. I'll be re-implementing (without globals) for an open source version... or anyone else is welcome to, if they wish. Joe Z. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.