Parser hangs (I think) Why?

I have been working on a story for a while. I made a number of complex changes to an action. The action works in some cases but not in others.

But here is the question. As an example, if the next test line was “… / insert ball into chute / …” for example, the story would freeze despite using trace or rules. So I have no idea where the hang/freeze is occurring. Not sure HOW to debug this.

>rules
Rules tracing now switched on. Type "rules off" to switch it off again, or "rules all" to include even rules which do not apply.

>trace 5
[Rule "ignore beta-comments rule" applies.]
[Parsing for the verb 'trace' (4 lines)]
[line 0 * -> TraceOn]
[line 1 * number -> TraceLevel]
[Line successfully parsed]
[Rule "declare everything initially unmentioned rule" applies.]
[Parser tracing set to level 5.]

...
[Rule "A last turn sequence rule" applies.]
[Rule "notify score changes rule" applies.]
>[11] insert ball into chute

So the previous command finished (notify score rule). After the next test command… nothing. No trace, no rules to show that the interpreter even make through any code. Anyone seen this and have suggestions as to what I might have done to break my code?

Without seeing any of your code, it’s pretty hard to diagnose. If I had to guess, it’s happening in either the “ignore beta-comments rule” – which either comes from your code or an extension – or any rules that fire before it.

Modern interpreters typically buffer all the output from one command and display it all at once. This makes for a smooth, non-flickering UI. But it also means that if the interpreter goes into an infinite loop, the command’s entire output is jammed up and never appears.

(Therefore, the “ignore beta-test rule” is probably irrelevant. It was part of the previous command, the last one that succeeded, not the one that got stuck.)

It might be helpful to put “stop the action” in various places in your action sequence so you can see what path it’s going down. You’re looking for some place where an action tries to invoke itself, probably.

If you are really desperate, you can compile an interpreter with CheapGlk (which doesn’t buffer anything). But I’m afraid this is not particularly easy if you’re not comfortable with compiling programs in C.

3 Likes

Thank you for the quick reply. The buffering makes sense. I started commenting out large chunks of code and narrowing them down. I think I have it to a few lines now. I can live with this solution. The buffering behavior threw me off. Maybe this post will help someone else one day :slight_smile: Thanks again.

1 Like