[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] lpg question

Hi David,

I take it what you're trying to do is have LPG print out which reductions are actually happening during a parse so that you can debug your parser.

As far as I know there is no way to automatically get LPG to do that for you, so you need to do it yourself. You'll notice that the information you need is at the top of the *.l files. So to make it work I wrote a little script that reads the *.l files and generates a Java class that contains a giant String array where the index is the rule number and the element is the rule. Then I added a couple lines of code to the top of the ruleAction() method in the generated parser that uses the array to print out the rules that are being fired.


Mike Kucera
Software Developer
IBM Eclipse CDT Team
mkucera@xxxxxxxxxx

Inactive hide details for David Sariel ---09/14/2009 04:12:35 AM---Hello,David Sariel ---09/14/2009 04:12:35 AM---Hello,


From:

David Sariel <datosar@xxxxxxxxx>

To:

"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

Date:

09/14/2009 04:12 AM

Subject:

[cdt-dev] lpg question




Hello,
yacc (bison) supports --verbose and --debug options allowing automatic
generation of debug outputs like:

Reducing via rule 93 (line 329), statement -> statement_list
...
Reducing via rule 185 (line 601), statement_list -> translation unit
...

Does lpg analogs (-verbose and -debug switches) allow the same? I'm
generating parsers with those options.
*.l files indicate that VERBOSE, DEBUG are options in effect. But
parser files generated are the same
as without -verbose and -debug, i.e. no debugging outputs were generated.

Am I missing something?

Thanks,
David
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


GIF image

GIF image