[antlr-interest] Differing behavior between ParseTreeDebugParse and Parser

Kevin Lindsey kevin at kevlindev.com
Tue Nov 23 10:09:36 PST 2004


Hello again,
 
>> I decided to follow the suggestion of one of the ANTLR articles which 
>> describes how to generate the derivation of a parse for debugging 
>> purposes. This was working great and then I started getting stack 
>> underflows from ParseTreeDebugParser. I reverted my grammar, but for 
>> the life of me the problem persists. I decided to switch back to the 
>> default "extends Parser" and the exact same parse completes 
>> successfully. I have defaultErrorHandler set to false, so I believe I 
>> should see any errors encountered during the parse. Is this an 
>> indication that something is wrong with my grammar or with 
>> ParseTreeDebugParser. BTW, I'm using the C# generation.

> Very strange.  And you reran antlr on the grammar of course before
> recompiling and running?  I sometimes forget ;)

Me too, so I've added it as pre-build action so I don't have to remember
anymore :-). Yeah, I just switched back to ParseTreeDebugParser with my
working grammar, and it underflows. The exception dump follows (and is
attached).

Thanks for you help,
Kevin


System.InvalidOperationException: Stack empty.
   at System.Collections.Stack.Peek()
   at antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree() in
D:\Xamlon\3rdparty\antlr-runtime\src\antlr.debug\ParseTreeDebugParser.cs:lin
e 116
   at antlr.debug.ParseTreeDebugParser.match(Int32 i) in
D:\Xamlon\3rdparty\antlr-runtime\src\antlr.debug\ParseTreeDebugParser.cs:lin
e 81
   at Xamlon.Flash.Msil.MsilParser.assemblyRefHead() in
d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 483
   at Xamlon.Flash.Msil.MsilParser.decl() in
d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 404
   at Xamlon.Flash.Msil.MsilParser.decls() in
d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 301
   at Xamlon.Flash.Msil.MsilParser.msil() in
d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 275
   at MsilParser_GUI.Form1.Parse(String source) in
d:\xamlon\xamlon\tools\msilparser_gui\form1.cs:line 189


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 
-------------- next part --------------
System.InvalidOperationException: Stack empty.
   at System.Collections.Stack.Peek()
   at antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree() in D:\Xamlon\3rdparty\antlr-runtime\src\antlr.debug\ParseTreeDebugParser.cs:line 116
   at antlr.debug.ParseTreeDebugParser.match(Int32 i) in D:\Xamlon\3rdparty\antlr-runtime\src\antlr.debug\ParseTreeDebugParser.cs:line 81
   at Xamlon.Flash.Msil.MsilParser.assemblyRefHead() in d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 483
   at Xamlon.Flash.Msil.MsilParser.decl() in d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 404
   at Xamlon.Flash.Msil.MsilParser.decls() in d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 301
   at Xamlon.Flash.Msil.MsilParser.msil() in d:\xamlon\xamlon\products\engine\flash\msilparser\msilparser.cs:line 275
   at MsilParser_GUI.Form1.Parse(String source) in d:\xamlon\xamlon\tools\msilparser_gui\form1.cs:line 189



More information about the antlr-interest mailing list