Jump to content

Indirect recursion only working with a breakpoint inserted


Recommended Posts

Posted (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 by jzoller
Posted

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.

post-2399-0-35226100-1345746905.png

Ton

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.