Re: [Spirit-general] [spirit2x] debugging

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Spirit-general] [spirit2x] debugging

Hartmut Kaiser
> I overhauled the debugging support for 2x. The one in
> spirit2 is lacking in some regards. It was inheritted
> from "classic" spirit almost as-is. I have some additional
> requirements for better debugging:
>
> 1) It should provide info on rule attributes and locals
> 2) It should be easy to set a breakpoint for conditional
>     debugging in the IDE
> 3) The user should be able to easily supply her own
>     debug handler.
> 4) The output should be valid xml (snippet) that can be
>     read by any xml editor
>
> Here's how to add debugging to a rule in 2X:

[snip]

Very nice! One question: rule/grammar naming still has to be explicit, no?
Did you keep the macros or is there a new way of doing this (including the
possibility to skip tracing of certain rules, etc.)?

Regards Hartmut


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Spirit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Spirit-general] [spirit2x] debugging

Joel de Guzman-2
Hartmut Kaiser wrote:

>> I overhauled the debugging support for 2x. The one in
>> spirit2 is lacking in some regards. It was inheritted
>> from "classic" spirit almost as-is. I have some additional
>> requirements for better debugging:
>>
>> 1) It should provide info on rule attributes and locals
>> 2) It should be easy to set a breakpoint for conditional
>>     debugging in the IDE
>> 3) The user should be able to easily supply her own
>>     debug handler.
>> 4) The output should be valid xml (snippet) that can be
>>     read by any xml editor
>>
>> Here's how to add debugging to a rule in 2X:
>
> [snip]
>
> Very nice! One question: rule/grammar naming still has to be explicit, no?

Yeah. It still has to be explicit. The only way to make it automatic
(AFAIK) is to make the rule declaration a macro.

> Did you keep the macros or is there a new way of doing this (including the
> possibility to skip tracing of certain rules, etc.)?

I went straight c++ this time, just as I did with the error handler.
I don't quite see the benefit in keeping the macro since we agreed
to keep the debug handlers only for nonterminals (rules), not
arbitrary parsers (like in classic).

As for skip tracing, yes there are a couple of ways to do it.
I haven't added it yet to the API because I don't know how
to make it usable. Do you do it dynamically? If so, how do
you enable/disable debugging of a certain rule? Setting a
flag? Calling an API? Do you need to recompile to do it? If
so, how is it better than simply ifdefing or commenting out the
code? If not, how do we manage the enabling/disabling at runtime?
I'd guess a boolean flag is good. That way we can set/reset it
in the IDE's debugger.

So many questions. I'd like to hear your thoughts. In general:
how do you want to debug spirit parsers? And this question is
addressed to everyone. I'd love to hear usage scenarios.

Regards,
--
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Spirit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Spirit-general] [spirit2x] debugging

Joel de Guzman-2
Joel de Guzman wrote:

> As for skip tracing, yes there are a couple of ways to do it.
> I haven't added it yet to the API because I don't know how
> to make it usable. Do you do it dynamically? If so, how do
> you enable/disable debugging of a certain rule? Setting a
> flag? Calling an API? Do you need to recompile to do it? If
> so, how is it better than simply ifdefing or commenting out the
> code? If not, how do we manage the enabling/disabling at runtime?
> I'd guess a boolean flag is good. That way we can set/reset it
> in the IDE's debugger.

BTW, a good strategy is to collect the debug result into a
text editor and inspect it with an XML editor. Some (most?)
editors have display filter capabilities to make it easy to
spot find the piece of XML you are looking for. I think that
alone is a very significant advantage. Instead of fine-tuning
the output, disabling/enabling parsers, we provide all the
information and let the viewers do the filtering.

Regards,
--
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Spirit-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-devel